trace: Wrap cairo_surface_create_for_region()

This commit is contained in:
Chris Wilson 2010-04-28 09:54:37 +01:00
parent 80fc2a8e49
commit 0f0d349a40
2 changed files with 69 additions and 0 deletions

View file

@ -5273,6 +5273,38 @@ _similar (csi_t *ctx)
return push (&obj);
}
static csi_status_t
_subsurface (csi_t *ctx)
{
csi_object_t obj;
long x, y, width, height;
cairo_surface_t *target;
csi_status_t status;
check (5);
status = _csi_ostack_get_integer (ctx, 0, &height);
if (_csi_unlikely (status))
return status;
status = _csi_ostack_get_integer (ctx, 1, &width);
if (_csi_unlikely (status))
return status;
status = _csi_ostack_get_integer (ctx, 2, &y);
if (_csi_unlikely (status))
return status;
status = _csi_ostack_get_integer (ctx, 3, &x);
if (_csi_unlikely (status))
return status;
status = _csi_ostack_get_surface (ctx, 4, &target);
if (_csi_unlikely (status))
return status;
obj.type = CSI_OBJECT_TYPE_SURFACE;
obj.datum.surface = cairo_surface_create_for_region (target, x, y, width, height);
pop (5);
return push (&obj);
}
static csi_status_t
_show_text (csi_t *ctx)
{
@ -6051,6 +6083,7 @@ _defs[] = {
{ "sin", NULL },
{ "sqrt", NULL },
{ "sub", _sub },
{ "subsurface", _subsurface },
{ "surface", _surface },
{ "string", NULL },
{ "stroke", _stroke },

View file

@ -3494,6 +3494,42 @@ cairo_surface_create_similar (cairo_surface_t *other,
return ret;
}
cairo_surface_t *
cairo_surface_create_for_region (cairo_surface_t *target,
int x, int y,
int width, int height)
{
cairo_surface_t *ret;
long surface_id;
_enter_trace ();
ret = DLCALL (cairo_surface_create_for_region, target, x, y, width, height);
surface_id = _create_surface_id (ret);
_emit_line_info ();
if (target != NULL && _write_lock ()) {
Object *obj;
obj = _get_object (SURFACE, target);
if (obj->defined)
_trace_printf ("s%ld ", obj->token);
else if (current_stack_depth == obj->operand + 1)
_trace_printf ("dup ");
else
_trace_printf ("%d index ", current_stack_depth - obj->operand - 1);
_trace_printf ("%d %d %d %d subsurface %% s%ld\n",
x, y, width, height,
surface_id);
_push_operand (SURFACE, ret);
_write_unlock ();
}
_exit_trace ();
return ret;
}
static void CAIRO_PRINTF_FORMAT(2, 3)
_emit_surface_op (cairo_surface_t *surface, const char *fmt, ...)
{