diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-02-10 17:24:00 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-02-10 17:24:00 +0000 |
commit | a13600f1c241c3e36dbe4973e9d78a8934b16004 (patch) | |
tree | 804954ae388bac7085ecd343d96f204ab66d9dc4 | |
parent | cf37ea5d017193c76341aafd60e35d3b1826046f (diff) |
Further clipping optimisations.
When clipping the region to be used for an image plot, reduce the
rectangle by the outer box of the clipping path before checking to
see if a clip is needed or not.
This enables us to avoid a clipping device in more cases.
-rw-r--r-- | gs/base/gxclip.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gs/base/gxclip.c b/gs/base/gxclip.c index 4504d9f26..38365011f 100644 --- a/gs/base/gxclip.c +++ b/gs/base/gxclip.c | |||
@@ -139,6 +139,15 @@ gx_make_clip_device_on_stack(gx_device_clip * dev, const gx_clip_path *pcpath, g | |||
139 | gx_device * | 139 | gx_device * |
140 | gx_make_clip_device_on_stack_if_needed(gx_device_clip * dev, const gx_clip_path *pcpath, gx_device *target, gs_fixed_rect *rect) | 140 | gx_make_clip_device_on_stack_if_needed(gx_device_clip * dev, const gx_clip_path *pcpath, gx_device *target, gs_fixed_rect *rect) |
141 | { | 141 | { |
142 | /* Reduce area if possible */ | ||
143 | if (rect->p.x < pcpath->outer_box.p.x) | ||
144 | rect->p.x = pcpath->outer_box.p.x; | ||
145 | if (rect->q.x > pcpath->outer_box.q.x) | ||
146 | rect->q.x = pcpath->outer_box.q.x; | ||
147 | if (rect->p.y < pcpath->outer_box.p.y) | ||
148 | rect->p.y = pcpath->outer_box.p.y; | ||
149 | if (rect->q.y > pcpath->outer_box.q.y) | ||
150 | rect->q.y = pcpath->outer_box.q.y; | ||
142 | if (pcpath->inner_box.p.x <= rect->p.x && pcpath->inner_box.p.y <= rect->p.y && | 151 | if (pcpath->inner_box.p.x <= rect->p.x && pcpath->inner_box.p.y <= rect->p.y && |
143 | pcpath->inner_box.q.x >= rect->q.x && pcpath->inner_box.q.y >= rect->q.y) | 152 | pcpath->inner_box.q.x >= rect->q.x && pcpath->inner_box.q.y >= rect->q.y) |
144 | { | 153 | { |
@@ -147,15 +156,6 @@ gx_make_clip_device_on_stack_if_needed(gx_device_clip * dev, const gx_clip_path | |||
147 | } | 156 | } |
148 | else | 157 | else |
149 | { | 158 | { |
150 | /* Reduce area if possible */ | ||
151 | if (rect->p.x < pcpath->outer_box.p.x) | ||
152 | rect->p.x = pcpath->outer_box.p.x; | ||
153 | if (rect->q.x > pcpath->outer_box.q.x) | ||
154 | rect->q.x = pcpath->outer_box.q.x; | ||
155 | if (rect->p.y < pcpath->outer_box.p.y) | ||
156 | rect->p.y = pcpath->outer_box.p.y; | ||
157 | if (rect->q.y > pcpath->outer_box.q.y) | ||
158 | rect->q.y = pcpath->outer_box.q.y; | ||
159 | /* Check for area being trivially clipped away. */ | 159 | /* Check for area being trivially clipped away. */ |
160 | if (rect->p.x >= rect->q.x || rect->p.y >= rect->q.y) | 160 | if (rect->p.x >= rect->q.x || rect->p.y >= rect->q.y) |
161 | return NULL; | 161 | return NULL; |