2014-09-05 15:50 GMT+02:00 Henri Verbeet hverbeet@codeweavers.com:
+static BOOL d2d_clip_stack_push(struct d2d_clip_stack *stack, const D2D1_RECT_F *rect) +{
- if (stack->current == stack->stack_size - 1)
- {
D2D1_RECT_F *new_stack;
unsigned int new_size;
if (stack->stack_size > UINT_MAX / 2)
return FALSE;
new_size = stack->stack_size * 2;
if (!(new_stack = HeapReAlloc(GetProcessHeap(), 0, stack->stack, new_size * sizeof(*stack->stack))))
return FALSE;
stack->stack = new_stack;
stack->stack_size = new_size;
- }
- stack->stack[stack->current++] = *rect;
- d2d_rect_intersect(&stack->clip_rect, rect);
- return TRUE;
+}
+static void d2d_clip_stack_pop(struct d2d_clip_stack *stack, unsigned int w, unsigned int h) +{
- unsigned int i;
- if (!stack->current)
return;
- --stack->current;
- stack->clip_rect.left = 0.0f;
- stack->clip_rect.top = 0.0f;
- stack->clip_rect.right = w;
- stack->clip_rect.bottom = h;
- for (i = 0; i < stack->current; ++i)
- {
d2d_rect_intersect(&stack->clip_rect, &stack->stack[i]);
- }
+}
Would it be possible to store the clipped rectangles in the stack instead (so that stack->clip_rect == stack->stack[stack->current] at any given moment)? That way you don't need to recompute clip_rect on each pop.
On 5 September 2014 21:40, Matteo Bruni matteo.mystral@gmail.com wrote:
Would it be possible to store the clipped rectangles in the stack instead (so that stack->clip_rect == stack->stack[stack->current] at any given moment)? That way you don't need to recompute clip_rect on each pop.
I think you're right, since the application can't observe individual clip rects, only the combined stack.