diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-08-22 15:24:21 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-08-22 15:24:21 +0100 |
commit | e89eba9a172c93b45dbac093830b18ed5ac561a2 (patch) | |
tree | 3c9e3c460f0a5f6583a4d71722bf404cf078c91a | |
parent | 372f8a003cdaeacb14095330d56408f0a7681195 (diff) |
Check trim timeout on context creation
Some applications, like poppler-blitz, use a single surface for the
entire run and so never trigger the timeout in surface_create(). So move
the check to context_create(), as contexts are meant to be transient!
-rw-r--r-- | csi-trace.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/csi-trace.c b/csi-trace.c index f3474bf..abc70ce 100644 --- a/csi-trace.c +++ b/csi-trace.c @@ -28,9 +28,6 @@ _script_surface_create (void *closure, cairo_surface_t *surface, *image; cairo_rectangle_t extents; - if (timeout && time (NULL) > timeout) - longjmp (jmp, 1); - /* use a image target so that we can use this surface as a source */ image = cairo_image_surface_create (format_from_content (content), ceil (width), ceil (height)); @@ -40,6 +37,16 @@ _script_surface_create (void *closure, return surface; } +static cairo_t * +_script_context_create (void *closure, + cairo_surface_t *surface) +{ + if (timeout && time (NULL) > timeout) + longjmp (jmp, 1); + + return cairo_create (surface); +} + static cairo_status_t write (void *closure, const unsigned char *data, unsigned int length) { @@ -55,6 +62,7 @@ main (int argc, char **argv) const cairo_script_interpreter_hooks_t hooks = { .closure = cairo_script_context_create_for_stream (write, stdout), .surface_create = _script_surface_create, + .context_create = _script_context_create, }; cairo_script_interpreter_t *csi; int i; |