diff options
author | Ray Johnston <ray.johnston@artifex.com> | 2011-02-26 18:40:59 +0000 |
---|---|---|
committer | Ray Johnston <ray.johnston@artifex.com> | 2011-02-26 18:40:59 +0000 |
commit | ed4cc94c234fba0330b0d768cce436df95268e7f (patch) | |
tree | 15915ddfec451ecb02859079d3438a4991368b50 | |
parent | 9ff94f45536ba17bfdc0b2ec12adfac49e8f8b5d (diff) |
Fix for PDF 1.7 fts_08_0808.pdf which can clip the corner of the really wide
diagonal (magenta) stroke when banding is used. This was due to the 'extension'
of a square line cap being incorrectly calculated. Customer 532 issue.
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@12208 a1074d23-0009-0410-80fe-cf8c14f379e6
-rw-r--r-- | gs/base/gxstroke.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gs/base/gxstroke.c b/gs/base/gxstroke.c index 8a8d19a08..bb434f20e 100644 --- a/gs/base/gxstroke.c +++ b/gs/base/gxstroke.c @@ -81,12 +81,14 @@ * expansion on each side (in user space) is * K * line_width/2 * where K is determined as follows: - * If the path is only a single line segment, K = 1; - * if triangular joins, K = 2; - * if miter joins, K = miter_limit; - * otherwise, K = 1. + * For round or butt caps, E = 1 + * For square caps, E = sqrt(2) + * If the path is only a single line segment, K = E; + * if triangular joins, K = 2; + * if miter joins, K = max(miter_limit, E); + * otherwise, K = E. * - * If the following conditions apply, K = 1 yields an exact result: + * If the following conditions apply, K = E yields an exact result: * - The CTM is of the form [X 0 0 Y] or [0 X Y 0]. * - Square or round caps are used, or all subpaths are closed. * - All segments (including the implicit segment created by @@ -109,6 +111,11 @@ gx_stroke_path_expansion(const gs_imager_state * pis, const gx_path * ppath, double expand = pis->line_params.half_width; int result = 1; + /* 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; + /* 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) |