summaryrefslogtreecommitdiff
path: root/gs/src/gxclpath.c
AgeCommit message (Collapse)AuthorFilesLines
2008-08-29Split the source tree into two new directories.Ralph Giles1-1514/+0
PSSRC files are now in 'gs/psi'. GLSRC files are now in 'gs/base'. This is to facilitate build modularization and merging in the ghostpdl tree. NOTE: msvc32.mak is now in psi, not src. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@9048 a1074d23-0009-0410-80fe-cf8c14f379e6
2008-08-07Fix (graphics) : Redundant patterns in clist (continued),Igor Melichev1-8/+18
DETAILS : Bug 689995 "segfault with 09-34.PS" 1. (the bug fix) A recent patch doesn't account patterns with no tile, which represent an empty pattern. This change inserts checks for empty tiles and process them with no optimization (redundantly), because they are small and are not cached. See comments in code. 2. pcls->band_complexity.uses_color accummulated a pattern address bits instead a real data. This bug was introduced when serializing colors to clist. nevertheless this bug has no visible effect because 'pure' is overlayed with a tile address, which can't be equal to 0 or 0xffffff. So formally this part of the change is algorithmically equivalent, but it is important for redability. Note that when serializing a pattern to clist, 'uses_color' is not properly computed and needs further development. see new bug 689997. Minor change : removed the second call to gs_dc_get_pattern_id for a faster code. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8952 a1074d23-0009-0410-80fe-cf8c14f379e6
2008-08-06Fix (graphics) : Redundant patterns in clist.Igor Melichev1-0/+15
DETAILS : Bug 689865 "clist stores redundant patterns". The change is pretty simple because the clist reader already implememnts a pattern cache. We just add pattern id to gx_clist_state and provide a short format (just the id) when writing and reading a pattern color to/from clist at second time. A new function gs_dc_get_pattern_id allows to access the pattern id through closures of color elements. Note it remembers up to 2 pattern ids for a band (one for the specific band, and another for "all bands"). A better way would be to remember all patterns cached for a band, but it would need to save all cached ids individually for each band while clist writing. We don't want to enlarge the clist writer storage now. Minor change : Some dependencies of gxclpath.c were missed in makefile. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8940 a1074d23-0009-0410-80fe-cf8c14f379e6
2008-07-03Fix (clist writer) : Indeterminizm writing a degenerate curve.Igor Melichev1-1/+1
DETAILS : Bug 689911 Shifting raster data, Windows MSVC 8 non-debug build. In function cmd_put_path the variable 'prev' was wrongly localized in the loop body when need to save/pass data from the previous cycle. It worked fine with debug build, because the compiler always commits variables to RAM for debug purpose. With release build the variable 'prev' never changes because formally speaking the program never uses its value after it is initialized. The bug persists since the repository was created on March 9 2000. The old behavior may be indeterministic. With MSVC8 the effect is occasionaly visible when a degenerate curve {x y x y x y x y} is written into clist. See the simplified test case attached to the bug report. EXPECTED DIFFERENCES : None, but the old behavior may be indeterminiztic. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8815 a1074d23-0009-0410-80fe-cf8c14f379e6
2008-05-22Enhancement (graphics) : Delay applying type 1 raster patterns until clist ↵Igor Melichev1-22/+39
interpretation (continued 4). DETAILS : The old code assumes that a pattern always fits into the clist writer buffer. However ppmraw -r400 176-01.ps violates this assumption. This patch implements a subdivision of a pattern into slices, each of which is smaller than the buffer size. 1. The new function cmd_get_buffer_space retrives maximal available space in the clist writer buffer (gxclutil.c). 2. cmd_put_drawing_color now implements a cycle for slicing big patterns. Each slice writes to clist as a separate clist instruction (gxclpath.c). 3. gx_dc_pattern_write_raster drops the constraint that the pattern fits into a single buffer (gsptype1.c). 4. The clist interpreter is enhanced with composing a pattern from slices (gxclrast.c). EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8770 a1074d23-0009-0410-80fe-cf8c14f379e6
2008-05-07Enhancement (graphics) : Delay applying type 1 raster patterns until clist ↵Igor Melichev1-0/+4
interpretation. DETAILS : Bug 689579 "Ghostscript generates a very, very large temporary file". The old code converts pattern fills into lots of constant color rectangles while writing to clist. The new code writes pattern data to clist and apply pattern during the clist playback. So here we complete the change started in revision 8655. New functions gx_dc_pattern_write_raster, gx_dc_pattern_read_raster implement color serialization for raster patterns. The old function gx_dc_pattern_write got minor changes about buffer localization. Minor chabge (gxclimag.c, gxclpath.c, gxclrect.c) : Propagated error codes. Also fixed a bug occasionally found in gxclrast.c . It caused a crash in some unusual conditions. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8712 a1074d23-0009-0410-80fe-cf8c14f379e6
2008-04-10Enhancement (graphics) : Generalize prototypes of color serialization ↵Igor Melichev1-0/+2
methods for big color data. DETAILS : This is a preparation for fixing the bug 689440 "PostScript file generates infinitely large temp file". The old serialization methods assume that color data can fit into a small buffer. Now we want to drop this constraint to allow to write big patterns into clist. See comment in code for details. This change is algorithmically equivalent. This patch adds a new argument to color serialization methods. For a while the new actual parameter is always 0, and the (untrivial) methods check for it. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8632 a1074d23-0009-0410-80fe-cf8c14f379e6
2008-03-03Fix (clist) : Crop transparencsy commands while clist writing, step 3.Igor Melichev1-0/+4
DETAILS : This really crops transparency compositor commands with bands that are covered by the transparency bbox. Actually the statement above has one exception. When a transparency bbox covers more that 2/3 of all bands, we still write the commands to the "all bands" list for a shorter clist file. We noticed that the clist playback time strongly depends on the file size. 1. The new method gs_composite_type_procs_t::get_cropping replies what bands are covered by the compositor. When it gives a non-trivial result, clist_create_compositor writes the compositor command to those bands, which are covered with the cropping (Exception : if too many bands are covered, it writes the command to the "for all bands" list). 2. Since some bands skip some compositor commands, while clist reading the association of masks to groups becomes more complex. Before this patch each group was associates with the mask, which was created immediately before it at same transparency stack level. After this patch some groups may be skipped, so that clist reader may recieve extra masks, because masks are still use the container's group bbox. For skipping such extra masks we provide a numeric identifier of a mask, which is named mask_id. Here is how it works : 2.1. All masks recieve serial numbers (mask_id) while clist writing. 2.2. Each mask command is written with its mask_id. 2.3. Each group command is writen with mask_id, which belongs to the mask that is assocuated with the group. 2.4. While clist playback pdf14_pop_transparency_group checks whether the mask amd the group have same mask_id. If not, the mask is extra and it must be droped. 2.5. Note the old assiciation logic is still working, and it may skip some masks as well. 2.6. If the rasterization happens with no clist, mask_id is always zero. In this case the old logics is only working. Maybe we'll provide non-zero values someday. 2.7. See comments in code for more details. 3. The method gs_composite_type_procs_t::clist_compositor_write_update is now some generalized. Before this patch it only updates the clist writer state with the compositor features. With this patch it also adds some information from the clist writer state to the compositor parameters. Particularly it provides mask_id to the compositor command. Thus now it updates *both* clist writer and the compositor parameters to comply each another. For a while, in order to simplify the patch, the compositor argument is still 'const'. Will need to fix someday. 4. Now we need to save mask_id in a stack that reflects the transparency nesting. The cropping stack, which was introduced in the last patch, now works for that. To provide that we add mask_id to clist_writer_cropping_buffer_s, and use clist_writer_push_no_cropping to save amsk_id over inner groups. 5. state_update(ctm) in c_pdf14trans_clist_write_update is replaced with code, which updates CTM from the transparency compositor command. The old code is not fully correct, because it takes CTM from the imager state, rather we havn't got prcatical cases when it gives a wrong result. 6. drop_compositor_queue now calls adjust_ctm for compositors being dropped. The old code is incorrect because it can miss a CTM update when a compositor sets some CTM and later a non-compositor object sets same CTM. In this case the clist writer skips the second CTM on writing, and skipping the first in the clist reader will miss the CTM completely. We haven't got practical cases for that. 7. Improved some debug printing. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8585 a1074d23-0009-0410-80fe-cf8c14f379e6
2008-03-03Fix (clist) : Crop transparencsy commands while clist writing, step 2.Igor Melichev1-0/+2
DETAILS : This is a preparation to the next step. The patch introduces a transparency stack for clist writer, which saves cropping when entering a transparency group, and restores when exiting it. The cropping is being narrowed with transparency group's bounding box. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8584 a1074d23-0009-0410-80fe-cf8c14f379e6
2008-03-03Fix (clist) : Crop transparencsy commands while clist writing, step 1.Igor Melichev1-7/+6
DETAILS : This is a preparation to the next step. In general, the behavior doesn't change, but implementation details differ. The old code maitains a flag cropping_by_y in the clist writer, which triggers a cropping of objects by the Y axis. The old code isn't perfect, because it first crops by [cdev->cropping_min, cdev->cropping_max], and then by [0, cdev->height]. In the new code we unite both croppings into a single one. For doing that we remove the flag, and provide the right interval [cdev->cropping_min, cdev->cropping_max] in any case. Initially it is [0, cdev->height}, and it is narrowed when a shading bbox is set. To restore the initial cropping after the shading is complete, we maintain 2 new fields save_croping_min and save_cropping_max. So now the cropping mechanizm does not depend on shading, and clients may set a croping when they need. We'll use this feature in the next patch. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8581 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-12-07Fix (clist interpreter) : Skip idle compositors, step 3.Igor Melichev1-0/+12
DETAILS : The clist writer writes the 'create compositor' operation to all bands, including ones that are not covered by a transparency. It does so because this operation changes the number of color components. When rendering a specific band, it frequently happens that a compositor is created and then immediately destroyed. Such thing happens outside the transparency bbox, and within the transparency bbox if the band has no transparent objects. When compositor is created, it allocates a big raster buffer and cleans it. Due to that we observe a significant CPU time expence when running the test case of the bug 689155. This patch is a preparation for further improvements. This patch includes CTM into pdf14 compositor params (see changes to c_pdf14trans_read, c_pdf14trans_write, clist_create_compositor). The result should be same as the old code, but the algorithm is different. The old code wrote CTM as a separate command before cmd_opv_ext_create_compositor. The new code does not, and in many cases compositor commads immediately follow each another. The last fact changes the behavior of the compositor queue : before this patch it consisted of 1 element maximum, but after it the queue becomes longer (up to 10 elements with SoftMaskGroup.pdf). A bug is fixed in the queue logic in gxclrast.c ln 1355. The queue is still immediately executed when a non-compositor command appears in the input stream. An annihilation of neighbour idle compositors will be a next step. Minor changes: - added a new method adjust_ctm to gs_composite_type_procs_t. - added type checks with composite_*_proc macros to all compositor types. - dependencies were broken for gdevp14.c in lib.mak . EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8426 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-11-29Fix (shadings) : Optimize path manipulations for shading fill (continued).Igor Melichev1-1/+6
DETAILS : Debugged with the test case of the bug 689155. A long ago the graphics library converted the sfill clipping into a path. It was improved with revision 8017 with introducing a device response for pattern_manage__shfill_doesnt_need_path. However the revision 8017 appears incomplete : it missed the related change to the clist writer device and to pdf14 device. This patch fixes it. This patch causes a progression for the problem known as bug 689338 "Raster depends on bands". With banded rendering some shadings are now painted some wider, and the raster appears equal to one from unbanded rendering. It happens because the old code doesn't convert shfill clipping into a path when no banding, and does convert when banding. The new code does not convert in both cases. EXPECTED DIFFERENCES : Progression : a banded raster is closer to unbanded : 300dpi banded : gradmesh.ai S2_Digitalproof-Forum_x3k.pdf SmoothShading.pdf 72dpi banded : shading_prob_800.ps Bug688631.pdf git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8416 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-09-25Replace the 'private' define with the now standard C keyword 'static'.Ralph Giles1-6/+6
DETAILS: The compilers we support have supported static for some time now, so idiomatic, and removes one of the obstacles to compiling Ghostscript as C++. The patch also removes support for compilation with -dNOPRIVATE, which is not longer necessary with modern debuggers. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8250 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-09-14Banding : Extend clist language with trapezoids, linear color trapezoids and ↵Igor Melichev1-10/+10
linear color triangles (continued 8). DETAILS : Bug 689436 "pattern rendering regression with revision 8095". Do not write tile phase to clist before trying to write the color. If the latter fails, the phase may become wrong due to overloading cmd_opv_set_tile_phase with tile phase and device halftone phase. With the test case the old code, when writing a trapezoid to clist, first writes halftone phase, then fails to write the pattern color and falls back to gx_default_fill_trapezoid. The latter writes strip_copy_rop with it own phases. But the clist reader expects strip_copy_rop phase to be written *after* the tile header, so the reader misses the phase sychronizm. The fix simply delays writing the phase after the color is written. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8240 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-08-10This code change should have been committed in tandem with the changeHenry Stiles1-1/+1
in revision 8055 (see 8055 log for details). git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8182 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-07-17Banding : Extend clist language with trapezoids, linear color trapezoids and ↵Igor Melichev1-0/+1
linear color triangles (continued 8). DETAILS : This fixes (some) gcc warnings in the recently added code (part 2). EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8134 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-07-11Banding : Exten\d clist language with trapezoids, linear color trapezoids ↵Igor Melichev1-29/+65
and linear color triangles. DETAILS : This fixes the clist expansion problem for shadings. 1. New functions clist_fill_linear_color_trapezoid, clist_fill_linear_color_triangle provide the writing of shading parts into clist without a further decomposition into rectangles. 2. gxclrast.c is enhanced with reading the data from 1. 3. gxfill.c needs a special interaction with the clipper device for passing the clipping path as a high level object. The new request pattern_manage__handles_clip_path checks whether the target device can handle a clipping path. The clist writer can, so the graphics library first sends the clipping path, and then decomposes the shading into trapezoids without installing a clipper device. Doing so because clipper device can't handle trapezoids. See comments in gxclpath.c, gxfill.c . 4. The clist reader installs a clipper device when processes trapezoids and linear color triangles. The new flag clipper_dev_open controls that. 5. A new flag gx_device_clist_writer_s::cropping_by_path controls an additional cropping of shading components, which fall outside the shading path's bands. See comment in gxclpath.c . 6. R_fill_rect_with_const_color is rewritten with linear color functions, because the old implementation creates a rectangle, which is not clipped with 4,5. It gives an invisible slowdown for unbanded rasters. There are few things, which need further improvements : 1. A better compression for frac31 values in clist. Such values usually have many zeros in ending bits. 2. Crop bands with ybot, ytop, fa->ystart, fa->yend in clist_write_fill_trapezoid. 3. The clist reader must handle cases when linear color functions return 0. It must perform a decomposition of areas with calling appropriate parts of gxshade6.c . The current code returns error, which does not happen in practice. EXPECTED DIFFERENCES : There is a problem with pkmraw -r300 Bug689189.pdf which has to be fixed separately. This patch causes a minor raster difference with shadings : with a banded rendering the shading area becomes some smaller than the old banded rendering. It needs a further analyzis. Here is a list of files with this problem : "442-01.ps" "446-01-fixed.ps" "464-01-fixed.ps" "470-01.ps" "478-01.ps" "483-01.ps" "483-05-fixed.ps" "Altona-Testsuite_p2_S_x3.pdf" "Altona_Visual_bb_1v1_x3.pdf" "Altona_Visual_sb_1v1_x3.pdf" "BEST8-99-Path.fh7.pdf" "Bug689189.pdf" "chilis_black.pdf" "chilis_red.pdf" "Clarke Tate Manns Chinese.ai" "gradmesh.ai" "Openhuis_pdf_zw.pdf" "S2_Digitalproof-Forum_x3k.pdf" "self-intersect2.ps" "shading_prob_800.ps" "SmoothShading.pdf" "STEUER-RollingMesh 1(linear).ai" "STEUER-RollingMesh 2(radial).ai" "STEUER-RollingMesh 3(Final).ai" "Testform.v1.0.2.pdf" This list may be related to bug 689338. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8118 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-07-06Fix : Improving documentation for gxclpath.c .Igor Melichev1-0/+8
DETAILS : Bug 689317 "A wrong rendering of a path", Comment #3. The revision 2948 change to gxclpath.c is not properly documented. This patch stores assumptions, which are necessary for the change to be correct. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8109 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-06-30Fix : Expanding gxcldev.h macros, part 6.Igor Melichev1-25/+8
DETAILS : This change is algorithmically equivalent. The purpose is to eliminate gxcldev.h macros to simplify the debugging of the clist writer methods. This 6th step simplifies the flow control with removing unuseful goto and labels. Also it updates the documentation in gxcldev.h . EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8090 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-06-29Fix : Expanding gxcldev.h macros, part 5.Igor Melichev1-8/+35
DETAILS : This change is algorithmically equivalent. The purpose is to eliminate gxcldev.h macros to simplify the debugging of the clist writer methods. This 5th step eliminates FOR_RECTS and END_RECTS macros. So now all control flow statements are outside macros. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8087 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-06-29Fix : Expanding gxcldev.h macros, part 3.Igor Melichev1-49/+52
DETAILS : This change is algorithmically equivalent. The purpose is to eliminate gxcldev.h macros to simplify the debugging of the clist writer methods. This 3nd step collects local variables of a rectangle enumerator in a single structure cmd_rects_enum_s. In the old code the macro FOR_RECTS modifies function arguments 'y' and 'height'. It doesn't comply with C-style.htm . For fixing that this patch renames function arguments x,y,width,height with rx,ry,rwidth,rheight. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8085 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-06-26Fix : Expanding gxcldev.h macros, part 1.Igor Melichev1-6/+12
DETAILS : This change is algorithmically equivalent. The purpose is to eliminate gxcldev.h macros to simplify the debugging of the clist writer methods. This first step removes simple macros and optimized macro duplicates. Removing others to be done in the next step. Some compilers may claim unreferenced label error_in_rect. To be fixed in the next step. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8078 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-06-05Update licence headers. Copyright has been transfered from artofcode LLCRalph Giles1-1/+1
to Artifex Software, Inc. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@8022 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-04-03Committing Raph's wtsimdi deviceStefan Kemper1-0/+2
DETAILS: -r600 -sDEVICE=wtsimdi does a performance optimized clist reader that either directly halftones or uses an intermediate rgb buffer to do non-trivial ROPS correctly then post halftones on a per band basis. Uses icc color profiles to convert to device color. Uses wts halftone algorithm. The device reads in a link icc profile from "link.icc", and WTS halftone files from wts_plane_[0123]. It generates a ppm file that can be used to visualize the halftoned file (it is prepared from the CMYK bits in the procedure write_pkmraw_row in gdevwts.c - if an actual device is available, that routine should be modified to produce data for the device). This device _does_ switch on a per-band basis between continuous tone pathways (true branch of the "if" statement in wtsimdi_create_buf_device) and halftone, based on whether there are rops. That is the major point of the work. This is not yet production ready, but is useful for performance and integration work. Known issues: 1. Banding only, low res non-banding will crash, the device is intended for printer resolution halftoning, at 600dpi The halftones are designed for 600dpi. 2. Color profiles and halftone screens are not in romfs, These need to be copied into the same object/binary directory that the application is in for now. ./pspcl6 and ./wts_* and ./*.icc in the same directory. Failure to find these files will crash. 3. Halftone phase not set correctly in halftone band. 4. copy_mono doesn't optimize all-0 and all-1 colors as much as it should - it can avoid processing the screen at that point. 5. halftone mode implemented only for rgb color model, not CMYK. 6. size of band_colors_used[] array is statically determined EXPECTED DIFFERENCES : None, unless -sDEVICE=wtsimdi is used. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@7819 a1074d23-0009-0410-80fe-cf8c14f379e6
2007-03-05Non-backwards compatible change: use consistent reference count allocationRaph Levien1-2/+1
discipline for color spaces. Previously, color spaces were allocated on stack, on the heap, as sub-structures within other color space structures, and were very commonly copied. Reference counting was used for the "params" block of some, but not all, color spaces, but there were correctness problems with that logic. In addition, a number of "const" qualifiers have been removed, because the action of bumping the reference count on an object is not consistent with the C semantics of const. This change is required to resolve problems with enhancement 688924. It should also help with memory leaks. Other clients, such as the PCL interpreter, will require changes to be compatible. For simple device colorspaces, the change to gs_setcmykcolor() (gscolor1.c) is representative of the code change required. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@7765 a1074d23-0009-0410-80fe-cf8c14f379e6
2006-03-13changed copyright headersStefan Kemper1-13/+10
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@6651 a1074d23-0009-0410-80fe-cf8c14f379e6
2006-03-09Add missing initialization to the streams allocated on the stack or in rawAlex Cherepanov1-0/+1
memory. Bug 688572 DETAILS: The following code doesn't initialize all the fields in the stream structure. stream s; sread_string(&s, ...); but it initializes enough fields to be mostly working. The bug has been detected by Valgrind. DIFFERENCES: None git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@6643 a1074d23-0009-0410-80fe-cf8c14f379e6
2005-10-10Optimizing the transparency compositor.Igor Melichev1-8/+27
DETAILS : Bug 688255 "ai7 pdf fails on 7.03, runs for ten + minutes on 8.51". The old code always allocates a transparency buffers for entire band. The new code accounts group bbox to minimize buffers. Due to that buffers appear empty for many of bands. The time consumption for the test case of the bug 688255 is dropped in about 100 times (from 8000 seconds to 71 seconds on a 3.07GHz machine, measured with debug build). 1. The transparency bbox computes in pdf14_begin_transparency_group from the group bbox and the CTM (gdevp14.c). 2. Handle an empty buffer pdf14_buf_new, pdf14_pop_transparency_group (gdevp14.c). 3. Fixed a bug in the rectangle clipping in pdf14_mark_fill_rectangle, pdf14_mark_fill_rectangle_ko_simple. The old code didn't sense it because bbox always covered entire band (gdevp14.c). 4. Write the bbox to clist in c_pdf14trans_write and read it in c_pdf14trans_read. 5. The pdf14 compositor needs CTM to transform the group bbox to the device space. Forced the writing of CTM to clist before writing the compositor in clist_create_compositor. (Sorry, it appears some ugly due to pcte->type->procs.write creates a body of a command, but we need to create a set of two commands; Another minor optimization - a narrowing the set of bands - is delayed, see comments in code in clist_create_compositor) (gxclimag.c). 6. New functions cmd_write_ctm_return_length, cmd_write_ctm are factored out for (5) (gxclpath.c, gxclpath.h). This part of the change is algorithmically eqiuivalent. 7. Minor change : fixed coding style of "} else {" in gdevp14.c . EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@6147 a1074d23-0009-0410-80fe-cf8c14f379e6
2004-10-07Fix initialization of C stack streams that did not perform s_init().Ray Johnston1-0/+1
Bug 687709 that could result in a Segmentation Fault (SEGV) DETAILS: The normal s_alloc() streams included s_init() on the allocated stream, but C stack streams could have uninitialized elements in the stream struct. Since this was UMR related, and affected the clist mode, the jpeg device and the pswrite device (and possibly some pdfwrite data), this would be different on different platforms. The premature 'CloseTarget' action when the stream->close_strm was not initialized as 0 (false) would show up as a SEGV when the -Z@ was used. Other problems that this patch fixes are not linked to a test file at the current time. This change also corrects a trivial typo and a NUL character found in src/gxtype1.c as a header file related warning in src/imain.c git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@5408 a1074d23-0009-0410-80fe-cf8c14f379e6
2003-12-04Fix : Cygwin/gcc compiler claimed possibly uninitialized variables.Igor Melichev1-4/+4
EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@4406 a1074d23-0009-0410-80fe-cf8c14f379e6
2003-09-29Fix calculation of the area where path segments can mark the current band.Alex Cherepanov1-10/+9
Old code skipped segments above the page boundary regardless of the line width. Fixes bug 686788 from customer 710. DETAILS: The area is calculated now as [y - expansion.y, y + height + expansion.y] for every band. Beware of FOR_RECTS_NO_ERROR loop silently updating y and height. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@4225 a1074d23-0009-0410-80fe-cf8c14f379e6
2002-10-07Apply casts to remove lots of warnings from MSVC 6.Russell Lang1-1/+1
Update some Windows color mapping functions for DeviceN. Change order of arguments for the gs_pdf14_device_filter_push function and the calls to the device filter push procedure to match the prototype. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@3122 a1074d23-0009-0410-80fe-cf8c14f379e6
2002-09-10The attached code release addresses a number of issues:Dan Coby1-0/+6
1. Most of the code changes are required to turn off overprint mode when processing images, smooth shading fills (shfill operator), or when using PatternType 2 (smooth shading) patterns. 2. A few other changes were required to correct improper updating of the overprint compositor information. 3. The code has been modified to avoid the crash that was observed for the file 86554321.pdf on MSWindows XP systems. 4. The command list playback code has been modified to handle filling of thin lines in a manner consistent with the noband case. This allows files such as mspro.pdf to be rendered consistently in the banded and noband case. Jan Modified Files: lib/gs_img.ps Added code to turn off overprint mode for images. lib/gs_ll3.ps Added code to turn off overprint mode for shfill. src/gscolor2.c 1. Modified gs_setcolorspace to call gs_do_set_overprint rather than invoking the color space's set_overprint routine directly. This allows pattern color spaces to be handled (somewhat more) correctly. 2. Modified gs_setcolor to update overprint information. This is necessary for pattern color spaces, where the color space to be used for overprint purposes may be part of the color. src/gscspace.c Modified gx_set_overprint_DeviceCMYK to use the effective_overprint_mode parameter in the image state (rather than the overprint_mode parameter itself). This is part of the change necessary to allow overprint mode to be turned off when a PatternType2 pattern is used as the current color. src/gsdevice.c Modified gs_set_device_no_init to call gs_do_set_overprint rather than invoking the color space's set_overprint routine directly. src/gsdps1.c Modified rectfill to use the effective_overprint_mode parameter in the imager state (rather than the overprint_mode parameter). src/gsovrc.c 1. Fixed a bug in overprint_draw_thin_line: the third and fourth operands in the call to gx_default_draw_thin_line (the y coordinate of the first point and the x-coordinate of the second) were in reverse order. This caused random lines to appear on various overprint mode tests (e.g.: BEST99-00-Path.fh7.pdf, Testform.v1.0.2.pdf). 2. Fixed typo in comment. 3. Modified the fill_in_procs procedure to initialize the device color model information for the temporary device used in this routine. Though the color model information does not affect the output of the routine, reasonable values must be provided to avoid problems when gx_device_forward_fill_in_procs calls gx_device_fill_in_procs. This would cause certain systems to crash with files that involved overprint/overprint mode (e.g.: 86554321.pdf on MSWinXP/MSVC systems). 4. Modified several checks that treated the separable_and_linear flag in the device color model information as a boolean to handle this parameter as an enumeration instead (since it is an enumeration). src/gsptype1.c Added gs_pattern1_set_color, the set_color method appropriate for PatternType 1 patterns. This method performs overprint updating at setcolor time, a requirement for patterns as the "colorspace" to be used for overprint purposes is determined (in part) by the current "color" (pattern). src/gsptype2.c Added gs_pattern2_set_color, the set_color method appropriate for PatternType 2 patterns. src/gsstate.c 1. Changed the criterion used in gs_grestore_only to determine if the overprint compositor must be updated. Restoring the graphic state may change the current color, which in the case of patterns may change the "colorspace" to be used for overprint purposes. The code now properly handles this possibility. 2. Added the gs_do_set_overprint routine, and modified various other routines that directly call the current color space's set_overprint method to call this procedure instead. The procedure implements the special handling required for pattern color spaces, where the current color may need to be considered when determining which color model components must be retained. 3. Added code to initialize the effective_overprint_mode parameter in the imager state, and provided two external routines to manipulate this parameter. The first routine, gs_disable_effective_overprint_mode, sets the effective_overprint_mode parameter to false, irrespective of the setting of the overprint_mode parameter. The second, gs_reset_effective_overprint_mode, sets the effective_overprint_mode parameter to have the same value as the overprint_mode parameter. The effective_overprint_mode parameter is used to turn off overprint_mode when a PatternType 2 pattern is being used. src/gsstate.h Added prototypes for gs_do_set_overprint, gs_disable_effective_overprint_mode, and gs_reset_effective_overprint_mode. src/gxccache.c Modified gx_image_cached_char to invoke gx_set_dev_color before calling (non-standard) device fill_mask methods. This handles several situations in which a device color is not set when a cached character is to be imaged, in particular for the command list device. src/gxclpath.c Added a comment to indicate that, though the overprint and overprint_mode parameters are passed through the command list, they usually have no effect, as overprint is controlled by the compositor information that is (also) passed through the command list. src/gxclrast.c 1. Added a comment to indicate that the overprint and overprint mode parameters passed through the command list usually have no effect. 2. Added code to initialize the effective_parameter_mode field in the imager state (though this field is usually in-effective). 3. Initialized the fill_zero_width field of the fill_params structure in clist_playback_band to have the same value as in the noband case. This parameter was previously always set to false, which led to dropped lines for some files (e.g.: mspro.pdf). src/gxistate.h Added the effective_overprint_mode parameter. src/gxpcolor.h Added a set_color method to the pattern method vector. This method performs any PatternType-specific actions necessary at setcolor time. For now, this just updates the overprint compositor as required. src/int.mak src/lib.mak Updated various dependency lists. src/zcolor.c Added code to disable overprint mode for PatternType 2 patterns. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@3020 a1074d23-0009-0410-80fe-cf8c14f379e6
2002-08-28We have traced the difficulties with multiple-band processing in the codeDan Coby1-1/+16
we released on Aug. 26 to two problems: 1. The halftone phase information is not adjusted for bands that start at locations other than the top of the page. 2. The "moveto closepath" style of degenerate path, which our code allows to be passed through the band list, is used in the path encoding code to indicate that a path lies entirely outside the current band (i.e.: all of the path operators between the initial moveto and the final closepath have been skipped because they are outside of the band). This resulted in the code passing isolated "closepath" segments through the command list, which much confused the band list renderer. The attached code release fixes both of these problems, and a couple of other more minor issues we discovered. With this change, our system has identical output for the banded and unbanded case for the pkmraw device at 300 dpi, for all but one FTS file (027-09.ps). In that one case, the banded and unbanded output are visually identical, so the output difference may not be significant. We will look into this situation, and test some of the other devices in the next day or so. As best we can tell, halftone phase adjustment has never been correctly implemented for the command list device. The pre-DeviceN code handles binary halftone colors properly, but does not set the phase for general colored halftones. General colored halftones are much more common in the DeviceN code, which probably is the reason Dan first noticed the problem with FTS file 245-07.ps (and others) with the DeviceN code. Jan Modified Files: src/gsht.c Modified the code that calculates the lcm_height field of a device halftone in gx_imager_dev_ht_install to use the full_height rather than the height of a halftone order. This typo was introduced sometime during the DeviceN development; the pre-DeviceN code was correct. src/gsptype1.c src/gsptype2.c src/gxwts.c Added the "get_phase" method to various gx_device_color_type_t instances. src/gxcht.c src/gxht.c Added the "get_phase" method to a pair of gx_device_color_type_t instances. Also modified the "write" and "read" methods of these structures to ignore halftone phase information. This information must be passed to and be directly handled by the command list writer code, so that the command list renderer code may correct it for the band starting coordinates. src/gxclpath.c 1. Modified cmd_put_drawing_color to directly handle halftone phase information, using the new "get_phase" method of device colors. The passing of this information must be perfomed at the command list level, so that the command list renderer can correct the phase for the starting point of the band. 2. Also in cmd_put_drawing_color, "unset" the saved color information if the halftone id does not match the most recently set halftone, rather than setting the saved color pointer to 0. 3. In cmd_put_path, when processing a segment containing a moveto followed by a closepath, check if the moveto was to a point outside of the current band, and discard the closepath if this is the case. This is necessary to avoid inserting isolated closepath segments into the command list. src/gxclrast.c Added code to initialize the dev_color variable to clist_playback_band to "no color". src/gxdcolor.c src/gxdcolor.h Added the "get_phase" method to the gx_device_color_type_t structure, and installed this method in various instances of the structure. Also provided the two canonical implementations of this method. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@2948 a1074d23-0009-0410-80fe-cf8c14f379e6
2002-08-26Modified files:Dan Coby1-126/+66
src/gdevdbit.c: Changed gx_default_fill_mask to use the fill_masked routine of the device color. This avoids an instance in which a possibly uninitialized halftone tile is used for drawing. It also makes the code considerably cleaner. src/gscdefs.h Re-installed the definition of extern_gs_find_compositor, which had in-advertently been lost in a recent code merge. src/gsdcolor.h Added the colors.binary.b_level field to the gx_device_color_saved structure. Also added a comment explaining why this structure is used rather than the gx_device_color structure itself. src/gsht.c This file should be identical to the version released on Aug. 22nd. We are releasing again here just to guard against this code being committed without the former change. src/gsht1.c Modified the check for "binaryness" of a device color model in gs_sethalftone_try_wts to handle cases in which not all of the depth bits are used. src/gstext.c, src/gxtext.h src/zchar.c These files are identical to the set released on Aug. 23rd (the fix for color changes in a kshow procedure). We are releasing them again here to make certain the rest of this code is not committed without the former change. src/gxacpath.c Modified gx_cpath_accum_end to set the new bbox_accurate field rather than the bbox_set field. This avoids overloading the bbox_set field in a way that can lead to inconsistent output when the setbbox operator is used with a path. src/gxcht.c src/gxht.c src/gxdcolor.c src/gxdcolor.h Modified the "write" methods for various color spaces so that their return value can indicate that the operand and last transmitted colors are the same. Also fixed various bugs uncovered when the modular device color serialization/de-serialization was first used. The changes to gxdcolor.h involve only comments. src/gxcldev.h 1. Added a saved device color (gx_device_color_saved) to the band state structure. 2. Removed the (long since unnecessary) type operand from the cmd_put_halftone procedure. 3. Commented out some now obsolete command codes. src/gxclimag.c 1. Modified clist_fill_mask to work with the new, modular drawing color serialization/de-serialization routines. 2. Rewrote cmd_put_halftone as required by the new mechanism for serializing/de-serializing device halftones. 3. Modified various invocations of cmd_put_halftone to discard the the type operand. Note: The existing code impose a requirement that image objects that used a device color (e.g.: image masks) would only be passed through the command list if that color is pure. We do not know why this limitation was necessary, and suspect it is no longer necessary, but we have left it in place for now. src/gxclist.c Added gxdcolor.h to the included file list. src/gxclpath.c 1. Rewrote cmd_put_drawing_color to use the new mechanism for serialization/de-serialization of device colors. 2. Removed the device color type information from the stroke/ fill/polyfill commands. 3. Modified cmd_put_path so that "moveto closepath" is not passed through the command list as just "moveto". src/gxclpath.h 1. Added the cmd_opv_ext_put_ht_seg, to allow device halftones to be split across multiple command buffers. Also added the macro cbuf_ht_seg_max_size, to indicate the largest halftone segment to be put in a single command buffer. 2. Commented out some now obsolete command codes. src/gxclrast.c 1. Modified the code to read device halftones and device colors to use the new serialization/de-serialization methods for these structures. 2. Modified various locations in which partial/temporary device colors are used to use the current color for the band. 3. Removed code for the various stroke/fill/polyfill commands that encode device color type as part of the command. 4. Added code to save the current color when a pure color must be set to generate a clip region using the fill procedure. 5. Modified the clip path reading code to flatten the clip path before passing it to the fill operation. This is necessary to ensure consistent results between the banded and non-banded cases (the non-banded case also flattens a clip path before passing it to the fill operation). src/gxdhtserial.c 1. Updated gx_ht_read_tf and gx_ht_read_and_install to properly use the reference count in a transfer function. 2. Fixed various other errors discovered when this code was first used. src/gxdhtserial.h Fixed typo. src/gxpath.c Initialize the new bbox_accurate field of the gx_path structure to false in gx_path_init_contents. src/gxpath2.c Modified gx_path_bbox to use the bbox_accurate rather than bbox_set field to determine if the bounding box of a path needs to be explicitly calculated. If bbox_set is true, the bounding box in the bbox field will contain the current path, but may be larger than necessary. Due to a problem in the clip/fill code, the larger bounding box may generate slightly inconsistent results. src/gzpath.h Added the bbox_accurate field to the gx_path_s structure. This field is used by the clip accumulator device, which avoids the need to overload the bbox_set field (which is also used by the setbbox operator). src/lib.mak Updated varius dependency lists. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@2934 a1074d23-0009-0410-80fe-cf8c14f379e6
2002-08-22DeviceN.Henry Stiles1-22/+40
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@2925 a1074d23-0009-0410-80fe-cf8c14f379e6
2002-06-16Removes all uses of the now-deprecated Pn macros from all remaining .cL Peter Deutsch1-4/+4
files. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@2745 a1074d23-0009-0410-80fe-cf8c14f379e6
2002-02-21Reverts to marking files with the single Id cvs tag instead of theRalph Giles1-1/+1
RCSfile and Revision pair. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@2241 a1074d23-0009-0410-80fe-cf8c14f379e6
2002-02-21Update banner to the new format common to all releases (AFPL, GPL andRay Johnston1-13/+11
Artifex Software's commercial release). References file LICENSE. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@2234 a1074d23-0009-0410-80fe-cf8c14f379e6
2001-03-13Fix: Some device color components were missed while serializing halftone to ↵Igor Melichev1-1/+1
clist, causing segment fault during playback. Changes use proper number of device color components to be written to clist and read from it. SourceForge bug #211449. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@1251 a1074d23-0009-0410-80fe-cf8c14f379e6
2000-09-19Updates the license notices to reflect the name change from AladdinL Peter Deutsch1-16/+16
Ghostscript to AFPL Ghostscript, as well as some internal references to the program name. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@729 a1074d23-0009-0410-80fe-cf8c14f379e6
2000-08-30Brings the (still mostly stubbed) transparency code to a moreL Peter Deutsch1-34/+2
self-consistent state. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@673 a1074d23-0009-0410-80fe-cf8c14f379e6
2000-08-26Completes an edit that accidentally left the repository in an inconsistentL Peter Deutsch1-4/+5
state. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@671 a1074d23-0009-0410-80fe-cf8c14f379e6
2000-08-25Partly implements opacity and shape mask bookkeeping. gsave/grestore/etc.L Peter Deutsch1-17/+47
and banding don't do the right thing yet. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@669 a1074d23-0009-0410-80fe-cf8c14f379e6
2000-08-23Starts to implement the PDF 1.4 transparency features. All API and operatorL Peter Deutsch1-123/+141
additions are now implemented (at least as stubs) and documented, as is bookkeeping for the new scalar graphics state members (but not for the soft masks or the transparency group stack). git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@658 a1074d23-0009-0410-80fe-cf8c14f379e6
2000-08-23Adds the PDF "overprint mode" to the graphics state. THE ACTUALL Peter Deutsch1-12/+24
FUNCTIONALITY IS NOT IMPLEMENTED YET. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@657 a1074d23-0009-0410-80fe-cf8c14f379e6
2000-03-28Changes a few initializations to suppress warnings from one picky compilerL Peter Deutsch1-2/+5
that doesn't like ptr = buf - 1 where buf is an array. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@206 a1074d23-0009-0410-80fe-cf8c14f379e6
2000-03-09Populate repository with gs 6.0 files.ghostscript-6.0L Peter Deutsch1-3/+15
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@2 a1074d23-0009-0410-80fe-cf8c14f379e6
2000-02-15Update to Aladdin 6.0 - Only license block formatting changed.Ray Johnston1-2/+3
git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@1089 06663e23-700e-0410-b217-a244a6096597
1999-12-12Imports Aladdin's 596.Henry Stiles1-39/+31
git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@1040 06663e23-700e-0410-b217-a244a6096597