summaryrefslogtreecommitdiff
path: root/fitz/dev_list.c
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2011-07-13 20:31:56 +0100
committerRobin Watts <robin.watts@artifex.com>2011-07-13 21:03:28 +0100
commit6913145eefde0e5c4cde9573d8d2cb2a35fd605d (patch)
treef79dc7269f4f562bdb168b572a37367e806e0190 /fitz/dev_list.c
parent2c4bbbfdc7413a68cad395c3c61ff8e62dceb18b (diff)
downloadmupdf-6913145eefde0e5c4cde9573d8d2cb2a35fd605d.tar.xz
Non-isolated group support, and fix Bug 692336.
Firstly, this takes on some of Zenikos patch to correct the clip stack handling that was broken by the fix to bug 692287 (in commit 2c3bbbf). This bug should now be solved. We add a new 'shape' field to the draw device structure (and clip stack). When we are inside non-isolated groups, this is set to be a pixmap where we accumulate the 'shape' of the objects drawn. When we come to blend back, if we are blending a non-isolated group back, we have to use a different blending function that takes account of the shape. Various internal groups (the page group, and groups used to force blending) are set to be isolated to avoid carrying shape planes around when this is not required. All our rendering code now has to know how to maintain the shape plane as well as doing the basic rendering.
Diffstat (limited to 'fitz/dev_list.c')
-rw-r--r--fitz/dev_list.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/fitz/dev_list.c b/fitz/dev_list.c
index 44528d8b..a0e8a0bc 100644
--- a/fitz/dev_list.c
+++ b/fitz/dev_list.c
@@ -111,19 +111,27 @@ fz_append_display_node(fz_display_list *list, fz_display_node *node)
case FZ_CMD_CLIP_PATH:
case FZ_CMD_CLIP_STROKE_PATH:
case FZ_CMD_CLIP_IMAGE_MASK:
- list->stack[list->top].update = &node->rect;
- list->stack[list->top].rect = fz_empty_rect;
+ if (list->top < STACK_SIZE)
+ {
+ list->stack[list->top].update = &node->rect;
+ list->stack[list->top].rect = fz_empty_rect;
+ }
list->top++;
break;
+ case FZ_CMD_END_MASK:
case FZ_CMD_CLIP_TEXT:
case FZ_CMD_CLIP_STROKE_TEXT:
- list->stack[list->top].update = NULL;
- list->stack[list->top].rect = fz_empty_rect;
+ if (list->top < STACK_SIZE)
+ {
+ list->stack[list->top].update = NULL;
+ list->stack[list->top].rect = fz_empty_rect;
+ }
list->top++;
break;
case FZ_CMD_BEGIN_TILE:
list->tiled++;
- if (list->top > 0) {
+ if ((list->top > 0) && (list->top < STACK_SIZE))
+ {
list->stack[list->top-1].rect = fz_infinite_rect;
}
break;
@@ -133,24 +141,33 @@ fz_append_display_node(fz_display_list *list, fz_display_node *node)
case FZ_CMD_END_GROUP:
break;
case FZ_CMD_POP_CLIP:
- if (list->top > 0) {
+ if (list->top > STACK_SIZE)
+ {
+ list->top--;
+ node->rect = fz_infinite_rect;
+ }
+ else
+ if (list->top > 0)
+ {
fz_rect *update;
list->top--;
update = list->stack[list->top].update;
- if (list->tiled == 0) {
- if (update != NULL) {
+ if (list->tiled == 0)
+ {
+ if (update != NULL)
+ {
*update = fz_intersect_rect(*update, list->stack[list->top].rect);
node->rect = *update;
- } else {
- node->rect = list->stack[list->top].rect;
}
- } else {
- node->rect = fz_infinite_rect;
+ else
+ node->rect = list->stack[list->top].rect;
}
+ else
+ node->rect = fz_infinite_rect;
}
/*@fallthrough@*/
default:
- if ((list->top > 0) && (list->tiled == 0)) {
+ if ((list->top > 0) && (list->tiled == 0) && (list->top <= STACK_SIZE)) {
list->stack[list->top-1].rect = fz_union_rect(list->stack[list->top-1].rect, node->rect);
}
break;