diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-02-10 17:24:00 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2012-03-15 11:54:22 +0000 |
commit | 2fa2999f83cba0d4fc6d0189a629f5fcd035383a (patch) | |
tree | 804954ae388bac7085ecd343d96f204ab66d9dc4 | |
parent | 250d47dcbdb19da0a50e223886f584deabd4423e (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 gx_device * gx_make_clip_device_on_stack_if_needed(gx_device_clip * dev, const gx_clip_path *pcpath, gx_device *target, gs_fixed_rect *rect) { + /* Reduce area if possible */ + if (rect->p.x < pcpath->outer_box.p.x) + rect->p.x = pcpath->outer_box.p.x; + if (rect->q.x > pcpath->outer_box.q.x) + rect->q.x = pcpath->outer_box.q.x; + if (rect->p.y < pcpath->outer_box.p.y) + rect->p.y = pcpath->outer_box.p.y; + if (rect->q.y > pcpath->outer_box.q.y) + rect->q.y = pcpath->outer_box.q.y; if (pcpath->inner_box.p.x <= rect->p.x && pcpath->inner_box.p.y <= rect->p.y && pcpath->inner_box.q.x >= rect->q.x && pcpath->inner_box.q.y >= rect->q.y) { @@ -147,15 +156,6 @@ gx_make_clip_device_on_stack_if_needed(gx_device_clip * dev, const gx_clip_path } else { - /* Reduce area if possible */ - if (rect->p.x < pcpath->outer_box.p.x) - rect->p.x = pcpath->outer_box.p.x; - if (rect->q.x > pcpath->outer_box.q.x) - rect->q.x = pcpath->outer_box.q.x; - if (rect->p.y < pcpath->outer_box.p.y) - rect->p.y = pcpath->outer_box.p.y; - if (rect->q.y > pcpath->outer_box.q.y) - rect->q.y = pcpath->outer_box.q.y; /* Check for area being trivially clipped away. */ if (rect->p.x >= rect->q.x || rect->p.y >= rect->q.y) return NULL; |