[cairo-commit] 4 commits - src/cairo-composite-rectangles.c src/cairo-recording-surface.c src/cairo-script-surface.c src/cairo-surface-wrapper.c util/cairo-script util/cairo-trace
Chris Wilson
ickle at kemper.freedesktop.org
Wed Aug 10 06:06:40 PDT 2011
src/cairo-composite-rectangles.c | 2 -
src/cairo-recording-surface.c | 2 +
src/cairo-script-surface.c | 3 +-
src/cairo-surface-wrapper.c | 7 +++-
util/cairo-script/cairo-script-operators.c | 42 +++++++++++++++++++++++++++++
util/cairo-trace/trace.c | 4 +-
6 files changed, 54 insertions(+), 6 deletions(-)
New commits:
commit deb88cca133b4f6ae89061662c06bca0c0573d0e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Aug 10 14:03:10 2011 +0100
recording: do not reduce required clips
When painting with an unbound source, we would miss that the clip
extents were smaller than the mask extents and remove the solitary clip
(believing we were bound by a tight mask). For painting this is
obviously wrong, and due to a combination of bugs that set the mask to
the bound extents and then the failure to spot when that mask was larger
than the clip.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-composite-rectangles.c b/src/cairo-composite-rectangles.c
index 0598ba6..439f453 100644
--- a/src/cairo-composite-rectangles.c
+++ b/src/cairo-composite-rectangles.c
@@ -90,7 +90,7 @@ _cairo_composite_rectangles_init_for_paint (cairo_composite_rectangles_t *extent
return CAIRO_INT_STATUS_NOTHING_TO_DO;
}
- extents->mask = extents->bounded;
+ extents->mask = *unbounded;
extents->clip = _cairo_clip_reduce_for_composite (clip, extents);
if (_cairo_clip_is_all_clipped (extents->clip))
diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index 478695f..987395b 100644
--- a/src/cairo-recording-surface.c
+++ b/src/cairo-recording-surface.c
@@ -587,6 +587,8 @@ _command_init (cairo_recording_surface_t *surface,
/* steal the clip */
command->clip = NULL;
if (! _cairo_clip_is_region (composite->clip) ||
+ composite->mask.width > composite->unbounded.width ||
+ composite->mask.height > composite->unbounded.height ||
cairo_region_contains_rectangle (_cairo_clip_get_region (composite->clip),
&composite->unbounded) != CAIRO_REGION_OVERLAP_IN)
{
commit 69c1ec9f131936ca5fcdb48bd0f957b2c1f6d52c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Aug 10 13:22:58 2011 +0100
script: Compile fix
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c
index e61b8a4..0f7252a 100644
--- a/src/cairo-script-surface.c
+++ b/src/cairo-script-surface.c
@@ -50,6 +50,7 @@
#include "cairo-default-context-private.h"
#include "cairo-device-private.h"
#include "cairo-error-private.h"
+#include "cairo-image-surface-private.h"
#include "cairo-list-private.h"
#include "cairo-recording-surface-private.h"
#include "cairo-output-stream-private.h"
@@ -2119,7 +2120,7 @@ _cairo_script_surface_clipper_intersect_clip_path (cairo_surface_clipper_t *clip
}
/* skip the trivial clip covering the surface extents */
- if (surface->width >=0 && surface->height >= 0 &&
+ if (surface->width >= 0 && surface->height >= 0 &&
_cairo_path_fixed_is_box (path, &box))
{
if (box.p1.x <= 0 && box.p1.y <= 0 &&
diff --git a/src/cairo-surface-wrapper.c b/src/cairo-surface-wrapper.c
index 9ed5620..0ce80a5 100644
--- a/src/cairo-surface-wrapper.c
+++ b/src/cairo-surface-wrapper.c
@@ -591,8 +591,11 @@ _cairo_surface_wrapper_init (cairo_surface_wrapper_t *wrapper,
wrapper->has_extents = FALSE;
wrapper->extents.x = wrapper->extents.y = 0;
- wrapper->needs_transform =
- ! _cairo_matrix_is_identity (&wrapper->target->device_transform);
+ wrapper->needs_transform = FALSE;
+ if (target) {
+ wrapper->needs_transform =
+ ! _cairo_matrix_is_identity (&target->device_transform);
+ }
}
void
commit b13266ba0fcd275a5936f31f69405b7e25853ef6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Aug 10 12:50:04 2011 +0100
script: Include an operator to replay a recording surface to a file
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/util/cairo-script/cairo-script-operators.c b/util/cairo-script/cairo-script-operators.c
index 9f9c547..5904f5a 100644
--- a/util/cairo-script/cairo-script-operators.c
+++ b/util/cairo-script/cairo-script-operators.c
@@ -36,6 +36,10 @@
#include "cairo-script-private.h"
+#if CAIRO_HAS_SCRIPT_SURFACE
+#include "cairo-script.h"
+#endif
+
#include <stdio.h> /* snprintf */
#include <stdlib.h> /* mkstemp */
#include <string.h>
@@ -6203,6 +6207,43 @@ _write_to_png (csi_t *ctx)
}
static csi_status_t
+_write_to_script (csi_t *ctx)
+{
+ csi_status_t status;
+ csi_string_t *filename;
+ cairo_surface_t *record;
+
+ check (2);
+
+ status = _csi_ostack_get_string (ctx, 0, &filename);
+ if (_csi_unlikely (status))
+ return status;
+ status = _csi_ostack_get_surface (ctx, 1, &record);
+ if (_csi_unlikely (status))
+ return status;
+
+ if (cairo_surface_get_type (record) != CAIRO_SURFACE_TYPE_RECORDING)
+ return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
+
+#if CAIRO_HAS_SCRIPT_SURFACE
+ {
+ cairo_device_t *script;
+
+ script = cairo_script_create (filename->string);
+ status = cairo_script_from_recording_surface (script, record);
+ cairo_device_destroy (script);
+ if (_csi_unlikely (status))
+ return status;
+ }
+#else
+ return CAIRO_STATUS_WRITE_ERROR;
+#endif
+
+ pop (1);
+ return CSI_STATUS_SUCCESS;
+}
+
+static csi_status_t
_xor (csi_t *ctx)
{
csi_object_t *a, *b;
@@ -6501,6 +6542,7 @@ _defs[] = {
{ "user-to-device-distance", NULL },
{ "where", NULL },
{ "write-to-png", _write_to_png },
+ { "write-to-script", _write_to_script },
{ "xor", _xor },
{ "=", _debug_print },
commit 40fa6c867cf371bad4a169abe9a4cea74c431680
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Aug 10 12:43:49 2011 +0100
trace: Pop the surface after write-to-png
It is convenient if the user can simply enable the use of the commented
write-to-png operation just by removing the preceding '%'. However, to
do so we need to make sure that the line is stack-neutral and so need to
pop the surface that we place onto the stack after writing the png.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index d9e7704..614783c 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -3824,7 +3824,7 @@ cairo_surface_write_to_png (cairo_surface_t *surface, const char *filename)
if (surface != NULL && _write_lock ()) {
_trace_printf ("%% s%ld ", _get_surface_id (surface));
_emit_string_literal (filename, -1);
- _trace_printf (" write-to-png\n");
+ _trace_printf (" write-to-png pop\n");
_write_unlock ();
}
ret = DLCALL (cairo_surface_write_to_png, surface, filename);
@@ -3850,7 +3850,7 @@ cairo_surface_write_to_png_stream (cairo_surface_t *surface,
symbol[0] = '\0';
#endif
_emit_string_literal (symbol, -1);
- _trace_printf (" write-to-png-stream\n");
+ _trace_printf (" write-to-png-stream pop\n");
_write_unlock ();
}
ret = DLCALL (cairo_surface_write_to_png_stream,
More information about the cairo-commit
mailing list