summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhk57.kim <hk57.kim@samsung.com>2016-06-30 15:54:38 +0900
committerjerry kim <hk57.kim@samsung.com>2016-06-29 23:55:35 -0700
commit0943bf528f223f9ccf2fcb15c87053f694052bfc (patch)
treef3dbf4320cacc505c00345d57bb001451dd03e47
parentc279cf141e79f15eccd5ff386cf008c8cba8fb64 (diff)
downloadcairo-0943bf528f223f9ccf2fcb15c87053f694052bfc.tar.gz
cairo-0943bf528f223f9ccf2fcb15c87053f694052bfc.tar.bz2
cairo-0943bf528f223f9ccf2fcb15c87053f694052bfc.zip
By default T-trace is disabled in the build. Use --enable-ttrace=yes for enabling the same. Change-Id: I697c0a3f05bc9010620db563a4121c2ed0e46599 Signed-off-by: hk57.kim <hk57.kim@samsung.com>
-rw-r--r--boilerplate/Makefile.win32.features9
-rw-r--r--build/Makefile.win32.features1
-rw-r--r--build/Makefile.win32.features-h3
-rw-r--r--build/configure.ac.features1
-rw-r--r--configure.ac16
-rw-r--r--packaging/cairo.spec2
-rw-r--r--src/Makefile.win32.features9
-rw-r--r--src/cairo-compositor.c77
-rw-r--r--src/cairo-default-context.c50
-rw-r--r--src/cairo-device.c16
-rw-r--r--src/cairo-egl-context.c53
-rw-r--r--src/cairo-gl-composite.c43
-rw-r--r--src/cairo-gl-device.c118
-rw-r--r--src/cairo-gl-msaa-compositor.c112
-rw-r--r--src/cairo-gl-surface.c246
-rw-r--r--src/cairo-gstate.c96
-rw-r--r--src/cairo-image-surface.c104
-rw-r--r--src/cairo-png.c23
-rw-r--r--src/cairo-region.c23
-rw-r--r--src/cairo-surface.c384
-rw-r--r--src/cairo-traps-compositor.c35
-rw-r--r--src/cairo-ttrace.h47
-rw-r--r--src/cairo.c272
23 files changed, 1385 insertions, 355 deletions
diff --git a/boilerplate/Makefile.win32.features b/boilerplate/Makefile.win32.features
index 6087bff50..c93b3b8ee 100644
--- a/boilerplate/Makefile.win32.features
+++ b/boilerplate/Makefile.win32.features
@@ -540,6 +540,15 @@ enabled_cairo_boilerplate_cxx_sources += $(cairo_boilerplate_trace_cxx_sources)
enabled_cairo_boilerplate_sources += $(cairo_boilerplate_trace_sources)
endif
+all_cairo_boilerplate_private += $(cairo_boilerplate_ttrace_private) $(cairo_boilerplate_ttrace_headers)
+all_cairo_boilerplate_cxx_sources += $(cairo_boilerplate_ttrace_cxx_sources)
+all_cairo_boilerplate_sources += $(cairo_boilerplate_ttrace_sources)
+ifeq ($(CAIRO_HAS_TTRACE),1)
+enabled_cairo_boilerplate_private += $(cairo_boilerplate_ttrace_private) $(cairo_boilerplate_ttrace_headers)
+enabled_cairo_boilerplate_cxx_sources += $(cairo_boilerplate_ttrace_cxx_sources)
+enabled_cairo_boilerplate_sources += $(cairo_boilerplate_ttrace_sources)
+endif
+
all_cairo_boilerplate_private += $(cairo_boilerplate_interpreter_private) $(cairo_boilerplate_interpreter_headers)
all_cairo_boilerplate_cxx_sources += $(cairo_boilerplate_interpreter_cxx_sources)
all_cairo_boilerplate_sources += $(cairo_boilerplate_interpreter_sources)
diff --git a/build/Makefile.win32.features b/build/Makefile.win32.features
index 5a5848da6..be59490b7 100644
--- a/build/Makefile.win32.features
+++ b/build/Makefile.win32.features
@@ -40,5 +40,6 @@ CAIRO_HAS_XML_SURFACE=0
CAIRO_HAS_PTHREAD=0
CAIRO_HAS_GOBJECT_FUNCTIONS=0
CAIRO_HAS_TRACE=0
+CAIRO_HAS_TTRACE=0
CAIRO_HAS_INTERPRETER=1
CAIRO_HAS_SYMBOL_LOOKUP=0
diff --git a/build/Makefile.win32.features-h b/build/Makefile.win32.features-h
index 6c0e91f8f..ed33c7c4c 100644
--- a/build/Makefile.win32.features-h
+++ b/build/Makefile.win32.features-h
@@ -130,6 +130,9 @@ endif
ifeq ($(CAIRO_HAS_TRACE),1)
@echo "#define CAIRO_HAS_TRACE 1" >> $(top_srcdir)/src/cairo-features.h
endif
+ifeq ($(CAIRO_HAS_TTRACE),1)
+ @echo "#define CAIRO_HAS_TTRACE 1" >> $(top_srcdir)/src/cairo-features.h
+endif
ifeq ($(CAIRO_HAS_INTERPRETER),1)
@echo "#define CAIRO_HAS_INTERPRETER 1" >> $(top_srcdir)/src/cairo-features.h
endif
diff --git a/build/configure.ac.features b/build/configure.ac.features
index adb840fd8..baac63ebe 100644
--- a/build/configure.ac.features
+++ b/build/configure.ac.features
@@ -410,6 +410,7 @@ AC_DEFUN([CAIRO_REPORT],
echo ""
echo "The following features and utilities:"
echo " cairo-trace: $use_trace"
+ echo " cairo-ttrace: $use_ttrace"
echo " cairo-script-interpreter: $use_interpreter"
echo ""
echo "And the following internal features:"
diff --git a/configure.ac b/configure.ac
index 0d85c2fc1..ef5725fb2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,16 @@ AC_CHECK_LIB(z, compress,
[have_libz="no (requires zlib http://www.gzip.org/zlib/)"])],
[have_libz="no (requires zlib http://www.gzip.org/zlib/)"])
+AC_CHECK_LIB(ttrace, traceBegin,
+ [AC_CHECK_HEADER(ttrace.h, [
+ have_ttrace=yes
+ AC_DEFINE(HAVE_TTRACE, 1, [Define to 1 if you have ttrace available])
+ ttrace_LIBS="-lttrace"
+ ],
+ [have_ttrace="no (requires ttrace)"])],
+ [have_ttrace="no (requires ttraec)"])
+LIBS="$ttrace_LIBS $LIBS"
+
AC_CHECK_LIB(wayland-client, wl_display_connect,
[AC_CHECK_HEADER(wayland-client.h, [
have_wayland=yes
@@ -843,6 +853,12 @@ CAIRO_ENABLE(trace, cairo-trace, auto, [
fi
])
+CAIRO_ENABLE(ttrace, cairo-ttrace, no, [
+ if test "x$have_ttrace" != "xyes"; then
+ use_ttrace="no (requires ttrace)"
+ fi
+])
+
CAIRO_ENABLE(interpreter, cairo-script-interpreter, yes, [
if test "x$have_libz" != "xyes"; then
use_interpreter="no (requires zlib)"
diff --git a/packaging/cairo.spec b/packaging/cairo.spec
index 3d6bc60b0..51c24f797 100644
--- a/packaging/cairo.spec
+++ b/packaging/cairo.spec
@@ -27,6 +27,7 @@ BuildRequires: pkgconfig(pixman-1)
BuildRequires: which
BuildRequires: pkgconfig(ecore)
BuildRequires: pkgconfig(evas)
+BuildRequires: pkgconfig(ttrace)
%if %{with cairo_gl_backend}
%if %{with x} && %{with desktop}
BuildRequires: pkgconfig(gl)
@@ -142,6 +143,7 @@ NOCONFIGURE=1 ./autogen.sh
--enable-script=yes \
--enable-svg=yes \
--enable-tee=no \
+ --enable-ttrace=no \
%if %{with wayland} && !%{with x}
--disable-xlib \
--disable-xcb \
diff --git a/src/Makefile.win32.features b/src/Makefile.win32.features
index fe7627c9c..5f08272cd 100644
--- a/src/Makefile.win32.features
+++ b/src/Makefile.win32.features
@@ -690,6 +690,15 @@ enabled_cairo_cxx_sources += $(cairo_trace_cxx_sources)
enabled_cairo_sources += $(cairo_trace_sources)
endif
+all_cairo_private += $(cairo_ttrace_private) $(cairo_ttrace_headers)
+all_cairo_cxx_sources += $(cairo_ttrace_cxx_sources)
+all_cairo_sources += $(cairo_ttrace_sources)
+ifeq ($(CAIRO_HAS_TTRACE),1)
+enabled_cairo_private += $(cairo_ttrace_private) $(cairo_ttrace_headers)
+enabled_cairo_cxx_sources += $(cairo_ttrace_cxx_sources)
+enabled_cairo_sources += $(cairo_ttrace_sources)
+endif
+
all_cairo_private += $(cairo_interpreter_private) $(cairo_interpreter_headers)
all_cairo_cxx_sources += $(cairo_interpreter_cxx_sources)
all_cairo_sources += $(cairo_interpreter_sources)
diff --git a/src/cairo-compositor.c b/src/cairo-compositor.c
index 0c4d34cc0..32ca8d88a 100644
--- a/src/cairo-compositor.c
+++ b/src/cairo-compositor.c
@@ -40,6 +40,7 @@
#include "cairo-compositor-private.h"
#include "cairo-damage-private.h"
#include "cairo-error-private.h"
+#include "cairo-ttrace.h"
cairo_int_status_t
_cairo_compositor_paint (const cairo_compositor_t *compositor,
@@ -48,6 +49,7 @@ _cairo_compositor_paint (const cairo_compositor_t *compositor,
const cairo_pattern_t *source,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_composite_rectangles_t extents;
cairo_int_status_t status;
cairo_bool_t initialized = TRUE;
@@ -66,8 +68,10 @@ _cairo_compositor_paint (const cairo_compositor_t *compositor,
surface,
op, source,
clip);
- if (unlikely (status))
- return status;
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
do {
while (compositor->paint == NULL)
@@ -82,8 +86,10 @@ _cairo_compositor_paint (const cairo_compositor_t *compositor,
clip);
initialized = TRUE;
- if (unlikely (status))
- return status;
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
}
status = compositor->paint (compositor, &extents);
@@ -102,6 +108,7 @@ _cairo_compositor_paint (const cairo_compositor_t *compositor,
_cairo_composite_rectangles_fini (&extents);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -113,6 +120,7 @@ _cairo_compositor_mask (const cairo_compositor_t *compositor,
const cairo_pattern_t *mask,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_composite_rectangles_t extents;
cairo_int_status_t status;
cairo_bool_t initialized = TRUE;
@@ -130,8 +138,10 @@ _cairo_compositor_mask (const cairo_compositor_t *compositor,
surface,
op, source,
mask, clip);
- if (unlikely (status))
- return status;
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
do {
while (compositor->mask == NULL)
@@ -146,8 +156,10 @@ _cairo_compositor_mask (const cairo_compositor_t *compositor,
mask, clip);
initialized = TRUE;
- if (unlikely (status))
- return status;
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
}
status = compositor->mask (compositor, &extents);
@@ -166,6 +178,7 @@ _cairo_compositor_mask (const cairo_compositor_t *compositor,
_cairo_composite_rectangles_fini (&extents);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -182,14 +195,17 @@ _cairo_compositor_stroke (const cairo_compositor_t *compositor,
cairo_antialias_t antialias,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_composite_rectangles_t extents;
cairo_int_status_t status;
cairo_bool_t initialized = TRUE;
TRACE ((stderr, "%s\n", __FUNCTION__));
- if (_cairo_pen_vertices_needed (tolerance, style->line_width/2, ctm) <= 1)
- return CAIRO_INT_STATUS_NOTHING_TO_DO;
+ if (_cairo_pen_vertices_needed (tolerance, style->line_width/2, ctm) <= 1) {
+ CAIRO_TRACE_END (__func__);
+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
+ }
if (compositor->lazy_init) {
status = _cairo_composite_rectangles_lazy_init_for_stroke (&extents,
@@ -205,8 +221,10 @@ _cairo_compositor_stroke (const cairo_compositor_t *compositor,
op, source,
path, style,
ctm, clip);
- if (unlikely (status))
- return status;
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
do {
while (compositor->stroke == NULL)
@@ -225,8 +243,10 @@ _cairo_compositor_stroke (const cairo_compositor_t *compositor,
clip);
initialized = TRUE;
- if (unlikely (status))
- return status;
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
}
status = compositor->stroke (compositor, &extents,
@@ -247,6 +267,7 @@ _cairo_compositor_stroke (const cairo_compositor_t *compositor,
_cairo_composite_rectangles_fini (&extents);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -261,6 +282,7 @@ _cairo_compositor_fill (const cairo_compositor_t *compositor,
cairo_antialias_t antialias,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_composite_rectangles_t extents;
cairo_int_status_t status;
cairo_bool_t initialized = TRUE;
@@ -279,8 +301,10 @@ _cairo_compositor_fill (const cairo_compositor_t *compositor,
surface,
op, source,
path, clip);
- if (unlikely (status))
- return status;
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
do {
while (compositor->fill == NULL)
@@ -295,8 +319,10 @@ _cairo_compositor_fill (const cairo_compositor_t *compositor,
path, clip);
initialized = TRUE;
- if (unlikely (status))
- return status;
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
}
status = compositor->fill (compositor, &extents,
@@ -316,6 +342,7 @@ _cairo_compositor_fill (const cairo_compositor_t *compositor,
_cairo_composite_rectangles_fini (&extents);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -329,6 +356,7 @@ _cairo_compositor_glyphs (const cairo_compositor_t *compositor,
cairo_scaled_font_t *scaled_font,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_composite_rectangles_t extents;
cairo_bool_t overlap;
cairo_int_status_t status;
@@ -349,8 +377,10 @@ _cairo_compositor_glyphs (const cairo_compositor_t *compositor,
scaled_font,
glyphs, num_glyphs,
clip, &overlap);
- if (unlikely (status))
- return status;
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
do {
while (compositor->glyphs == NULL)
@@ -366,8 +396,10 @@ _cairo_compositor_glyphs (const cairo_compositor_t *compositor,
clip, &overlap);
initialized = TRUE;
- if (unlikely (status))
- return status;
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
}
status = compositor->glyphs (compositor, &extents,
@@ -387,5 +419,6 @@ _cairo_compositor_glyphs (const cairo_compositor_t *compositor,
_cairo_composite_rectangles_fini (&extents);
+ CAIRO_TRACE_END (__func__);
return status;
}
diff --git a/src/cairo-default-context.c b/src/cairo-default-context.c
index 4b63d53be..26644eaf5 100644
--- a/src/cairo-default-context.c
+++ b/src/cairo-default-context.c
@@ -49,6 +49,7 @@
#include "cairo-freed-pool-private.h"
#include "cairo-path-private.h"
#include "cairo-pattern-private.h"
+#include "cairo-ttrace.h"
#define CAIRO_TOLERANCE_MINIMUM _cairo_fixed_to_double(1)
@@ -88,6 +89,7 @@ _cairo_default_context_fini (cairo_default_context_t *cr)
static void
_cairo_default_context_destroy (void *abstract_cr)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_default_context_t *cr = abstract_cr;
_cairo_default_context_fini (cr);
@@ -95,6 +97,7 @@ _cairo_default_context_destroy (void *abstract_cr)
/* mark the context as invalid to protect against misuse */
cr->base.status = CAIRO_STATUS_NULL_POINTER;
_freed_pool_put (&context_pool, cr);
+ CAIRO_TRACE_END (__func__);
}
static cairo_surface_t *
@@ -288,24 +291,32 @@ _current_source_matches_solid (const cairo_pattern_t *pattern,
static cairo_status_t
_cairo_default_context_set_source_rgba (void *abstract_cr, double red, double green, double blue, double alpha)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_default_context_t *cr = abstract_cr;
cairo_pattern_t *pattern;
cairo_status_t status;
if (_current_source_matches_solid (cr->gstate->source,
- red, green, blue, alpha))
- return CAIRO_STATUS_SUCCESS;
+ red, green, blue, alpha)) {
+ CAIRO_TRACE_END (__func__);
+ return CAIRO_STATUS_SUCCESS;
+ }
/* push the current pattern to the freed lists */
_cairo_default_context_set_source (cr, (cairo_pattern_t *) &_cairo_pattern_black);
pattern = cairo_pattern_create_rgba (red, green, blue, alpha);
- if (unlikely (pattern->status))
- return pattern->status;
+ if (unlikely (pattern->status)) {
+ status = pattern->status;
+ cairo_pattern_destroy (pattern);
+ CAIRO_TRACE_END (__func__);
+ return pattern->status;
+ }
status = _cairo_default_context_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -324,8 +335,11 @@ _cairo_default_context_set_source_surface (void *abstract_cr,
_cairo_default_context_set_source (cr, (cairo_pattern_t *) &_cairo_pattern_black);
pattern = cairo_pattern_create_for_surface (surface);
- if (unlikely (pattern->status))
- return pattern->status;
+ if (unlikely (pattern->status)) {
+ status = pattern->status;
+ cairo_pattern_destroy (pattern);
+ return status;
+ }
cairo_matrix_init_translate (&matrix, -x, -y);
cairo_pattern_set_matrix (pattern, &matrix);
@@ -1122,9 +1136,12 @@ _cairo_default_context_append_path (void *abstract_cr,
static cairo_status_t
_cairo_default_context_paint (void *abstract_cr)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_default_context_t *cr = abstract_cr;
- return _cairo_gstate_paint (cr->gstate);
+ cairo_status_t status = _cairo_gstate_paint (cr->gstate);
+ CAIRO_TRACE_END (__func__);
+ return status;
}
static cairo_status_t
@@ -1220,7 +1237,7 @@ _cairo_default_context_fill (void *abstract_cr)
{
cairo_default_context_t *cr = abstract_cr;
cairo_status_t status;
-
+
status = _cairo_gstate_fill (cr->gstate, cr->path);
if (unlikely (status))
return status;
@@ -1695,21 +1712,26 @@ _cairo_default_context_init (cairo_default_context_t *cr, void *target)
cairo_t *
_cairo_default_context_create (void *target)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_default_context_t *cr;
cairo_status_t status;
cr = _freed_pool_get (&context_pool);
if (unlikely (cr == NULL)) {
- cr = malloc (sizeof (cairo_default_context_t));
- if (unlikely (cr == NULL))
- return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
- }
+ cr = malloc (sizeof (cairo_default_context_t));
+ if (unlikely (cr == NULL)) {
+ CAIRO_TRACE_END (__func__);
+ return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
+ }
+ }
status = _cairo_default_context_init (cr, target);
if (unlikely (status)) {
- _freed_pool_put (&context_pool, cr);
- return _cairo_create_in_error (status);
+ _freed_pool_put (&context_pool, cr);
+ CAIRO_TRACE_END (__func__);
+ return _cairo_create_in_error (status);
}
+ CAIRO_TRACE_END (__func__);
return &cr->base;
}
diff --git a/src/cairo-device.c b/src/cairo-device.c
index b4d1f8422..d8586509c 100644
--- a/src/cairo-device.c
+++ b/src/cairo-device.c
@@ -37,6 +37,7 @@
#include "cairo-device-private.h"
#include "cairo-error-private.h"
#include "cairo-list-inline.h"
+#include "cairo-ttrace.h"
/**
* SECTION:cairo-device
@@ -170,6 +171,7 @@ void
_cairo_device_init (cairo_device_t *device,
const cairo_device_backend_t *backend)
{
+ CAIRO_TRACE_BEGIN (__func__);
CAIRO_REFERENCE_COUNT_INIT (&device->ref_count, 1);
device->status = CAIRO_STATUS_SUCCESS;
@@ -184,6 +186,7 @@ _cairo_device_init (cairo_device_t *device,
cairo_list_init (&device->shadow_caches);
device->shadow_caches_size = 0;
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -331,22 +334,26 @@ slim_hidden_def (cairo_device_finish);
void
cairo_device_destroy (cairo_device_t *device)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_user_data_array_t user_data;
if (device == NULL ||
CAIRO_REFERENCE_COUNT_IS_INVALID (&device->ref_count))
{
- return;
+ CAIRO_TRACE_END (__func__);
+ return;
}
assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&device->ref_count));
- if (! _cairo_reference_count_dec_and_test (&device->ref_count))
- return;
+ if (! _cairo_reference_count_dec_and_test (&device->ref_count)) {
+ CAIRO_TRACE_END (__func__);
+ return;
+ }
while (! cairo_list_is_empty (&device->shadow_caches)) {
cairo_shadow_cache_t *shadow;
- shadow = cairo_list_first_entry (&device->shadow_caches,
+ shadow = cairo_list_first_entry (&device->shadow_caches,
cairo_shadow_cache_t,
link);
@@ -366,6 +373,7 @@ cairo_device_destroy (cairo_device_t *device)
device->backend->destroy (device);
_cairo_user_data_array_fini (&user_data);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_device_destroy);
diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c
index 0a13c6aac..5884f619a 100644
--- a/src/cairo-egl-context.c
+++ b/src/cairo-egl-context.c
@@ -41,6 +41,7 @@
#include "cairo-gl-private.h"
#include "cairo-error-private.h"
+#include "cairo-ttrace.h"
#if CAIRO_HAS_EVASGL_SURFACE && CAIRO_HAS_GLESV2_SURFACE
extern void glActiveTexture (GLenum texture);
@@ -179,21 +180,25 @@ static void
_egl_swap_buffers (void *abstract_ctx,
cairo_gl_surface_t *abstract_surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_egl_context_t *ctx = abstract_ctx;
cairo_egl_surface_t *surface = (cairo_egl_surface_t *) abstract_surface;
eglSwapBuffers (ctx->display, surface->egl);
+ CAIRO_TRACE_END (__func__);
}
static void
_egl_destroy (void *abstract_ctx)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_egl_context_t *ctx = abstract_ctx;
eglMakeCurrent (ctx->display,
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (ctx->dummy_surface != EGL_NO_SURFACE)
eglDestroySurface (ctx->display, ctx->dummy_surface);
+ CAIRO_TRACE_END (__func__);
}
static cairo_bool_t
@@ -269,6 +274,7 @@ _cairo_egl_get_proc_address (void *data, const char *name)
cairo_device_t *
cairo_egl_device_create (EGLDisplay dpy, EGLContext egl)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_egl_context_t *ctx;
cairo_status_t status;
int attribs[] = {
@@ -280,8 +286,10 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl)
EGLint numConfigs;
ctx = calloc (1, sizeof (cairo_egl_context_t));
- if (unlikely (ctx == NULL))
- return _cairo_gl_context_create_in_error (CAIRO_STATUS_NO_MEMORY);
+ if (unlikely (ctx == NULL)) {
+ CAIRO_TRACE_END (__func__);
+ return _cairo_gl_context_create_in_error (CAIRO_STATUS_NO_MEMORY);
+ }
ctx->display = dpy;
ctx->context = egl;
@@ -315,11 +323,13 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl)
ctx->dummy_surface = eglCreatePbufferSurface (dpy, config, attribs);
if (ctx->dummy_surface == NULL) {
free (ctx);
+ CAIRO_TRACE_END (__func__);
return _cairo_gl_context_create_in_error (CAIRO_STATUS_NO_MEMORY);
}
if (!eglMakeCurrent (dpy, ctx->dummy_surface, ctx->dummy_surface, egl)) {
free (ctx);
+ CAIRO_TRACE_END (__func__);
return _cairo_gl_context_create_in_error (CAIRO_STATUS_NO_MEMORY);
}
}
@@ -327,16 +337,18 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl)
status = _cairo_gl_dispatch_init (&ctx->base.dispatch,
_cairo_egl_get_proc_address, NULL);
if (unlikely (status)) {
- free (ctx);
- return _cairo_gl_context_create_in_error (status);
+ free (ctx);
+ CAIRO_TRACE_END (__func__);
+ return _cairo_gl_context_create_in_error (status);
}
status = _cairo_gl_context_init (&ctx->base);
if (unlikely (status)) {
- if (ctx->dummy_surface != EGL_NO_SURFACE)
- eglDestroySurface (dpy, ctx->dummy_surface);
- free (ctx);
- return _cairo_gl_context_create_in_error (status);
+ if (ctx->dummy_surface != EGL_NO_SURFACE)
+ eglDestroySurface (dpy, ctx->dummy_surface);
+ free (ctx);
+ CAIRO_TRACE_END (__func__);
+ return _cairo_gl_context_create_in_error (status);
}
/* Tune the default VBO size to reduce overhead on embedded devices.
@@ -349,6 +361,7 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl)
ctx->current_surface = EGL_NO_SURFACE;
+ CAIRO_TRACE_END (__func__);
return &ctx->base.base;
}
@@ -358,25 +371,35 @@ cairo_gl_surface_create_for_egl (cairo_device_t *device,
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_egl_surface_t *surface;
- if (unlikely (device->status))
- return _cairo_surface_create_in_error (device->status);
+ if (unlikely (device->status)) {
+ CAIRO_TRACE_END (__func__);
+ return _cairo_surface_create_in_error (device->status);
+ }
- if (device->backend->type != CAIRO_DEVICE_TYPE_GL)
- return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
+ if (device->backend->type != CAIRO_DEVICE_TYPE_GL) {
+ CAIRO_TRACE_END (__func__);
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
+ }
- if (width <= 0 || height <= 0)
+ if (width <= 0 || height <= 0) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
+ }
surface = calloc (1, sizeof (cairo_egl_surface_t));
- if (unlikely (surface == NULL))
- return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
+ if (unlikely (surface == NULL)) {
+ CAIRO_TRACE_END (__func__);
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
+ }
_cairo_gl_surface_init (device, &surface->base,
CAIRO_CONTENT_COLOR_ALPHA, width, height);
surface->egl = egl;
+ CAIRO_TRACE_END (__func__);
return &surface->base.base;
}
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index e8c013758..0683862d8 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -51,6 +51,7 @@
#include "cairo-clip-private.h"
#include "cairo-error-private.h"
#include "cairo-image-surface-private.h"
+#include "cairo-ttrace.h"
cairo_int_status_t
_cairo_gl_composite_set_source (cairo_gl_composite_t *setup,
@@ -76,7 +77,7 @@ _cairo_gl_composite_set_source_operand (cairo_gl_composite_t *setup,
_cairo_gl_operand_copy (&setup->src, source);
if (source->type == CAIRO_GL_OPERAND_TEXTURE ||
source->type == CAIRO_GL_OPERAND_GAUSSIAN)
- status = _cairo_gl_surface_resolve_multisampling (source->texture.surface);
+ status = _cairo_gl_surface_resolve_multisampling (source->texture.surface);
}
void
@@ -112,7 +113,7 @@ _cairo_gl_composite_set_mask_operand (cairo_gl_composite_t *setup,
_cairo_gl_operand_copy (&setup->mask, mask);
if (mask->type == CAIRO_GL_OPERAND_TEXTURE ||
mask->type == CAIRO_GL_OPERAND_GAUSSIAN)
- status = _cairo_gl_surface_resolve_multisampling (mask->texture.surface);
+ status = _cairo_gl_surface_resolve_multisampling (mask->texture.surface);
}
}
@@ -830,14 +831,17 @@ cairo_status_t
_cairo_gl_composite_begin (cairo_gl_composite_t *setup,
cairo_gl_context_t **ctx_out)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_context_t *ctx;
cairo_status_t status;
assert (setup->dst);
status = _cairo_gl_context_acquire (setup->dst->base.device, &ctx);
- if (unlikely (status))
- return status;
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
setup->dst->content_cleared = FALSE;
@@ -862,12 +866,14 @@ FAIL:
if (unlikely (status))
status = _cairo_gl_context_release (ctx, status);
+ CAIRO_TRACE_END (__func__);
return status;
}
static inline void
_cairo_gl_composite_draw_tristrip (cairo_gl_context_t *ctx)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_array_t* indices = &ctx->tristrip_indices;
const unsigned short *indices_array = _cairo_array_index_const (indices, 0);
@@ -890,11 +896,13 @@ _cairo_gl_composite_draw_tristrip (cairo_gl_context_t *ctx)
ctx->dispatch.DrawElements (GL_TRIANGLE_STRIP, _cairo_array_num_elements (indices), GL_UNSIGNED_SHORT, ctx->ibo ? 0 :indices_array);
_cairo_array_truncate (indices, 0);
+ CAIRO_TRACE_END (__func__);
}
static inline void
_cairo_gl_composite_draw_line (cairo_gl_context_t *ctx)
{
+ CAIRO_TRACE_BEGIN (__func__);
GLenum type = GL_LINE_STRIP;
cairo_array_t* indices = &ctx->tristrip_indices;
const unsigned short *indices_array = _cairo_array_index_const (indices, 0);
@@ -921,12 +929,14 @@ _cairo_gl_composite_draw_line (cairo_gl_context_t *ctx)
ctx->dispatch.DrawElements (type, _cairo_array_num_elements (indices), GL_UNSIGNED_SHORT, ctx->ibo ? 0 : indices_array);
_cairo_array_truncate (indices, 0);
+ CAIRO_TRACE_END (__func__);
}
static inline void
_cairo_gl_composite_draw_triangles (cairo_gl_context_t *ctx,
unsigned int count)
{
+ CAIRO_TRACE_BEGIN (__func__);
if (! ctx->pre_shader) {
ctx->dispatch.DrawArrays (GL_TRIANGLES, 0, count);
} else {
@@ -940,17 +950,20 @@ _cairo_gl_composite_draw_triangles (cairo_gl_context_t *ctx,
_cairo_gl_set_operator (ctx, CAIRO_OPERATOR_ADD, TRUE);
ctx->dispatch.DrawArrays (GL_TRIANGLES, 0, count);
}
+ CAIRO_TRACE_END (__func__);
}
static void
_cairo_gl_composite_draw_triangles_with_clip_region (cairo_gl_context_t *ctx,
unsigned int count)
{
+ CAIRO_TRACE_BEGIN (__func__);
int i, num_rectangles;
if (!ctx->clip_region) {
- _cairo_gl_composite_draw_triangles (ctx, count);
- return;
+ _cairo_gl_composite_draw_triangles (ctx, count);
+ CAIRO_TRACE_END (__func__);
+ return;
}
num_rectangles = cairo_region_num_rectangles (ctx->clip_region);
@@ -963,6 +976,7 @@ _cairo_gl_composite_draw_triangles_with_clip_region (cairo_gl_context_t *ctx,
_enable_scissor_buffer (ctx);
_cairo_gl_composite_draw_triangles (ctx, count);
}
+ CAIRO_TRACE_END (__func__);
}
static void
@@ -979,14 +993,14 @@ _cairo_gl_composite_unmap_vertex_buffer (cairo_gl_context_t *ctx)
void
_cairo_gl_composite_flush (cairo_gl_context_t *ctx)
{
+ CAIRO_TRACE_BEGIN (__func__);
unsigned int count;
int i;
- if (_cairo_gl_context_is_flushed (ctx))
+ if (_cairo_gl_context_is_flushed (ctx)) {
+ CAIRO_TRACE_END (__func__);
return;
-
- /* ensure we are binding to vbo and ibo */
- _cairo_gl_ensure_drawbuffers (ctx);
+ }
count = ctx->vb_offset / ctx->vertex_size;
@@ -1007,6 +1021,7 @@ _cairo_gl_composite_flush (cairo_gl_context_t *ctx)
_cairo_gl_glyph_cache_unlock (&ctx->glyph_cache[i]);
_cairo_gl_image_cache_unlock (ctx);
+ CAIRO_TRACE_END (__func__);
}
static void
@@ -1482,18 +1497,22 @@ _cairo_gl_composite_init (cairo_gl_composite_t *setup,
cairo_gl_surface_t *dst,
cairo_bool_t assume_component_alpha)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
memset (setup, 0, sizeof (cairo_gl_composite_t));
status = _cairo_gl_composite_set_operator (setup, op,
assume_component_alpha);
- if (status)
- return status;
+ if (status) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
setup->dst = dst;
setup->clip_region = dst->clip_region;
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index 3258388df..8ca2ed2e5 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -45,6 +45,7 @@
#include "cairo-error-private.h"
#include "cairo-gl-private.h"
#include "cairo-rtree-private.h"
+#include "cairo-ttrace.h"
#if CAIRO_HAS_EVASGL_SURFACE
#include "cairo-evas-gl.h"
@@ -272,6 +273,7 @@ test_can_read_bgra (cairo_gl_context_t *ctx, cairo_gl_flavor_t gl_flavor)
cairo_status_t
_cairo_gl_context_init (cairo_gl_context_t *ctx)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
int gl_version = _cairo_gl_get_version (dispatch);
@@ -306,8 +308,10 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
cairo_list_init (&ctx->fonts);
/* Support only GL version >= 1.3 */
- if (gl_version < CAIRO_GL_VERSION_ENCODE (1, 3))
- return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
+ if (gl_version < CAIRO_GL_VERSION_ENCODE (1, 3)) {
+ CAIRO_TRACE_END (__func__);
+ return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
+ }
/* Check for required extensions */
if (is_desktop) {
@@ -318,8 +322,10 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
} else if (_cairo_gl_has_extension (&ctx->dispatch, "GL_ARB_texture_rectangle")) {
ctx->tex_target = GL_TEXTURE_RECTANGLE;
ctx->has_npot_repeat = FALSE;
- } else
+ } else {
+ CAIRO_TRACE_END (__func__);
return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
+ }
} else {
ctx->tex_target = GL_TEXTURE_2D;
if (_cairo_gl_has_extension (&ctx->dispatch, "GL_OES_texture_npot") ||
@@ -330,11 +336,15 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
}
if (is_desktop && gl_version < CAIRO_GL_VERSION_ENCODE (2, 1) &&
- ! _cairo_gl_has_extension (&ctx->dispatch, "GL_ARB_pixel_buffer_object"))
- return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
+ ! _cairo_gl_has_extension (&ctx->dispatch, "GL_ARB_pixel_buffer_object")) {
+ CAIRO_TRACE_END (__func__);
+ return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
+ }
- if (is_gles && ! _cairo_gl_has_extension (&ctx->dispatch, "GL_EXT_texture_format_BGRA8888"))
- return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
+ if (is_gles && ! _cairo_gl_has_extension (&ctx->dispatch, "GL_EXT_texture_format_BGRA8888")) {
+ CAIRO_TRACE_END (__func__);
+ return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
+ }
ctx->has_map_buffer =
is_desktop || (is_gles && _cairo_gl_has_extension (&ctx->dispatch, "GL_OES_mapbuffer"));
@@ -420,16 +430,20 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
ctx->gl_flavor = gl_flavor;
status = _cairo_gl_context_init_shaders (ctx);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _cairo_cache_init (&ctx->gradients,
_cairo_gl_gradient_equal,
NULL,
(cairo_destroy_func_t) _cairo_gl_gradient_destroy,
CAIRO_GL_GRADIENT_CACHE_SIZE);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
ctx->vbo_size = _cairo_gl_get_vbo_size();
@@ -460,11 +474,12 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
ctx->vb = malloc (ctx->vbo_size);
if (unlikely (ctx->vb == NULL)) {
- _cairo_cache_fini (&ctx->gradients);
- ctx->dispatch.DeleteVertexArrays (1, &ctx->vao);
- ctx->dispatch.DeleteBuffers (1, &ctx->vbo);
- ctx->dispatch.DeleteBuffers (1, &ctx->ibo);
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ _cairo_cache_fini (&ctx->gradients);
+ ctx->dispatch.DeleteVertexArrays (1, &ctx->vao);
+ ctx->dispatch.DeleteBuffers (1, &ctx->vbo);
+ ctx->dispatch.DeleteBuffers (1, &ctx->ibo);
+ CAIRO_TRACE_END (__func__);
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
ctx->primitive_type = CAIRO_GL_PRIMITIVE_TYPE_TRIANGLES;
@@ -495,6 +510,7 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
_cairo_gl_context_reset (ctx);
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
@@ -547,6 +563,7 @@ static void
_cairo_gl_clear_framebuffer (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_DESKTOP)
return;
@@ -555,6 +572,7 @@ _cairo_gl_clear_framebuffer (cairo_gl_context_t *ctx,
_disable_stencil_buffer (ctx);
ctx->dispatch.Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
+ CAIRO_TRACE_END (__func__);
}
#if CAIRO_HAS_GLESV2_SURFACE || CAIRO_HAS_EVASGL_SURFACE
@@ -562,11 +580,16 @@ static void
_cairo_gl_ensure_msaa_gles_framebuffer (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface)
{
- if (ctx->has_angle_multisampling)
- return;
+ CAIRO_TRACE_BEGIN (__func__);
+ if (ctx->has_angle_multisampling) {
+ CAIRO_TRACE_END (__func__);
+ return;
+ }
- if (surface->msaa_active)
- return;
+ if (surface->msaa_active) {
+ CAIRO_TRACE_END (__func__);
+ return;
+ }
ctx->dispatch.FramebufferTexture2DMultisample(GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
@@ -577,6 +600,7 @@ _cairo_gl_ensure_msaa_gles_framebuffer (cairo_gl_context_t *ctx,
/* From now on MSAA will always be active on this surface. */
surface->msaa_active = TRUE;
+ CAIRO_TRACE_END (__func__);
}
#endif
@@ -584,11 +608,14 @@ void
_cairo_gl_ensure_framebuffer (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
GLenum status;
cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
- if (likely (surface->fb))
+ if (likely (surface->fb)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
/* Create a framebuffer object wrapping the texture so that we can render
* to it.
@@ -639,22 +666,27 @@ _cairo_gl_ensure_framebuffer (cairo_gl_context_t *ctx,
"destination is framebuffer incomplete: %s [%#x]\n",
str, status);
}
+ CAIRO_TRACE_END (__func__);
}
static void
_cairo_gl_ensure_multisampling (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
GLenum rgba;
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2 &&
- ! ctx->has_angle_multisampling)
- return;
-
+ ! ctx->has_angle_multisampling) {
+ CAIRO_TRACE_END (__func__);
+ return;
+ }
assert (surface->supports_msaa);
- if (surface->msaa_fb)
- return;
+ if (surface->msaa_fb) {
+ CAIRO_TRACE_END (__func__);
+ return;
+ }
/* We maintain a separate framebuffer for multisampling operations.
This allows us to do a fast paint to the non-multisampling framebuffer
@@ -695,6 +727,7 @@ _cairo_gl_ensure_multisampling (cairo_gl_context_t *ctx,
surface->msaa_rb = 0;
ctx->dispatch.DeleteRenderbuffers (1, &surface->msaa_fb);
surface->msaa_fb = 0;
+ CAIRO_TRACE_END (__func__);
return;
}
@@ -705,16 +738,19 @@ _cairo_gl_ensure_multisampling (cairo_gl_context_t *ctx,
memset (&ctx->states_cache.clear_red, 0, sizeof (GLclampf) * 4);
ctx->dispatch.Clear (GL_COLOR_BUFFER_BIT);
-
+ CAIRO_TRACE_END (__func__);
}
static cairo_bool_t
_cairo_gl_ensure_msaa_depth_stencil_buffer (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
- if (surface->msaa_depth_stencil)
- return TRUE;
+ if (surface->msaa_depth_stencil) {
+ CAIRO_TRACE_END (__func__);
+ return TRUE;
+ }
//_cairo_gl_ensure_framebuffer (ctx, surface);
@@ -754,9 +790,11 @@ _cairo_gl_ensure_msaa_depth_stencil_buffer (cairo_gl_context_t *ctx,
if (dispatch->CheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
dispatch->DeleteRenderbuffers (1, &surface->msaa_depth_stencil);
surface->msaa_depth_stencil = 0;
+ CAIRO_TRACE_END (__func__);
return FALSE;
}
+ CAIRO_TRACE_END (__func__);
return TRUE;
}
@@ -764,10 +802,13 @@ static cairo_bool_t
_cairo_gl_ensure_depth_stencil_buffer (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
- if (surface->depth_stencil)
+ if (surface->depth_stencil) {
+ CAIRO_TRACE_END (__func__);
return TRUE;
+ }
_cairo_gl_ensure_framebuffer (ctx, surface);
@@ -784,9 +825,11 @@ _cairo_gl_ensure_depth_stencil_buffer (cairo_gl_context_t *ctx,
if (dispatch->CheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
dispatch->DeleteRenderbuffers (1, &surface->depth_stencil);
surface->depth_stencil = 0;
+ CAIRO_TRACE_END (__func__);
return FALSE;
}
+ CAIRO_TRACE_END (__func__);
return TRUE;
}
@@ -849,6 +892,7 @@ static void
bind_multisample_framebuffer (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_EVASGL_SURFACE
cairo_bool_t stencil_test_enabled = FALSE, scissor_test_enabled = FALSE;
cairo_bool_t has_stencil_cache = FALSE;
@@ -872,6 +916,7 @@ bind_multisample_framebuffer (cairo_gl_context_t *ctx,
#endif
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, surface->msaa_fb);
+ CAIRO_TRACE_END (__func__);
return;
}
@@ -913,21 +958,25 @@ bind_multisample_framebuffer (cairo_gl_context_t *ctx,
_enable_scissor_buffer (ctx);
}
#endif
+ CAIRO_TRACE_END (__func__);
}
static void
bind_singlesample_framebuffer (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_bool_t has_stencil_cache = surface->clip_on_stencil_buffer ? TRUE : FALSE;
cairo_bool_t stencil_test_enabled;
cairo_bool_t scissor_test_enabled;
GLbitfield mask = GL_COLOR_BUFFER_BIT;
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2 &&
- ! ctx->has_angle_multisampling)
+ ! ctx->has_angle_multisampling) {
+ CAIRO_TRACE_END (__func__);
return;
-
+ }
+
_cairo_gl_ensure_framebuffer (ctx, surface);
if (! surface->msaa_active) {
@@ -936,6 +985,7 @@ bind_singlesample_framebuffer (cairo_gl_context_t *ctx,
ctx->dispatch.Disable (GL_MULTISAMPLE);
#endif
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, surface->fb);
+ CAIRO_TRACE_END (__func__);
return;
}
@@ -984,6 +1034,7 @@ bind_singlesample_framebuffer (cairo_gl_context_t *ctx,
_enable_stencil_buffer (ctx);
if (scissor_test_enabled)
_enable_scissor_buffer (ctx);
+ CAIRO_TRACE_END (__func__);
}
void
@@ -991,6 +1042,7 @@ _cairo_gl_context_bind_framebuffer (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface,
cairo_bool_t multisampling)
{
+ CAIRO_TRACE_BEGIN (__func__);
if (_cairo_gl_surface_is_texture (surface)) {
/* OpenGL ES surfaces only have either a multisample framebuffer or a
* singlesample framebuffer, so we cannot switch back and forth. */
@@ -999,6 +1051,7 @@ _cairo_gl_context_bind_framebuffer (cairo_gl_context_t *ctx,
_cairo_gl_ensure_framebuffer (ctx, surface);
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, surface->fb);
_cairo_gl_clear_framebuffer (ctx, surface);
+ CAIRO_TRACE_END (__func__);
return;
}
@@ -1029,6 +1082,7 @@ _cairo_gl_context_bind_framebuffer (cairo_gl_context_t *ctx,
if (ctx->gl_flavor != CAIRO_GL_FLAVOR_DESKTOP && multisampling)
_cairo_gl_clear_framebuffer (ctx, surface);
+ CAIRO_TRACE_END (__func__);
}
void
@@ -1036,6 +1090,7 @@ _cairo_gl_context_set_destination (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface,
cairo_bool_t multisampling)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_bool_t changing_surface, changing_sampling;
/* The decision whether or not to use multisampling happens when
@@ -1050,11 +1105,13 @@ _cairo_gl_context_set_destination (cairo_gl_context_t *ctx,
if (! changing_surface && ! changing_sampling) {
if (surface->needs_update)
_cairo_gl_composite_flush (ctx);
+ CAIRO_TRACE_END (__func__);
return;
}
if (! changing_surface) {
_cairo_gl_composite_flush (ctx);
_cairo_gl_context_bind_framebuffer (ctx, surface, multisampling);
+ CAIRO_TRACE_END (__func__);
return;
}
@@ -1094,6 +1151,7 @@ _cairo_gl_context_set_destination (cairo_gl_context_t *ctx,
else
_gl_identity_ortho (ctx->modelviewprojection_matrix,
0, surface->width, surface->height, 0);
+ CAIRO_TRACE_END (__func__);
}
void
diff --git a/src/cairo-gl-msaa-compositor.c b/src/cairo-gl-msaa-compositor.c
index 49717f0fe..888f7da68 100644
--- a/src/cairo-gl-msaa-compositor.c
+++ b/src/cairo-gl-msaa-compositor.c
@@ -48,6 +48,7 @@
#include "cairo-path-private.h"
#include "cairo-traps-private.h"
#include "cairo-convex-fill-private.h"
+#include "cairo-ttrace.h"
static cairo_bool_t
can_use_msaa_compositor (cairo_gl_surface_t *surface,
@@ -238,15 +239,19 @@ _cairo_gl_msaa_compositor_draw_clip (cairo_gl_context_t *ctx,
cairo_gl_composite_t *setup,
cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
cairo_traps_t traps;
status = _clip_to_traps (clip, &traps);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _draw_traps (ctx, setup, &traps);
_cairo_traps_fini (&traps);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -484,6 +489,7 @@ static cairo_int_status_t
_cairo_gl_msaa_compositor_mask_source_operator (const cairo_compositor_t *compositor,
cairo_composite_rectangles_t *composite)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_composite_t setup;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *) composite->surface;
cairo_gl_context_t *ctx = NULL;
@@ -502,22 +508,27 @@ _cairo_gl_msaa_compositor_mask_source_operator (const cairo_compositor_t *compos
status = _clip_to_traps (clip, &traps);
if (unlikely (status)) {
_cairo_traps_fini (&traps);
+ CAIRO_TRACE_END (__func__);
return status;
}
}
if (! is_pixel_aligned) {
status = _blit_texture_to_renderbuffer (dst);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
}
status = _cairo_gl_composite_init (&setup,
CAIRO_OPERATOR_DEST_OUT,
dst,
FALSE /* assume_component_alpha */);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _cairo_gl_composite_set_source (&setup,
composite->original_mask_pattern,
&composite->mask_sample_area,
@@ -583,6 +594,7 @@ finish:
if (clip)
_cairo_traps_fini (&traps);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -590,6 +602,7 @@ static cairo_int_status_t
_cairo_gl_msaa_compositor_mask (const cairo_compositor_t *compositor,
cairo_composite_rectangles_t *composite)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_composite_t setup;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *) composite->surface;
cairo_gl_context_t *ctx = NULL;
@@ -598,12 +611,16 @@ _cairo_gl_msaa_compositor_mask (const cairo_compositor_t *compositor,
cairo_clip_t *clip = composite->clip;
cairo_bool_t is_pixel_aligned = FALSE;
- if (! can_use_msaa_compositor (dst, CAIRO_ANTIALIAS_DEFAULT))
+ if (! can_use_msaa_compositor (dst, CAIRO_ANTIALIAS_DEFAULT)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
if (composite->op == CAIRO_OPERATOR_CLEAR &&
- composite->original_mask_pattern != NULL)
+ composite->original_mask_pattern != NULL) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
/* GL compositing operators cannot properly represent a mask operation
using the SOURCE compositing operator in one pass. This only matters if
@@ -616,6 +633,7 @@ _cairo_gl_msaa_compositor_mask (const cairo_compositor_t *compositor,
if (! _cairo_pattern_is_opaque (&composite->source_pattern.base,
&composite->source_sample_area)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_gl_msaa_compositor_mask_source_operator (compositor, composite);
}
@@ -626,8 +644,10 @@ _cairo_gl_msaa_compositor_mask (const cairo_compositor_t *compositor,
if (_should_use_unbounded_surface (composite)) {
cairo_surface_t* surface = _prepare_unbounded_surface (dst);
- if (unlikely (surface == NULL))
+ if (unlikely (surface == NULL)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
/* This may be a paint operation. */
if (composite->original_mask_pattern == NULL) {
@@ -645,9 +665,11 @@ _cairo_gl_msaa_compositor_mask (const cairo_compositor_t *compositor,
if (unlikely (status)) {
cairo_surface_destroy (surface);
+ CAIRO_TRACE_END (__func__);
return status;
}
+ CAIRO_TRACE_END (__func__);
return _paint_back_unbounded_surface (compositor, composite, surface);
}
@@ -658,16 +680,20 @@ _cairo_gl_msaa_compositor_mask (const cairo_compositor_t *compositor,
if (! is_pixel_aligned) {
status = _blit_texture_to_renderbuffer (dst);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
}
status = _cairo_gl_composite_init (&setup,
op,
dst,
FALSE /* assume_component_alpha */);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _cairo_gl_composite_set_source (&setup,
composite->original_source_pattern,
@@ -719,7 +745,7 @@ _cairo_gl_msaa_compositor_mask (const cairo_compositor_t *compositor,
if (clip) {
cairo_clip_t *clip_copy = _cairo_clip_copy (clip);
-
+
clip_copy = _cairo_clip_intersect_rectangle (clip_copy, &rect);
status = _cairo_gl_msaa_compositor_draw_clip (ctx, &setup,
clip_copy);
@@ -740,6 +766,7 @@ finish:
if (ctx)
status = _cairo_gl_context_release (ctx, status);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -963,24 +990,28 @@ _cairo_gl_msaa_compositor_stroke (const cairo_compositor_t *compositor,
double tolerance,
cairo_antialias_t antialias)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *) composite->surface;
struct _tristrip_composite_info info;
cairo_bool_t use_color_attribute;
cairo_rectangle_int_t stroke_extents;
- if (! can_use_msaa_compositor (dst, antialias))
+ if (! can_use_msaa_compositor (dst, antialias)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
if (! _cairo_path_fixed_stroke_is_rectilinear (path)) {
_cairo_path_fixed_approximate_fill_extents (path, &stroke_extents);
if (stroke_extents.width != 0 &&
stroke_extents.height != 0) {
- if ((stroke_extents.width / stroke_extents.height > 10 &&
+ if ((stroke_extents.width / stroke_extents.height > 10 &&
stroke_extents.height < 10) ||
- (stroke_extents.height / stroke_extents.width > 10 &&
+ (stroke_extents.height / stroke_extents.width > 10 &&
stroke_extents.width < 10)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
}
}
@@ -989,8 +1020,10 @@ _cairo_gl_msaa_compositor_stroke (const cairo_compositor_t *compositor,
if (composite->is_bounded == FALSE) {
cairo_surface_t* surface = _prepare_unbounded_surface (dst);
- if (unlikely (surface == NULL))
+ if (unlikely (surface == NULL)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
status = _cairo_compositor_stroke (compositor, surface,
CAIRO_OPERATOR_SOURCE,
@@ -999,24 +1032,30 @@ _cairo_gl_msaa_compositor_stroke (const cairo_compositor_t *compositor,
tolerance, antialias, NULL);
if (unlikely (status)) {
cairo_surface_destroy (surface);
+ CAIRO_TRACE_END (__func__);
return status;
}
+ CAIRO_TRACE_END (__func__);
return _paint_back_unbounded_surface (compositor, composite, surface);
}
if (antialias != CAIRO_ANTIALIAS_NONE) {
status = _blit_texture_to_renderbuffer (dst);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
}
status = _cairo_gl_composite_init (&info.setup,
composite->op,
dst,
FALSE /* assume_component_alpha */);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
info.ctx = NULL;
use_color_attribute = _cairo_gl_hairline_style_is_hairline (style, ctm);
@@ -1102,6 +1141,7 @@ finish:
if (info.ctx)
status = _cairo_gl_context_release (info.ctx, status);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1136,6 +1176,7 @@ _cairo_gl_msaa_compositor_fill (const cairo_compositor_t *compositor,
double tolerance,
cairo_antialias_t antialias)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_composite_t setup;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *) composite->surface;
cairo_gl_context_t *ctx = NULL;
@@ -1145,17 +1186,20 @@ _cairo_gl_msaa_compositor_fill (const cairo_compositor_t *compositor,
cairo_rectangle_int_t fill_extents;
struct _tristrip_composite_info info;
- if (! can_use_msaa_compositor (dst, antialias))
+ if (! can_use_msaa_compositor (dst, antialias)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
if (! _cairo_path_fixed_fill_is_rectilinear (path)) {
_cairo_path_fixed_approximate_fill_extents (path, &fill_extents);
if (fill_extents.width != 0 && fill_extents.height != 0) {
- if ((fill_extents.width / fill_extents.height > 10 &&
+ if ((fill_extents.width / fill_extents.height > 10 &&
fill_extents.height < 10) ||
- (fill_extents.height / fill_extents.width > 10 &&
+ (fill_extents.height / fill_extents.width > 10 &&
fill_extents.width < 10)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
}
}
@@ -1164,8 +1208,10 @@ _cairo_gl_msaa_compositor_fill (const cairo_compositor_t *compositor,
if (composite->is_bounded == FALSE) {
cairo_surface_t* surface = _prepare_unbounded_surface (dst);
- if (unlikely (surface == NULL))
+ if (unlikely (surface == NULL)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
status = _cairo_compositor_fill (compositor, surface,
@@ -1176,16 +1222,20 @@ _cairo_gl_msaa_compositor_fill (const cairo_compositor_t *compositor,
if (unlikely (status)) {
cairo_surface_destroy (surface);
+ CAIRO_TRACE_END (__func__);
return status;
}
+ CAIRO_TRACE_END (__func__);
return _paint_back_unbounded_surface (compositor, composite, surface);
}
if (antialias != CAIRO_ANTIALIAS_NONE) {
status = _blit_texture_to_renderbuffer (dst);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
}
draw_path_with_traps = ! _cairo_path_fixed_is_simple_quad (path);
@@ -1208,7 +1258,7 @@ _cairo_gl_msaa_compositor_fill (const cairo_compositor_t *compositor,
_cairo_gl_msaa_compositor_set_clip (composite, &setup);
if (antialias != CAIRO_ANTIALIAS_NONE)
_cairo_gl_composite_set_multisample (&setup);
-
+
status = _cairo_gl_composite_begin (&setup, &ctx);
if (unlikely (status))
goto cleanup_setup;
@@ -1261,6 +1311,7 @@ cleanup_traps:
if (draw_path_with_traps && !path->is_convex)
_cairo_traps_fini (&traps);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1272,6 +1323,7 @@ _cairo_gl_msaa_compositor_glyphs (const cairo_compositor_t *compositor,
int num_glyphs,
cairo_bool_t overlap)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
cairo_surface_t *src = NULL;
int src_x, src_y;
@@ -1280,17 +1332,23 @@ _cairo_gl_msaa_compositor_glyphs (const cairo_compositor_t *compositor,
cairo_gl_surface_t *dst = (cairo_gl_surface_t *) composite->surface;
query_surface_capabilities (dst);
- if (! dst->supports_stencil)
+ if (! dst->supports_stencil) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
- if (composite->op == CAIRO_OPERATOR_CLEAR)
+ if (composite->op == CAIRO_OPERATOR_CLEAR) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
if (composite->is_bounded == FALSE) {
cairo_surface_t* surface = _prepare_unbounded_surface (dst);
- if (unlikely (surface == NULL))
+ if (unlikely (surface == NULL)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
status = _cairo_compositor_glyphs (compositor, surface,
CAIRO_OPERATOR_SOURCE,
@@ -1300,9 +1358,11 @@ _cairo_gl_msaa_compositor_glyphs (const cairo_compositor_t *compositor,
if (unlikely (status)) {
cairo_surface_destroy (surface);
+ CAIRO_TRACE_END (__func__);
return status;
}
+ CAIRO_TRACE_END (__func__);
return _paint_back_unbounded_surface (compositor, composite, surface);
}
/*
@@ -1351,7 +1411,7 @@ _cairo_gl_msaa_compositor_glyphs (const cairo_compositor_t *compositor,
finish:
if (src)
cairo_surface_destroy (src);
-
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1359,6 +1419,7 @@ static void
_cairo_gl_msaa_compositor_init (cairo_compositor_t *compositor,
const cairo_compositor_t *delegate)
{
+ CAIRO_TRACE_BEGIN (__func__);
compositor->delegate = delegate;
compositor->lazy_init = TRUE;
compositor->paint = _cairo_gl_msaa_compositor_paint;
@@ -1366,6 +1427,7 @@ _cairo_gl_msaa_compositor_init (cairo_compositor_t *compositor,
compositor->fill = _cairo_gl_msaa_compositor_fill;
compositor->stroke = _cairo_gl_msaa_compositor_stroke;
compositor->glyphs = _cairo_gl_msaa_compositor_glyphs;
+ CAIRO_TRACE_END (__func__);
}
const cairo_compositor_t *
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 7938f3076..52c07728d 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -50,6 +50,7 @@
#include "cairo-surface-backend-private.h"
#include "cairo-surface-shadow-private.h"
#include "cairo-surface-scale-translate-private.h"
+#include "cairo-ttrace.h"
static const cairo_surface_backend_t _cairo_gl_surface_backend;
@@ -67,16 +68,19 @@ _cairo_gl_surface_shadow_surface (void *surface,
int width, int height,
int *width_out, int *height_out)
{
+ CAIRO_TRACE_BEGIN (__func__);
int shadow_width, shadow_height;
cairo_gl_surface_t *shadow_surface = NULL;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *)surface;
cairo_gl_context_t *ctx = (cairo_gl_context_t *)dst->base.device;
- if (ctx == NULL)
+ if (ctx == NULL) {
+ CAIRO_TRACE_END (__func__);
return NULL;
+ }
shadow_surface = ctx->shadow_scratch_surfaces[0];
-
+
if (shadow_surface) {
shadow_width = shadow_surface->width;
shadow_height = shadow_surface->height;
@@ -86,6 +90,7 @@ _cairo_gl_surface_shadow_surface (void *surface,
shadow_height >= height) {
*width_out = width;
*height_out = height;
+ CAIRO_TRACE_END (__func__);
return cairo_surface_reference (&shadow_surface->base);
}
else {
@@ -161,6 +166,7 @@ _cairo_gl_surface_shadow_surface (void *surface,
shadow_height);
if (unlikely (shadow_surface->base.status)) {
cairo_surface_destroy (&shadow_surface->base);
+ CAIRO_TRACE_END (__func__);
return NULL;
}
@@ -191,6 +197,7 @@ _cairo_gl_surface_shadow_surface (void *surface,
*height_out *= 0.5;
}
+ CAIRO_TRACE_END (__func__);
return cairo_surface_reference (&shadow_surface->base);
}
@@ -199,15 +206,20 @@ _cairo_gl_surface_shadow_mask_surface (void *surface,
int width, int height,
unsigned int index)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_surface_t *mask_surface = NULL;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *)surface;
cairo_gl_context_t *ctx = (cairo_gl_context_t *)dst->base.device;
- if (ctx == NULL)
+ if (ctx == NULL) {
+ CAIRO_TRACE_END (__func__);
return NULL;
+ }
- if (index > 1)
+ if (index > 1) {
+ CAIRO_TRACE_END (__func__);
return NULL;
+ }
mask_surface = ctx->shadow_masks[index];
@@ -228,6 +240,7 @@ _cairo_gl_surface_shadow_mask_surface (void *surface,
height);
if (unlikely (mask_surface->base.status)) {
cairo_surface_destroy (&mask_surface->base);
+ CAIRO_TRACE_END (__func__);
return NULL;
}
_cairo_surface_release_device_reference (&mask_surface->base);
@@ -237,7 +250,7 @@ _cairo_gl_surface_shadow_mask_surface (void *surface,
mask_surface->needs_to_cache = FALSE;
mask_surface->force_no_cache = TRUE;
-
+ CAIRO_TRACE_END (__func__);
return cairo_surface_reference (&mask_surface->base);
}
@@ -246,19 +259,22 @@ _cairo_gl_surface_glyph_shadow_surface (void *surface,
int width, int height,
cairo_bool_t for_source)
{
+ CAIRO_TRACE_BEGIN (__func__);
int shadow_width, shadow_height;
cairo_gl_surface_t *shadow_surface = NULL;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *)surface;
cairo_gl_context_t *ctx = (cairo_gl_context_t *)dst->base.device;
- if (ctx == NULL)
+ if (ctx == NULL) {
+ CAIRO_TRACE_END (__func__);
return NULL;
+ }
if (! for_source)
shadow_surface = ctx->shadow_scratch_surfaces[1];
else
shadow_surface = ctx->shadow_scratch_surfaces[2];
-
+
if (shadow_surface) {
shadow_width = shadow_surface->width;
shadow_height = shadow_surface->height;
@@ -273,10 +289,11 @@ _cairo_gl_surface_glyph_shadow_surface (void *surface,
if (! shadow_surface) {
shadow_surface = (cairo_gl_surface_t *)
_cairo_gl_surface_create_scratch (ctx,
- CAIRO_CONTENT_COLOR_ALPHA,
+ CAIRO_CONTENT_COLOR_ALPHA,
width, height);
if (unlikely (shadow_surface->base.status)) {
cairo_surface_destroy (&shadow_surface->base);
+ CAIRO_TRACE_END (__func__);
return NULL;
}
_cairo_surface_release_device_reference (&shadow_surface->base);
@@ -290,6 +307,7 @@ _cairo_gl_surface_glyph_shadow_surface (void *surface,
shadow_surface->needs_to_cache = FALSE;
shadow_surface->force_no_cache = TRUE;
+ CAIRO_TRACE_END (__func__);
return cairo_surface_reference (&shadow_surface->base);
}
@@ -298,21 +316,26 @@ _cairo_gl_surface_glyph_shadow_mask_surface (void *surface,
int width, int height,
unsigned index)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_surface_t *mask_surface = NULL;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *)surface;
cairo_gl_context_t *ctx = (cairo_gl_context_t *)dst->base.device;
- if (ctx == NULL)
+ if (ctx == NULL) {
+ CAIRO_TRACE_END (__func__);
return NULL;
+ }
- if (index > 1)
+ if (index > 1) {
+ CAIRO_TRACE_END (__func__);
return NULL;
+ }
mask_surface = ctx->shadow_masks[index + 2];
-
+
if (mask_surface) {
if (mask_surface->width != width ||
- mask_surface->height != height) {
+ mask_surface->height != height) {
cairo_surface_destroy (&mask_surface->base);
mask_surface = NULL;
ctx->shadow_masks[index + 2] = NULL;
@@ -327,6 +350,7 @@ _cairo_gl_surface_glyph_shadow_mask_surface (void *surface,
height);
if (unlikely (mask_surface->base.status)) {
cairo_surface_destroy (&mask_surface->base);
+ CAIRO_TRACE_END (__func__);
return NULL;
}
_cairo_surface_release_device_reference (&mask_surface->base);
@@ -337,6 +361,7 @@ _cairo_gl_surface_glyph_shadow_mask_surface (void *surface,
mask_surface->needs_to_cache = FALSE;
mask_surface->force_no_cache = TRUE;
+ CAIRO_TRACE_END (__func__);
return cairo_surface_reference (&mask_surface->base);
}
@@ -666,6 +691,7 @@ _cairo_gl_surface_init (cairo_device_t *device,
cairo_content_t content,
int width, int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
assert (width > 0 && height > 0);
_cairo_surface_init (&surface->base,
@@ -691,6 +717,7 @@ _cairo_gl_surface_init (cairo_device_t *device,
surface->content_cleared = FALSE;
_cairo_gl_surface_embedded_operand_init (surface);
+ CAIRO_TRACE_END (__func__);
}
static cairo_bool_t
@@ -717,11 +744,14 @@ _cairo_gl_surface_create_scratch_for_texture (cairo_gl_context_t *ctx,
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_surface_t *surface;
surface = calloc (1, sizeof (cairo_gl_surface_t));
- if (unlikely (surface == NULL))
+ if (unlikely (surface == NULL)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
+ }
surface->tex = tex;
_cairo_gl_surface_init (&ctx->base, surface, content, width, height);
@@ -736,6 +766,7 @@ _cairo_gl_surface_create_scratch_for_texture (cairo_gl_context_t *ctx,
ctx->dispatch.TexParameteri (ctx->tex_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
ctx->dispatch.TexParameteri (ctx->tex_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ CAIRO_TRACE_END (__func__);
return &surface->base;
}
@@ -746,6 +777,7 @@ _create_scratch_internal (cairo_gl_context_t *ctx,
int height,
cairo_bool_t for_caching)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_surface_t *surface;
GLenum format;
GLuint tex;
@@ -754,8 +786,10 @@ _create_scratch_internal (cairo_gl_context_t *ctx,
surface = (cairo_gl_surface_t *)
_cairo_gl_surface_create_scratch_for_texture (ctx, content,
tex, width, height);
- if (unlikely (surface->base.status))
+ if (unlikely (surface->base.status)) {
+ CAIRO_TRACE_END (__func__);
return &surface->base;
+ }
surface->owns_tex = TRUE;
@@ -797,6 +831,7 @@ _create_scratch_internal (cairo_gl_context_t *ctx,
width, height, 0,
format, GL_UNSIGNED_BYTE, NULL);
+ CAIRO_TRACE_END (__func__);
return &surface->base;
}
@@ -822,13 +857,16 @@ static cairo_status_t
_cairo_gl_surface_clear (cairo_gl_surface_t *surface,
const cairo_color_t *color)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_context_t *ctx;
cairo_status_t status;
double r, g, b, a;
status = _cairo_gl_context_acquire (surface->base.device, &ctx);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (ctx->current_target == surface)
_cairo_gl_composite_flush (ctx);
@@ -887,6 +925,7 @@ _cairo_gl_surface_clear (cairo_gl_surface_t *surface,
surface->content_changed = TRUE;
surface->content_synced = FALSE;
surface->content_cleared = TRUE;
+ CAIRO_TRACE_END (__func__);
return _cairo_gl_context_release (ctx, status);
}
@@ -896,21 +935,26 @@ _cairo_gl_surface_create_and_clear_scratch (cairo_gl_context_t *ctx,
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_surface_t *surface;
cairo_int_status_t status;
surface = (cairo_gl_surface_t *)
_cairo_gl_surface_create_scratch (ctx, content, width, height);
- if (unlikely (surface->base.status))
+ if (unlikely (surface->base.status)) {
+ CAIRO_TRACE_END (__func__);
return &surface->base;
+ }
/* Cairo surfaces start out initialized to transparent (black) */
status = _cairo_gl_surface_clear (surface, CAIRO_COLOR_TRANSPARENT);
if (unlikely (status)) {
cairo_surface_destroy (&surface->base);
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (status);
}
+ CAIRO_TRACE_END (__func__);
return &surface->base;
}
@@ -920,28 +964,40 @@ cairo_gl_surface_create (cairo_device_t *abstract_device,
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_context_t *ctx;
cairo_gl_surface_t *surface;
cairo_status_t status;
- if (! CAIRO_CONTENT_VALID (content))
+ if (! CAIRO_CONTENT_VALID (content)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_CONTENT));
+ }
- if (abstract_device == NULL)
+ if (abstract_device == NULL) {
+ CAIRO_TRACE_END (__func__);
return _cairo_image_surface_create_with_content (content, width, height);
+ }
- if (abstract_device->status)
+ if (abstract_device->status) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (abstract_device->status);
+ }
- if (abstract_device->backend->type != CAIRO_DEVICE_TYPE_GL)
+ if (abstract_device->backend->type != CAIRO_DEVICE_TYPE_GL) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
+ }
status = _cairo_gl_context_acquire (abstract_device, &ctx);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (status);
+ }
if (! _cairo_gl_surface_size_valid_for_context (ctx, width, height)) {
status = _cairo_gl_context_release (ctx, status);
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
}
@@ -950,15 +1006,18 @@ cairo_gl_surface_create (cairo_device_t *abstract_device,
if (unlikely (surface->base.status)) {
status = _cairo_gl_context_release (ctx, surface->base.status);
cairo_surface_destroy (&surface->base);
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (status);
}
status = _cairo_gl_context_release (ctx, status);
if (unlikely (status)) {
cairo_surface_destroy (&surface->base);
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (status);
}
+ CAIRO_TRACE_END (__func__);
return &surface->base;
}
slim_hidden_def (cairo_gl_surface_create);
@@ -997,28 +1056,40 @@ cairo_gl_surface_create_for_texture (cairo_device_t *abstract_device,
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_context_t *ctx;
cairo_gl_surface_t *surface;
cairo_status_t status;
- if (! CAIRO_CONTENT_VALID (content))
+ if (! CAIRO_CONTENT_VALID (content)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_CONTENT));
+ }
- if (abstract_device == NULL)
+ if (abstract_device == NULL) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NULL_POINTER));
+ }
- if (abstract_device->status)
+ if (abstract_device->status) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (abstract_device->status);
+ }
- if (abstract_device->backend->type != CAIRO_DEVICE_TYPE_GL)
+ if (abstract_device->backend->type != CAIRO_DEVICE_TYPE_GL) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_DEVICE_TYPE_MISMATCH));
+ }
status = _cairo_gl_context_acquire (abstract_device, &ctx);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (status);
+ }
if (! _cairo_gl_surface_size_valid_for_context (ctx, width, height)) {
status = _cairo_gl_context_release (ctx, status);
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
}
@@ -1026,7 +1097,7 @@ cairo_gl_surface_create_for_texture (cairo_device_t *abstract_device,
_cairo_gl_surface_create_scratch_for_texture (ctx, content,
tex, width, height);
status = _cairo_gl_context_release (ctx, status);
-
+ CAIRO_TRACE_END (__func__);
return &surface->base;
}
slim_hidden_def (cairo_gl_surface_create_for_texture);
@@ -1088,17 +1159,22 @@ cairo_gl_surface_swapbuffers (cairo_surface_t *abstract_surface)
{
cairo_gl_surface_t *surface = (cairo_gl_surface_t *) abstract_surface;
- if (unlikely (abstract_surface->status))
+ if (unlikely (abstract_surface->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
if (unlikely (abstract_surface->finished)) {
_cairo_surface_set_error (abstract_surface,
_cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
+ CAIRO_TRACE_END (__func__);
return;
}
if (! _cairo_surface_is_gl (abstract_surface)) {
_cairo_surface_set_error (abstract_surface,
CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
+
+ CAIRO_TRACE_END (__func__);
return;
}
@@ -1107,8 +1183,11 @@ cairo_gl_surface_swapbuffers (cairo_surface_t *abstract_surface)
cairo_status_t status;
status = _cairo_gl_context_acquire (surface->base.device, &ctx);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
+
/* And in any case we should flush any pending operations. */
_cairo_gl_composite_flush (ctx);
@@ -1128,6 +1207,7 @@ cairo_gl_surface_swapbuffers (cairo_surface_t *abstract_surface)
if (status)
status = _cairo_surface_set_error (abstract_surface, status);
}
+ CAIRO_TRACE_END (__func__);
}
static cairo_surface_t *
@@ -1136,25 +1216,32 @@ _cairo_gl_surface_create_similar (void *abstract_surface,
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_surface_t *surface = abstract_surface;
cairo_gl_context_t *ctx;
cairo_status_t status;
- if (! _cairo_gl_surface_size_valid (abstract_surface, width, height))
+ if (! _cairo_gl_surface_size_valid (abstract_surface, width, height)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_image_surface_create_with_content (content, width, height);
+ }
status = _cairo_gl_context_acquire (surface->device, &ctx);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (status);
+ }
surface = _cairo_gl_surface_create_and_clear_scratch (ctx, content, width, height);
status = _cairo_gl_context_release (ctx, status);
if (unlikely (status)) {
cairo_surface_destroy (surface);
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (status);
}
+ CAIRO_TRACE_END (__func__);
return surface;
}
@@ -1164,6 +1251,7 @@ _cairo_gl_surface_fill_alpha_channel (cairo_gl_surface_t *dst,
int x, int y,
int width, int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_composite_t setup;
cairo_status_t status;
@@ -1191,6 +1279,7 @@ _cairo_gl_surface_fill_alpha_channel (cairo_gl_surface_t *dst,
_cairo_gl_composite_flush (ctx);
ctx->dispatch.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1202,6 +1291,7 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
int dst_x, int dst_y,
cairo_bool_t force_flush)
{
+ CAIRO_TRACE_BEGIN (__func__);
GLenum internal_format, format, type;
cairo_bool_t has_alpha, needs_swap;
cairo_image_surface_t *clone = NULL;
@@ -1211,8 +1301,10 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
cairo_int_status_t status = CAIRO_INT_STATUS_SUCCESS;
status = _cairo_gl_context_acquire (dst->base.device, &ctx);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (_cairo_gl_get_flavor (&ctx->dispatch) == CAIRO_GL_FLAVOR_ES2 ||
_cairo_gl_get_flavor (&ctx->dispatch) == CAIRO_GL_FLAVOR_ES3) {
@@ -1438,6 +1530,7 @@ FAIL:
dst->content_synced = FALSE;
}
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1453,13 +1546,16 @@ static int _cairo_gl_surface_flavor (cairo_gl_surface_t *surface)
static cairo_status_t
_cairo_gl_surface_finish (void *abstract_surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_surface_t *surface = abstract_surface;
cairo_status_t status;
cairo_gl_context_t *ctx;
status = _cairo_gl_context_acquire (surface->base.device, &ctx);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if ((ctx->operands[CAIRO_GL_TEX_SOURCE].type == CAIRO_GL_OPERAND_TEXTURE ||
ctx->operands[CAIRO_GL_TEX_SOURCE].type == CAIRO_GL_OPERAND_GAUSSIAN) &&
@@ -1495,6 +1591,7 @@ _cairo_gl_surface_finish (void *abstract_surface)
if (surface->clip_on_stencil_buffer)
_cairo_clip_destroy (surface->clip_on_stencil_buffer);
+ CAIRO_TRACE_END (__func__);
return _cairo_gl_context_release (ctx, status);
}
@@ -1502,6 +1599,7 @@ static cairo_image_surface_t *
_cairo_gl_surface_map_to_image (void *abstract_surface,
const cairo_rectangle_int_t *extents)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_surface_t *surface = abstract_surface;
cairo_image_surface_t *image;
cairo_gl_context_t *ctx;
@@ -1514,6 +1612,7 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
status = _cairo_gl_context_acquire (surface->base.device, &ctx);
if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_image_surface_create_in_error (status);
}
@@ -1535,6 +1634,7 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
cpp = 1;
} else {
ASSERT_NOT_REACHED;
+ CAIRO_TRACE_END (__func__);
return NULL;
}
@@ -1571,6 +1671,7 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
-1);
if (unlikely (image->base.status)) {
status = _cairo_gl_context_release (ctx, status);
+ CAIRO_TRACE_END (__func__);
return image;
}
@@ -1580,6 +1681,7 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
* is clear, we can avoid downloading data. */
if (surface->base.is_clear || surface->base.serial == 0) {
status = _cairo_gl_context_release (ctx, status);
+ CAIRO_TRACE_END (__func__);
return image;
}
@@ -1616,6 +1718,7 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
status = _cairo_gl_context_release (ctx, status);
if (unlikely (status)) {
cairo_surface_destroy (&image->base);
+ CAIRO_TRACE_END (__func__);
return _cairo_image_surface_create_in_error (status);
}
@@ -1629,6 +1732,7 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
row = malloc (image->stride);
if (unlikely (row == NULL)) {
cairo_surface_destroy (&image->base);
+ CAIRO_TRACE_END (__func__);
return _cairo_image_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
}
}
@@ -1647,6 +1751,7 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
image->base.is_clear = FALSE;
+ CAIRO_TRACE_END (__func__);
return image;
}
@@ -1696,6 +1801,7 @@ static cairo_int_status_t
_cairo_gl_surface_unmap_image (void *abstract_surface,
cairo_image_surface_t *image)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
status = _cairo_gl_surface_draw_image (abstract_surface, image,
@@ -1708,6 +1814,7 @@ _cairo_gl_surface_unmap_image (void *abstract_surface,
cairo_surface_finish (&image->base);
cairo_surface_destroy (&image->base);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1728,16 +1835,21 @@ _cairo_gl_surface_get_extents (void *abstract_surface,
static cairo_status_t
_cairo_gl_surface_flush (void *abstract_surface, unsigned flags)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_surface_t *surface = abstract_surface;
cairo_status_t status;
cairo_gl_context_t *ctx;
- if (flags)
+ if (flags) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
status = _cairo_gl_context_acquire (surface->base.device, &ctx);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (((ctx->operands[CAIRO_GL_TEX_SOURCE].type == CAIRO_GL_OPERAND_TEXTURE ||
ctx->operands[CAIRO_GL_TEX_SOURCE].type == CAIRO_GL_OPERAND_GAUSSIAN) &&
@@ -1754,6 +1866,7 @@ _cairo_gl_surface_flush (void *abstract_surface, unsigned flags)
ctx->dispatch.Flush ();
#endif
+ CAIRO_TRACE_END (__func__);
return _cairo_gl_context_release (ctx, status);
}
@@ -1803,19 +1916,23 @@ _cairo_gl_surface_paint (void *surface,
const cairo_pattern_t *source,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *)surface;
cairo_gl_context_t *ctx = (cairo_gl_context_t *)dst->base.device;
status = cairo_device_acquire (dst->base.device);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _cairo_surface_shadow_paint (surface, op, source, clip,
&source->shadow);
ctx->source_scratch_in_use = FALSE;
if (unlikely (status)) {
- cairo_device_release (dst->base.device);
+ cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1824,9 +1941,10 @@ _cairo_gl_surface_paint (void *surface,
dst->content_changed = TRUE;
dst->content_synced = FALSE;
}
-
+
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1835,6 +1953,7 @@ _cairo_gl_surface_paint (void *surface,
if (op == CAIRO_OPERATOR_CLEAR) {
status = _cairo_gl_surface_clear (surface, CAIRO_COLOR_TRANSPARENT);
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
else if (source->type == CAIRO_PATTERN_TYPE_SOLID &&
@@ -1842,7 +1961,8 @@ _cairo_gl_surface_paint (void *surface,
(op == CAIRO_OPERATOR_OVER && _cairo_pattern_is_opaque_solid (source)))) {
status = _cairo_gl_surface_clear (surface,
&((cairo_solid_pattern_t *) source)->color);
- cairo_device_release (dst->base.device);
+ cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
}
@@ -1853,9 +1973,10 @@ _cairo_gl_surface_paint (void *surface,
dst->content_changed = TRUE;
dst->content_synced = FALSE;
}
-
+
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1866,19 +1987,23 @@ _cairo_gl_surface_mask (void *surface,
const cairo_pattern_t *mask,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *) surface;
cairo_gl_context_t *ctx = (cairo_gl_context_t *)dst->base.device;
status = cairo_device_acquire (dst->base.device);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _cairo_surface_shadow_mask (surface, op, source, mask, clip,
&source->shadow);
ctx->source_scratch_in_use = FALSE;
if (unlikely (status)) {
- cairo_device_release (dst->base.device);
+ cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1886,10 +2011,11 @@ _cairo_gl_surface_mask (void *surface,
if (status == CAIRO_INT_STATUS_SUCCESS) {
dst->content_changed = TRUE;
dst->content_synced = FALSE;
- }
-
+ }
+
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1898,9 +2024,10 @@ _cairo_gl_surface_mask (void *surface,
if (status == CAIRO_INT_STATUS_SUCCESS) {
dst->content_changed = TRUE;
dst->content_synced = FALSE;
-
+
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1913,6 +2040,7 @@ _cairo_gl_surface_mask (void *surface,
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1928,14 +2056,17 @@ _cairo_gl_surface_stroke (void *surface,
cairo_antialias_t antialias,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *)surface;
cairo_gl_context_t *ctx = (cairo_gl_context_t *)dst->base.device;
cairo_shadow_type_t shadow_type = source->shadow.type;
status = cairo_device_acquire (dst->base.device);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (shadow_type != CAIRO_SHADOW_INSET)
status = _cairo_surface_shadow_stroke (surface, op, source, path,
@@ -1946,6 +2077,7 @@ _cairo_gl_surface_stroke (void *surface,
ctx->source_scratch_in_use = FALSE;
if (unlikely (status)) {
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1956,6 +2088,7 @@ _cairo_gl_surface_stroke (void *surface,
source->shadow.draw_shadow_only) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1969,6 +2102,7 @@ _cairo_gl_surface_stroke (void *surface,
if (unlikely (status)) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1982,6 +2116,7 @@ _cairo_gl_surface_stroke (void *surface,
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1995,14 +2130,17 @@ _cairo_gl_surface_fill (void *surface,
cairo_antialias_t antialias,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *)surface;
cairo_gl_context_t *ctx = (cairo_gl_context_t *)dst->base.device;
cairo_shadow_type_t shadow_type = source->shadow.type;
status = cairo_device_acquire (dst->base.device);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (shadow_type != CAIRO_SHADOW_INSET)
status = _cairo_surface_shadow_fill (surface, op, source, path,
@@ -2012,6 +2150,7 @@ _cairo_gl_surface_fill (void *surface,
ctx->source_scratch_in_use = FALSE;
if (unlikely (status)) {
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -2022,6 +2161,7 @@ _cairo_gl_surface_fill (void *surface,
source->shadow.draw_shadow_only) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -2045,6 +2185,7 @@ _cairo_gl_surface_fill (void *surface,
if (unlikely (status)) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -2057,6 +2198,8 @@ _cairo_gl_surface_fill (void *surface,
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -2069,14 +2212,17 @@ _cairo_gl_surface_glyphs (void *surface,
cairo_scaled_font_t *font,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
cairo_gl_surface_t *dst = (cairo_gl_surface_t *)surface;
cairo_gl_context_t *ctx = (cairo_gl_context_t *)dst->base.device;
cairo_shadow_type_t shadow_type = source->shadow.type;
status = cairo_device_acquire (dst->base.device);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (shadow_type != CAIRO_SHADOW_INSET)
status = _cairo_surface_shadow_glyphs (surface, op, source,
@@ -2087,6 +2233,7 @@ _cairo_gl_surface_glyphs (void *surface,
ctx->source_scratch_in_use = FALSE;
if (unlikely (status)) {
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -2097,6 +2244,7 @@ _cairo_gl_surface_glyphs (void *surface,
source->shadow.draw_shadow_only) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -2110,6 +2258,7 @@ _cairo_gl_surface_glyphs (void *surface,
if (unlikely (status)) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -2123,6 +2272,7 @@ _cairo_gl_surface_glyphs (void *surface,
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index c747b3fa8..cb644454d 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -44,6 +44,7 @@
#include "cairo-gstate-private.h"
#include "cairo-pattern-private.h"
#include "cairo-traps-private.h"
+#include "cairo-ttrace.h"
#if _XOPEN_SOURCE >= 600 || defined (_ISOC99_SOURCE)
#define ISFINITE(x) isfinite (x)
@@ -105,6 +106,7 @@ cairo_status_t
_cairo_gstate_init (cairo_gstate_t *gstate,
cairo_surface_t *target)
{
+ CAIRO_TRACE_BEGIN (__func__);
VG (VALGRIND_MAKE_MEM_UNDEFINED (gstate, sizeof (cairo_gstate_t)));
gstate->next = NULL;
@@ -151,6 +153,7 @@ _cairo_gstate_init (cairo_gstate_t *gstate,
/* Now that the gstate is fully initialized and ready for the eventual
* _cairo_gstate_fini(), we can check for errors (and not worry about
* the resource deallocation). */
+ CAIRO_TRACE_END (__func__);
return target->status;
}
@@ -217,6 +220,7 @@ _cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other)
void
_cairo_gstate_fini (cairo_gstate_t *gstate)
{
+ CAIRO_TRACE_BEGIN (__func__);
_cairo_stroke_style_fini (&gstate->stroke_style);
cairo_font_face_destroy (gstate->font_face);
@@ -246,6 +250,7 @@ _cairo_gstate_fini (cairo_gstate_t *gstate)
memset (&gstate->shadow, 0, sizeof (cairo_shadow_t));
+ CAIRO_TRACE_END (__func__);
VG (VALGRIND_MAKE_MEM_NOACCESS (gstate, sizeof (cairo_gstate_t)));
}
@@ -416,14 +421,18 @@ cairo_status_t
_cairo_gstate_set_source (cairo_gstate_t *gstate,
cairo_pattern_t *source)
{
- if (source->status)
+ CAIRO_TRACE_BEGIN (__func__);
+ if (source->status) {
+ CAIRO_TRACE_END (__func__);
return source->status;
+ }
source = cairo_pattern_reference (source);
cairo_pattern_destroy (gstate->source);
gstate->source = source;
gstate->source_ctm_inverse = gstate->ctm_inverse;
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
@@ -1065,6 +1074,7 @@ _cairo_gstate_get_pattern_status (const cairo_pattern_t *pattern)
cairo_status_t
_cairo_gstate_paint (cairo_gstate_t *gstate)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_pattern_union_t source_pattern;
const cairo_pattern_t *pattern;
cairo_status_t status;
@@ -1072,14 +1082,20 @@ _cairo_gstate_paint (cairo_gstate_t *gstate)
cairo_bool_t destroy_pattern = FALSE;
status = _cairo_gstate_get_pattern_status (gstate->source);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
- if (gstate->op == CAIRO_OPERATOR_DEST)
+ if (gstate->op == CAIRO_OPERATOR_DEST) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
- if (_cairo_clip_is_all_clipped (gstate->clip))
+ if (_cairo_clip_is_all_clipped (gstate->clip)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
if (gstate->source->filter == CAIRO_FILTER_GAUSSIAN)
status = _cairo_pattern_create_gaussian_matrix (gstate->source, 1024);
@@ -1087,7 +1103,7 @@ _cairo_gstate_paint (cairo_gstate_t *gstate)
op = _reduce_op (gstate);
/* do not use static pattern */
if (op == CAIRO_OPERATOR_CLEAR) {
- if (! _cairo_gstate_has_shadow (gstate))
+ if (! _cairo_gstate_has_shadow (gstate))
pattern = &_cairo_pattern_clear.base;
else {
pattern = cairo_pattern_create_rgba (0, 0, 0, 0);
@@ -1107,7 +1123,7 @@ _cairo_gstate_paint (cairo_gstate_t *gstate)
gstate->clip);
if (destroy_pattern)
cairo_pattern_destroy ((cairo_pattern_t *)pattern);
-
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1115,6 +1131,7 @@ cairo_status_t
_cairo_gstate_mask (cairo_gstate_t *gstate,
cairo_pattern_t *mask)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_pattern_union_t source_pattern, mask_pattern;
const cairo_pattern_t *source;
cairo_operator_t op;
@@ -1122,12 +1139,16 @@ _cairo_gstate_mask (cairo_gstate_t *gstate,
cairo_bool_t destroy_pattern = FALSE;
status = _cairo_gstate_get_pattern_status (mask);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _cairo_gstate_get_pattern_status (gstate->source);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (gstate->source->filter == CAIRO_FILTER_GAUSSIAN)
status = _cairo_pattern_create_gaussian_matrix (gstate->source, 1024);
@@ -1135,20 +1156,27 @@ _cairo_gstate_mask (cairo_gstate_t *gstate,
if (mask->filter == CAIRO_FILTER_GAUSSIAN)
status = _cairo_pattern_create_gaussian_matrix (mask, 1024);
- if (gstate->op == CAIRO_OPERATOR_DEST)
+ if (gstate->op == CAIRO_OPERATOR_DEST) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
- if (_cairo_clip_is_all_clipped (gstate->clip))
+ if (_cairo_clip_is_all_clipped (gstate->clip)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
assert (gstate->opacity == 1.0);
- if (_cairo_pattern_is_opaque (mask, NULL))
+ if (_cairo_pattern_is_opaque (mask, NULL)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_gstate_paint (gstate);
+ }
if (_cairo_pattern_is_clear (mask) &&
_cairo_operator_bounded_by_mask (gstate->op))
{
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
@@ -1209,12 +1237,14 @@ _cairo_gstate_mask (cairo_gstate_t *gstate,
if (destroy_pattern)
cairo_pattern_destroy ((cairo_pattern_t *)source);
+ CAIRO_TRACE_END (__func__);
return status;
}
cairo_status_t
_cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_pattern_union_t source_pattern;
cairo_stroke_style_t style;
double dash[2];
@@ -1223,21 +1253,29 @@ _cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
cairo_matrix_t aggregate_transform_inverse;
status = _cairo_gstate_get_pattern_status (gstate->source);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (gstate->source->filter == CAIRO_FILTER_GAUSSIAN)
status = _cairo_pattern_create_gaussian_matrix (gstate->source,
gstate->stroke_style.line_width);
- if (gstate->op == CAIRO_OPERATOR_DEST)
+ if (gstate->op == CAIRO_OPERATOR_DEST) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
- if (gstate->stroke_style.line_width <= 0.0)
+ if (gstate->stroke_style.line_width <= 0.0) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
- if (_cairo_clip_is_all_clipped (gstate->clip))
+ if (_cairo_clip_is_all_clipped (gstate->clip)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
assert (gstate->opacity == 1.0);
@@ -1263,7 +1301,7 @@ _cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
if (_cairo_gstate_has_shadow (gstate))
source_pattern.base.shadow = gstate->shadow;
- return _cairo_surface_stroke (gstate->target,
+ status = _cairo_surface_stroke (gstate->target,
gstate->op,
&source_pattern.base,
path,
@@ -1273,6 +1311,8 @@ _cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
gstate->tolerance,
gstate->antialias,
gstate->clip);
+ CAIRO_TRACE_END (__func__);
+ return status;
}
cairo_status_t
@@ -1282,6 +1322,7 @@ _cairo_gstate_in_stroke (cairo_gstate_t *gstate,
double y,
cairo_bool_t *inside_ret)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
cairo_rectangle_int_t extents;
cairo_box_t limit;
@@ -1289,6 +1330,7 @@ _cairo_gstate_in_stroke (cairo_gstate_t *gstate,
if (gstate->stroke_style.line_width <= 0.0) {
*inside_ret = FALSE;
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
@@ -1305,6 +1347,7 @@ _cairo_gstate_in_stroke (cairo_gstate_t *gstate,
y < extents.y || y > extents.y + extents.height)
{
*inside_ret = FALSE;
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
@@ -1330,34 +1373,44 @@ _cairo_gstate_in_stroke (cairo_gstate_t *gstate,
BAIL:
_cairo_traps_fini (&traps);
+ CAIRO_TRACE_END (__func__);
return status;
}
cairo_status_t
_cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
const cairo_pattern_t *pattern;
cairo_bool_t destroy_pattern = FALSE;
status = _cairo_gstate_get_pattern_status (gstate->source);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (gstate->source->filter == CAIRO_FILTER_GAUSSIAN)
status = _cairo_pattern_create_gaussian_matrix (gstate->source, 1024);
- if (gstate->op == CAIRO_OPERATOR_DEST)
+ if (gstate->op == CAIRO_OPERATOR_DEST) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
- if (_cairo_clip_is_all_clipped (gstate->clip))
+ if (_cairo_clip_is_all_clipped (gstate->clip)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
assert (gstate->opacity == 1.0);
if (_cairo_path_fixed_fill_is_empty (path)) {
- if (_cairo_operator_bounded_by_mask (gstate->op))
+ if (_cairo_operator_bounded_by_mask (gstate->op)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
pattern = &_cairo_pattern_clear.base;
status = _cairo_surface_paint (gstate->target,
@@ -1373,7 +1426,7 @@ _cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
op = _reduce_op (gstate);
/* FIXME: I don't like this */
if (op == CAIRO_OPERATOR_CLEAR) {
- if (_cairo_gstate_has_shadow (gstate))
+ if (_cairo_gstate_has_shadow (gstate))
pattern = &_cairo_pattern_clear.base;
else {
pattern = cairo_pattern_create_rgba (0, 0, 0, 0);
@@ -1414,6 +1467,7 @@ _cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
if (destroy_pattern)
cairo_pattern_destroy ((cairo_pattern_t *)pattern);
+ CAIRO_TRACE_END (__func__);
return status;
}
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 1948a1add..a399a81be 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -56,6 +56,7 @@
#include "cairo-surface-subsurface-private.h"
#include "cairo-surface-shadow-private.h"
#include "cairo-list-inline.h"
+#include "cairo-ttrace.h"
/* Limit on the width / height of an image surface in pixels. This is
* mainly determined by coordinates of things sent to pixman at the
@@ -124,7 +125,7 @@ _cairo_image_shadow_caches_destroy (void)
cairo_surface_destroy (shadow->surface);
free (shadow);
}
- shadow_caches_size = 0;
+ shadow_caches_size = 0;
}
}
@@ -274,6 +275,7 @@ _cairo_image_surface_init (cairo_image_surface_t *surface,
pixman_image_t *pixman_image,
pixman_format_code_t pixman_format)
{
+ CAIRO_TRACE_BEGIN (__func__);
surface->parent = NULL;
surface->pixman_image = pixman_image;
@@ -294,17 +296,21 @@ _cairo_image_surface_init (cairo_image_surface_t *surface,
surface->compositor = _cairo_image_spans_compositor_get ();
_cairo_image_shadow_caches_init ();
+ CAIRO_TRACE_END (__func__);
}
cairo_surface_t *
_cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image,
pixman_format_code_t pixman_format)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_image_surface_t *surface;
surface = malloc (sizeof (cairo_image_surface_t));
- if (unlikely (surface == NULL))
+ if (unlikely (surface == NULL)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
+ }
_cairo_surface_init (&surface->base,
&_cairo_image_surface_backend,
@@ -313,6 +319,7 @@ _cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image,
_cairo_image_surface_init (surface, pixman_image, pixman_format);
+ CAIRO_TRACE_END (__func__);
return &surface->base;
}
@@ -457,29 +464,35 @@ _cairo_image_surface_create_with_pixman_format (unsigned char *data,
int height,
int stride)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_surface_t *surface;
pixman_image_t *pixman_image;
if (! _cairo_image_surface_is_size_valid (width, height))
{
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
}
pixman_image = pixman_image_create_bits (pixman_format, width, height,
(uint32_t *) data, stride);
- if (unlikely (pixman_image == NULL))
+ if (unlikely (pixman_image == NULL)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
+ }
surface = _cairo_image_surface_create_for_pixman_image (pixman_image,
pixman_format);
if (unlikely (surface->status)) {
pixman_image_unref (pixman_image);
+ CAIRO_TRACE_END (__func__);
return surface;
}
/* we can not make any assumptions about the initial state of user data */
surface->is_clear = data == NULL;
+ CAIRO_TRACE_END (__func__);
return surface;
}
@@ -510,15 +523,21 @@ cairo_image_surface_create (cairo_format_t format,
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
pixman_format_code_t pixman_format;
+ cairo_surface_t *image_surface = NULL;
- if (! CAIRO_FORMAT_VALID (format))
+ if (! CAIRO_FORMAT_VALID (format)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
+ }
pixman_format = _cairo_format_to_pixman_format_code (format);
- return _cairo_image_surface_create_with_pixman_format (NULL, pixman_format,
+ image_surface = _cairo_image_surface_create_with_pixman_format (NULL, pixman_format,
width, height, -1);
+ CAIRO_TRACE_END (__func__);
+ return image_surface;
}
slim_hidden_def (cairo_image_surface_create);
@@ -879,6 +898,7 @@ _cairo_image_surface_create_similar (void *abstract_other,
cairo_surface_t *
_cairo_image_surface_snapshot (void *abstract_surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_image_surface_t *image = abstract_surface;
cairo_image_surface_t *clone;
@@ -887,8 +907,10 @@ _cairo_image_surface_snapshot (void *abstract_surface)
clone = (cairo_image_surface_t *)
_cairo_image_surface_create_for_pixman_image (image->pixman_image,
image->pixman_format);
- if (unlikely (clone->base.status))
+ if (unlikely (clone->base.status)) {
+ CAIRO_TRACE_END (__func__);
return &clone->base;
+ }
image->pixman_image = NULL;
image->owns_data = FALSE;
@@ -897,6 +919,7 @@ _cairo_image_surface_snapshot (void *abstract_surface)
clone->color = image->color;
clone->owns_data = TRUE;
+ CAIRO_TRACE_END (__func__);
return &clone->base;
}
@@ -906,8 +929,10 @@ _cairo_image_surface_snapshot (void *abstract_surface)
image->width,
image->height,
0);
- if (unlikely (clone->base.status))
+ if (unlikely (clone->base.status)) {
+ CAIRO_TRACE_END (__func__);
return &clone->base;
+ }
if (clone->stride == image->stride) {
memcpy (clone->data, image->data, clone->stride * clone->height);
@@ -920,6 +945,7 @@ _cairo_image_surface_snapshot (void *abstract_surface)
image->width, image->height);
}
clone->base.is_clear = FALSE;
+ CAIRO_TRACE_END (__func__);
return &clone->base;
}
@@ -927,6 +953,7 @@ cairo_image_surface_t *
_cairo_image_surface_map_to_image (void *abstract_other,
const cairo_rectangle_int_t *extents)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_image_surface_t *other = abstract_other;
cairo_surface_t *surface;
uint8_t *data;
@@ -943,6 +970,7 @@ _cairo_image_surface_map_to_image (void *abstract_other,
other->stride);
cairo_surface_set_device_offset (surface, -extents->x, -extents->y);
+ CAIRO_TRACE_END (__func__);
return (cairo_image_surface_t *) surface;
}
@@ -959,6 +987,7 @@ _cairo_image_surface_unmap_image (void *abstract_surface,
cairo_status_t
_cairo_image_surface_finish (void *abstract_surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_image_surface_t *surface = abstract_surface;
if (surface->pixman_image) {
@@ -979,6 +1008,7 @@ _cairo_image_surface_finish (void *abstract_surface)
_cairo_image_shadow_caches_destroy ();
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
@@ -1042,32 +1072,38 @@ _cairo_image_surface_paint (void *abstract_surface,
const cairo_pattern_t *source,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_image_surface_t *surface = abstract_surface;
- cairo_int_status_t status;
+ cairo_int_status_t status;
TRACE ((stderr, "%s (surface=%d)\n",
__FUNCTION__, surface->base.unique_id));
status = cairo_device_acquire (surface->base.device);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _cairo_surface_shadow_paint (abstract_surface, op, source,
clip, &source->shadow);
if (unlikely (status)) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
if (source->shadow.draw_shadow_only) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
status = _cairo_compositor_paint (surface->compositor,
&surface->base, op, source, clip);
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1078,6 +1114,7 @@ _cairo_image_surface_mask (void *abstract_surface,
const cairo_pattern_t *mask,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_image_surface_t *surface = abstract_surface;
cairo_int_status_t status;
@@ -1085,25 +1122,30 @@ _cairo_image_surface_mask (void *abstract_surface,
__FUNCTION__, surface->base.unique_id));
status = cairo_device_acquire (surface->base.device);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _cairo_surface_shadow_mask (abstract_surface, op, source,
mask, clip, &source->shadow);
if (unlikely (status)) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
if (source->shadow.draw_shadow_only) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
status = _cairo_compositor_mask (surface->compositor,
&surface->base, op, source, mask, clip);
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1119,6 +1161,7 @@ _cairo_image_surface_stroke (void *abstract_surface,
cairo_antialias_t antialias,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
cairo_image_surface_t *surface = abstract_surface;
cairo_shadow_type_t shadow_type = source->shadow.type;
@@ -1127,8 +1170,10 @@ _cairo_image_surface_stroke (void *abstract_surface,
__FUNCTION__, surface->base.unique_id));
status = cairo_device_acquire (surface->base.device);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (shadow_type != CAIRO_SHADOW_INSET)
status = _cairo_surface_shadow_stroke (abstract_surface, op, source,
@@ -1138,12 +1183,14 @@ _cairo_image_surface_stroke (void *abstract_surface,
if (unlikely (status)) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
if (shadow_type == CAIRO_SHADOW_DROP &&
source->shadow.draw_shadow_only) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1155,6 +1202,7 @@ _cairo_image_surface_stroke (void *abstract_surface,
if (unlikely (status)) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1165,6 +1213,7 @@ _cairo_image_surface_stroke (void *abstract_surface,
&source->shadow);
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1178,6 +1227,7 @@ _cairo_image_surface_fill (void *abstract_surface,
cairo_antialias_t antialias,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
cairo_image_surface_t *surface = abstract_surface;
cairo_shadow_type_t shadow_type = source->shadow.type;
@@ -1186,8 +1236,10 @@ _cairo_image_surface_fill (void *abstract_surface,
__FUNCTION__, surface->base.unique_id));
status = cairo_device_acquire (surface->base.device);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (shadow_type != CAIRO_SHADOW_INSET)
status = _cairo_surface_shadow_fill (abstract_surface, op, source,
@@ -1197,12 +1249,14 @@ _cairo_image_surface_fill (void *abstract_surface,
if (unlikely (status)) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
if (shadow_type == CAIRO_SHADOW_DROP &&
source->shadow.draw_shadow_only) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1223,6 +1277,7 @@ _cairo_image_surface_fill (void *abstract_surface,
if (unlikely (status)) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1233,6 +1288,7 @@ _cairo_image_surface_fill (void *abstract_surface,
&source->shadow);
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1245,6 +1301,7 @@ _cairo_image_surface_glyphs (void *abstract_surface,
cairo_scaled_font_t *scaled_font,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
cairo_image_surface_t *surface = abstract_surface;
cairo_shadow_type_t shadow_type = source->shadow.type;
@@ -1253,8 +1310,10 @@ _cairo_image_surface_glyphs (void *abstract_surface,
__FUNCTION__, surface->base.unique_id));
status = cairo_device_acquire (surface->base.device);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (shadow_type != CAIRO_SHADOW_INSET)
status = _cairo_surface_shadow_glyphs (abstract_surface, op, source,
@@ -1265,12 +1324,14 @@ _cairo_image_surface_glyphs (void *abstract_surface,
if (unlikely (status)) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
if (shadow_type == CAIRO_SHADOW_DROP &&
source->shadow.draw_shadow_only) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1282,6 +1343,7 @@ _cairo_image_surface_glyphs (void *abstract_surface,
if (unlikely (status)) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1293,6 +1355,7 @@ _cairo_image_surface_glyphs (void *abstract_surface,
&source->shadow);
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -1312,6 +1375,7 @@ _cairo_image_surface_shadow_surface (void *surface,
int width, int height,
int *width_out, int *height_out)
{
+ CAIRO_TRACE_BEGIN (__func__);
int shadow_width, shadow_height;
cairo_image_surface_t *shadow_surface = NULL;
@@ -1331,7 +1395,7 @@ _cairo_image_surface_shadow_surface (void *surface,
else
shadow_width = width;
}
-
+
if (height < MIN_IMAGE_SHADOW_SIZE)
shadow_height = height;
else if (has_blur) {
@@ -1355,12 +1419,14 @@ _cairo_image_surface_shadow_surface (void *surface,
shadow_height);
if (unlikely (shadow_surface->base.status)) {
cairo_surface_destroy (&shadow_surface->base);
+ CAIRO_TRACE_END (__func__);
return NULL;
}
*width_out = shadow_width;
*height_out = shadow_height;
+ CAIRO_TRACE_END (__func__);
return &shadow_surface->base;
}
@@ -1461,6 +1527,7 @@ _cairo_image_surface_create_from_image (cairo_image_surface_t *other,
int x, int y,
int width, int height, int stride)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_image_surface_t *surface = NULL;
cairo_status_t status;
pixman_image_t *image;
@@ -1500,6 +1567,7 @@ _cairo_image_surface_create_from_image (cairo_image_surface_t *other,
surface->base.is_clear = FALSE;
surface->owns_data = mem != NULL;
+ CAIRO_TRACE_END (__func__);
return surface;
cleanup_image:
@@ -1508,6 +1576,7 @@ cleanup_mem:
free (mem);
cleanup:
cairo_surface_destroy (&surface->base);
+ CAIRO_TRACE_END (__func__);
return (cairo_image_surface_t *) _cairo_surface_create_in_error (status);
}
@@ -1633,6 +1702,7 @@ cairo_image_surface_t *
_cairo_image_surface_clone_subimage (cairo_surface_t *surface,
const cairo_rectangle_int_t *extents)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_surface_t *image;
cairo_surface_pattern_t pattern;
cairo_status_t status;
@@ -1641,8 +1711,10 @@ _cairo_image_surface_clone_subimage (cairo_surface_t *surface,
_cairo_format_from_content (surface->content),
extents->width,
extents->height);
- if (image->status)
+ if (image->status) {
+ CAIRO_TRACE_END (__func__);
return to_image_surface (image);
+ }
/* TODO: check me with non-identity device_transform. Should we
* clone the scaling, too? */
@@ -1672,9 +1744,11 @@ _cairo_image_surface_clone_subimage (cairo_surface_t *surface,
_cairo_image_surface_set_parent (to_image_surface (image),
cairo_surface_reference (surface));
+ CAIRO_TRACE_END (__func__);
return to_image_surface (image);
error:
cairo_surface_destroy (image);
+ CAIRO_TRACE_END (__func__);
return to_image_surface (_cairo_surface_create_in_error (status));
}
diff --git a/src/cairo-png.c b/src/cairo-png.c
index 068617d58..9d7c5cc97 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -41,6 +41,7 @@
#include "cairo-error-private.h"
#include "cairo-image-surface-private.h"
#include "cairo-output-stream-private.h"
+#include "cairo-ttrace.h"
#include <stdio.h>
#include <errno.h>
@@ -171,6 +172,7 @@ write_png (cairo_surface_t *surface,
png_rw_ptr write_func,
void *closure)
{
+ CAIRO_TRACE_BEGIN (__func__);
int i;
cairo_int_status_t status;
cairo_image_surface_t *image;
@@ -187,10 +189,14 @@ write_png (cairo_surface_t *surface,
&image,
&image_extra);
- if (status == CAIRO_INT_STATUS_UNSUPPORTED)
+ if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
+ CAIRO_TRACE_END (__func__);
return _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
- else if (unlikely (status))
- return status;
+ }
+ else if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
+ return status;
+ }
/* PNG complains about "Image width or height is zero in IHDR" */
if (image->width == 0 || image->height == 0) {
@@ -314,6 +320,7 @@ BAIL2:
BAIL1:
_cairo_surface_release_source_image (surface, image, image_extra);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -426,17 +433,23 @@ cairo_surface_write_to_png_stream (cairo_surface_t *surface,
cairo_write_func_t write_func,
void *closure)
{
+ CAIRO_TRACE_BEGIN (__func__);
struct png_write_closure_t png_closure;
- if (surface->status)
+ if (surface->status) {
+ CAIRO_TRACE_END (__func__);
return surface->status;
+ }
- if (surface->finished)
+ if (surface->finished) {
+ CAIRO_TRACE_END (__func__);
return _cairo_error (CAIRO_STATUS_SURFACE_FINISHED);
+ }
png_closure.write_func = write_func;
png_closure.closure = closure;
+ CAIRO_TRACE_END (__func__);
return write_png (surface, stream_write_func, &png_closure);
}
slim_hidden_def (cairo_surface_write_to_png_stream);
diff --git a/src/cairo-region.c b/src/cairo-region.c
index ccfb2200e..f202c960d 100644
--- a/src/cairo-region.c
+++ b/src/cairo-region.c
@@ -40,6 +40,7 @@
#include "cairo-error-private.h"
#include "cairo-region-private.h"
+#include "cairo-ttrace.h"
/* XXX need to update pixman headers to be const as appropriate */
#define CONST_CAST (pixman_region32_t *)
@@ -194,16 +195,20 @@ _cairo_region_fini (cairo_region_t *region)
cairo_region_t *
cairo_region_create (void)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_region_t *region;
region = _cairo_malloc (sizeof (cairo_region_t));
- if (region == NULL)
+ if (region == NULL) {
+ CAIRO_TRACE_END (__func__);
return (cairo_region_t *) &_cairo_region_nil;
+ }
region->status = CAIRO_STATUS_SUCCESS;
CAIRO_REFERENCE_COUNT_INIT (&region->ref_count, 1);
pixman_region32_init (&region->rgn);
+ CAIRO_TRACE_END (__func__);
return region;
}
@@ -418,16 +423,22 @@ slim_hidden_def (cairo_region_reference);
void
cairo_region_destroy (cairo_region_t *region)
{
- if (region == NULL || CAIRO_REFERENCE_COUNT_IS_INVALID (&region->ref_count))
+ CAIRO_TRACE_BEGIN (__func__);
+ if (region == NULL || CAIRO_REFERENCE_COUNT_IS_INVALID (&region->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&region->ref_count));
- if (! _cairo_reference_count_dec_and_test (&region->ref_count))
+ if (! _cairo_reference_count_dec_and_test (&region->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
_cairo_region_fini (region);
free (region);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_region_destroy);
@@ -701,11 +712,14 @@ cairo_status_t
cairo_region_union_rectangle (cairo_region_t *dst,
const cairo_rectangle_int_t *rectangle)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status = CAIRO_STATUS_SUCCESS;
pixman_region32_t region;
- if (dst->status)
+ if (dst->status) {
+ CAIRO_TRACE_END (__func__);
return dst->status;
+ }
pixman_region32_init_rect (&region,
rectangle->x, rectangle->y,
@@ -715,6 +729,7 @@ cairo_region_union_rectangle (cairo_region_t *dst,
status = _cairo_region_set_error (dst, CAIRO_STATUS_NO_MEMORY);
pixman_region32_fini (&region);
+ CAIRO_TRACE_END (__func__);
return status;
}
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 24ad24901..2c5bcf7f7 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -50,6 +50,7 @@
#include "cairo-region-private.h"
#include "cairo-surface-inline.h"
#include "cairo-tee-surface-private.h"
+#include "cairo-ttrace.h"
/**
* SECTION:cairo-surface
@@ -490,22 +491,32 @@ cairo_surface_create_similar (cairo_surface_t *other,
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_surface_t *surface;
cairo_status_t status;
cairo_solid_pattern_t pattern;
- if (unlikely (other->status))
+ if (unlikely (other->status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (other->status);
- if (unlikely (other->finished))
+ }
+ if (unlikely (other->finished)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (CAIRO_STATUS_SURFACE_FINISHED);
- if (unlikely (width < 0 || height < 0))
+ }
+ if (unlikely (width < 0 || height < 0)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (CAIRO_STATUS_INVALID_SIZE);
+ }
- if (unlikely (! CAIRO_CONTENT_VALID (content)))
+ if (unlikely (! CAIRO_CONTENT_VALID (content))) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (CAIRO_STATUS_INVALID_CONTENT);
-
- if (unlikely (other->status))
+ }
+ if (unlikely (other->status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (other->status);
+ }
/* We inherit the device scale, so create a larger surface */
width = width * other->device_transform.xx;
@@ -519,16 +530,20 @@ cairo_surface_create_similar (cairo_surface_t *other,
_cairo_format_from_content (content),
width, height);
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return surface;
+ }
_cairo_surface_copy_similar_properties (surface, other);
cairo_surface_set_device_scale (surface,
other->device_transform.xx,
other->device_transform.yy);
- if (unlikely (surface->status))
+ if (unlikely (surface->status)){
+ CAIRO_TRACE_END (__func__);
return surface;
+ }
_cairo_pattern_init_solid (&pattern, CAIRO_COLOR_TRANSPARENT);
status = _cairo_surface_paint (surface,
@@ -541,6 +556,7 @@ cairo_surface_create_similar (cairo_surface_t *other,
assert (surface->is_clear);
+ CAIRO_TRACE_END (__func__);
return surface;
}
@@ -576,17 +592,26 @@ cairo_surface_create_similar_image (cairo_surface_t *other,
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_surface_t *image;
- if (unlikely (other->status))
+ if (unlikely (other->status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (other->status);
- if (unlikely (other->finished))
+ }
+ if (unlikely (other->finished)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (CAIRO_STATUS_SURFACE_FINISHED);
+ }
- if (unlikely (width < 0 || height < 0))
+ if (unlikely (width < 0 || height < 0)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (CAIRO_STATUS_INVALID_SIZE);
- if (unlikely (! CAIRO_FORMAT_VALID (format)))
+ }
+ if (unlikely (! CAIRO_FORMAT_VALID (format))) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (CAIRO_STATUS_INVALID_FORMAT);
+ }
image = NULL;
if (other->backend->create_similar_image)
@@ -597,6 +622,7 @@ cairo_surface_create_similar_image (cairo_surface_t *other,
assert (image->is_clear);
+ CAIRO_TRACE_END (__func__);
return image;
}
slim_hidden_def (cairo_surface_create_similar_image);
@@ -635,6 +661,7 @@ cairo_image_surface_t *
_cairo_surface_map_to_image (cairo_surface_t *surface,
const cairo_rectangle_int_t *extents)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_image_surface_t *image = NULL;
assert (extents != NULL);
@@ -646,6 +673,7 @@ _cairo_surface_map_to_image (cairo_surface_t *surface,
if (image == NULL)
image = _cairo_image_surface_clone_subimage (surface, extents);
+ CAIRO_TRACE_END (__func__);
return image;
}
@@ -674,6 +702,7 @@ cairo_int_status_t
_cairo_surface_unmap_image (cairo_surface_t *surface,
cairo_image_surface_t *image)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_surface_pattern_t pattern;
cairo_rectangle_int_t extents;
cairo_clip_t *clip;
@@ -696,8 +725,10 @@ _cairo_surface_unmap_image (cairo_surface_t *surface,
! _cairo_image_surface_is_clone (image))
{
status = surface->backend->unmap_image (surface, image);
- if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
}
_cairo_pattern_init_for_surface (&pattern, &image->base);
@@ -727,6 +758,7 @@ destroy:
cairo_surface_finish (&image->base);
cairo_surface_destroy (&image->base);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -762,19 +794,25 @@ cairo_surface_t *
cairo_surface_map_to_image (cairo_surface_t *surface,
const cairo_rectangle_int_t *extents)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_rectangle_int_t rect;
cairo_image_surface_t *image;
cairo_status_t status;
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (surface->status);
- if (unlikely (surface->finished))
+ }
+ if (unlikely (surface->finished)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (CAIRO_STATUS_SURFACE_FINISHED);
+ }
if (extents == NULL) {
- if (unlikely (! surface->backend->get_extents (surface, &rect)))
+ if (unlikely (! surface->backend->get_extents (surface, &rect))) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (CAIRO_STATUS_INVALID_SIZE);
-
+ }
extents = &rect;
} else {
cairo_rectangle_int_t surface_extents;
@@ -782,8 +820,10 @@ cairo_surface_map_to_image (cairo_surface_t *surface,
/* If this surface is bounded, we can't map parts
* that are outside of it. */
if (likely (surface->backend->get_extents (surface, &surface_extents))) {
- if (unlikely (! _cairo_rectangle_contains_rectangle (&surface_extents, extents)))
+ if (unlikely (! _cairo_rectangle_contains_rectangle (&surface_extents, extents))) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (CAIRO_STATUS_INVALID_SIZE);
+ }
}
}
@@ -792,6 +832,7 @@ cairo_surface_map_to_image (cairo_surface_t *surface,
status = image->base.status;
if (unlikely (status)) {
cairo_surface_destroy (&image->base);
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (status);
}
@@ -800,6 +841,7 @@ cairo_surface_map_to_image (cairo_surface_t *surface,
image = _cairo_image_surface_clone_subimage (surface, extents);
}
+ CAIRO_TRACE_END (__func__);
return &image->base;
}
@@ -822,6 +864,7 @@ void
cairo_surface_unmap_image (cairo_surface_t *surface,
cairo_surface_t *image)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
if (unlikely (surface->status)) {
@@ -850,12 +893,14 @@ cairo_surface_unmap_image (cairo_surface_t *surface,
if (unlikely (status))
_cairo_surface_set_error (surface, status);
+ CAIRO_TRACE_END (__func__);
return;
error:
_cairo_surface_set_error (surface, status);
cairo_surface_finish (image);
cairo_surface_destroy (image);
+ CAIRO_TRACE_END (__func__);
}
cairo_surface_t *
@@ -865,12 +910,15 @@ _cairo_surface_create_scratch (cairo_surface_t *other,
int height,
const cairo_color_t *color)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_surface_t *surface;
cairo_status_t status;
cairo_solid_pattern_t pattern;
- if (unlikely (other->status))
+ if (unlikely (other->status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (other->status);
+ }
surface = NULL;
if (other->backend->create_similar)
@@ -880,13 +928,17 @@ _cairo_surface_create_scratch (cairo_surface_t *other,
_cairo_format_from_content (content),
width, height);
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return surface;
+ }
_cairo_surface_copy_similar_properties (surface, other);
- if (unlikely (surface->status))
+ if (unlikely (surface->status)){
+ CAIRO_TRACE_END (__func__);
return surface;
+ }
if (color) {
_cairo_pattern_init_solid (&pattern, color);
@@ -900,6 +952,7 @@ _cairo_surface_create_scratch (cairo_surface_t *other,
}
}
+ CAIRO_TRACE_END (__func__);
return surface;
}
@@ -974,14 +1027,19 @@ slim_hidden_def (cairo_surface_reference);
void
cairo_surface_destroy (cairo_surface_t *surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
if (surface == NULL ||
- CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count))
+ CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count));
- if (! _cairo_reference_count_dec_and_test (&surface->ref_count))
+ if (! _cairo_reference_count_dec_and_test (&surface->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
assert (surface->snapshot_of == NULL);
@@ -990,8 +1048,10 @@ cairo_surface_destroy (cairo_surface_t *surface)
/* We may have been referenced by a snapshot prior to have
* detaching it with the copy-on-write.
*/
- if (CAIRO_REFERENCE_COUNT_GET_VALUE (&surface->ref_count))
+ if (CAIRO_REFERENCE_COUNT_GET_VALUE (&surface->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
_cairo_surface_finish (surface);
}
@@ -1011,6 +1071,7 @@ cairo_surface_destroy (cairo_surface_t *surface)
assert (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count));
free (surface);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def(cairo_surface_destroy);
@@ -1088,14 +1149,21 @@ _cairo_surface_finish (cairo_surface_t *surface)
void
cairo_surface_finish (cairo_surface_t *surface)
{
- if (surface == NULL)
+ CAIRO_TRACE_BEGIN (__func__);
+ if (surface == NULL) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
- if (CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count))
+ if (CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
- if (surface->finished)
+ if (surface->finished) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
/* We have to be careful when decoupling potential reference cycles */
cairo_surface_reference (surface);
@@ -1105,6 +1173,7 @@ cairo_surface_finish (cairo_surface_t *surface)
_cairo_surface_finish (surface);
cairo_surface_destroy (surface);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_surface_finish);
@@ -1207,6 +1276,7 @@ cairo_surface_get_mime_data (cairo_surface_t *surface,
const unsigned char **data,
unsigned long *length)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_user_data_slot_t *slots;
int i, num_slots;
@@ -1214,8 +1284,10 @@ cairo_surface_get_mime_data (cairo_surface_t *surface,
*length = 0;
/* Prevent reads of the array during teardown */
- if (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count))
+ if (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
/* The number of mime-types attached to a surface is usually small,
* typically zero. Therefore it is quicker to do a strcmp() against
@@ -1230,9 +1302,11 @@ cairo_surface_get_mime_data (cairo_surface_t *surface,
*data = mime_data->data;
*length = mime_data->length;
+ CAIRO_TRACE_END (__func__);
return;
}
}
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_surface_get_mime_data);
@@ -1370,28 +1444,41 @@ cairo_surface_set_mime_data (cairo_surface_t *surface,
cairo_destroy_func_t destroy,
void *closure)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
cairo_mime_data_t *mime_data;
- if (CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count))
+ if (CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return surface->status;
+ }
- if (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count))
+ if (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_error (CAIRO_STATUS_SURFACE_FINISHED);
+ }
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return surface->status;
- if (unlikely (surface->finished))
+ }
+ if (unlikely (surface->finished)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
+ }
status = _cairo_intern_string (&mime_type, -1);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
+ }
if (data != NULL) {
mime_data = malloc (sizeof (cairo_mime_data_t));
- if (unlikely (mime_data == NULL))
+ if (unlikely (mime_data == NULL)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_NO_MEMORY));
+ }
CAIRO_REFERENCE_COUNT_INIT (&mime_data->ref_count, 1);
@@ -1408,10 +1495,10 @@ cairo_surface_set_mime_data (cairo_surface_t *surface,
_cairo_mime_data_destroy);
if (unlikely (status)) {
free (mime_data);
-
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
}
-
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
slim_hidden_def (cairo_surface_set_mime_data);
@@ -1468,24 +1555,32 @@ cairo_status_t
_cairo_surface_copy_mime_data (cairo_surface_t *dst,
cairo_surface_t *src)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (dst->status)
+ if (dst->status) {
+ CAIRO_TRACE_END (__func__);
return dst->status;
+ }
- if (src->status)
+ if (src->status) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (dst, src->status);
+ }
/* first copy the mime-data, discarding any already set on dst */
status = _cairo_user_data_array_copy (&dst->mime_data, &src->mime_data);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (dst, status);
+ }
/* now increment the reference counters for the copies */
_cairo_user_data_array_foreach (&dst->mime_data,
_cairo_mime_data_reference,
NULL);
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
@@ -1594,17 +1689,23 @@ _cairo_surface_flush (cairo_surface_t *surface, unsigned flags)
void
cairo_surface_flush (cairo_surface_t *surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (surface->status)
+ if (surface->status) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
- if (surface->finished)
+ if (surface->finished) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = _cairo_surface_flush (surface, 0);
if (unlikely (status))
_cairo_surface_set_error (surface, status);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_surface_flush);
@@ -1988,23 +2089,31 @@ _cairo_surface_acquire_source_image (cairo_surface_t *surface,
cairo_image_surface_t **image_out,
void **image_extra)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return surface->status;
+ }
assert (!surface->finished);
- if (surface->backend->acquire_source_image == NULL)
+ if (surface->backend->acquire_source_image == NULL) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
status = surface->backend->acquire_source_image (surface,
image_out, image_extra);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
+ }
_cairo_debug_check_image_surface_is_defined (&(*image_out)->base);
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
@@ -2013,14 +2122,18 @@ _cairo_surface_default_acquire_source_image (void *_surface,
cairo_image_surface_t **image_out,
void **image_extra)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_surface_t *surface = _surface;
cairo_rectangle_int_t extents;
- if (unlikely (! surface->backend->get_extents (surface, &extents)))
+ if (unlikely (! surface->backend->get_extents (surface, &extents))) {
+ CAIRO_TRACE_END (__func__);
return _cairo_error (CAIRO_STATUS_INVALID_SIZE);
+ }
*image_out = _cairo_surface_map_to_image (surface, &extents);
*image_extra = NULL;
+ CAIRO_TRACE_END (__func__);
return (*image_out)->base.status;
}
@@ -2120,27 +2233,40 @@ _cairo_surface_paint (cairo_surface_t *surface,
const cairo_pattern_t *source,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
TRACE ((stderr, "%s\n", __FUNCTION__));
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return surface->status;
- if (unlikely (surface->finished))
+ }
+ if (unlikely (surface->finished)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
+ }
- if (_cairo_clip_is_all_clipped (clip))
+ if (_cairo_clip_is_all_clipped (clip)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
status = _pattern_has_error (source);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
- if (nothing_to_do (surface, op, source))
+ if (nothing_to_do (surface, op, source)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
status = _cairo_surface_begin_modification (surface);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = surface->backend->paint (surface, op, source, clip);
if (status != CAIRO_INT_STATUS_NOTHING_TO_DO) {
@@ -2148,6 +2274,7 @@ _cairo_surface_paint (cairo_surface_t *surface,
surface->serial++;
}
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
}
@@ -2158,38 +2285,54 @@ _cairo_surface_mask (cairo_surface_t *surface,
const cairo_pattern_t *mask,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
TRACE ((stderr, "%s\n", __FUNCTION__));
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return surface->status;
- if (unlikely (surface->finished))
+ }
+ if (unlikely (surface->finished)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
+ }
- if (_cairo_clip_is_all_clipped (clip))
+ if (_cairo_clip_is_all_clipped (clip)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
/* If the mask is blank, this is just an expensive no-op */
if (_cairo_pattern_is_clear (mask) &&
_cairo_operator_bounded_by_mask (op))
{
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
status = _pattern_has_error (source);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _pattern_has_error (mask);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
- if (nothing_to_do (surface, op, source))
+ if (nothing_to_do (surface, op, source)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
status = _cairo_surface_begin_modification (surface);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = surface->backend->mask (surface, op, source, mask, clip);
if (status != CAIRO_INT_STATUS_NOTHING_TO_DO) {
@@ -2197,6 +2340,7 @@ _cairo_surface_mask (cairo_surface_t *surface,
surface->serial++;
}
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
}
@@ -2217,35 +2361,50 @@ _cairo_surface_fill_stroke (cairo_surface_t *surface,
cairo_antialias_t stroke_antialias,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
TRACE ((stderr, "%s\n", __FUNCTION__));
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return surface->status;
- if (unlikely (surface->finished))
- return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
-
- if (_cairo_clip_is_all_clipped (clip))
- return CAIRO_STATUS_SUCCESS;
+ }
- if (surface->is_clear &&
- fill_op == CAIRO_OPERATOR_CLEAR &&
- stroke_op == CAIRO_OPERATOR_CLEAR)
- {
- return CAIRO_STATUS_SUCCESS;
- }
+ if (unlikely (surface->finished)) {
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
+ return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
+ }
+ if (_cairo_clip_is_all_clipped (clip)) {
+ CAIRO_TRACE_END (__func__);
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ if (surface->is_clear &&
+ fill_op == CAIRO_OPERATOR_CLEAR &&
+ stroke_op == CAIRO_OPERATOR_CLEAR) {
+ CAIRO_TRACE_END (__func__);
+ return CAIRO_STATUS_SUCCESS;
+ }
+ }
- status = _pattern_has_error (fill_source);
- if (unlikely (status))
+ status = _pattern_has_error (fill_source);
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _pattern_has_error (stroke_source);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _cairo_surface_begin_modification (surface);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (surface->backend->fill_stroke) {
cairo_matrix_t dev_ctm = *stroke_ctm;
@@ -2284,6 +2443,7 @@ _cairo_surface_fill_stroke (cairo_surface_t *surface,
surface->serial++;
}
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
}
@@ -2299,27 +2459,40 @@ _cairo_surface_stroke (cairo_surface_t *surface,
cairo_antialias_t antialias,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
TRACE ((stderr, "%s\n", __FUNCTION__));
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return surface->status;
- if (unlikely (surface->finished))
+ }
+ if (unlikely (surface->finished)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
+ }
- if (_cairo_clip_is_all_clipped (clip))
+ if (_cairo_clip_is_all_clipped (clip)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
status = _pattern_has_error (source);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
- if (nothing_to_do (surface, op, source))
+ if (nothing_to_do (surface, op, source)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
status = _cairo_surface_begin_modification (surface);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = surface->backend->stroke (surface, op, source,
path, stroke_style,
@@ -2331,6 +2504,7 @@ _cairo_surface_stroke (cairo_surface_t *surface,
surface->serial++;
}
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
}
@@ -2344,27 +2518,39 @@ _cairo_surface_fill (cairo_surface_t *surface,
cairo_antialias_t antialias,
const cairo_clip_t *clip)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_int_status_t status;
TRACE ((stderr, "%s\n", __FUNCTION__));
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return surface->status;
- if (unlikely (surface->finished))
+ }
+ if (unlikely (surface->finished)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
-
- if (_cairo_clip_is_all_clipped (clip))
+ }
+ if (_cairo_clip_is_all_clipped (clip)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
status = _pattern_has_error (source);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
- if (nothing_to_do (surface, op, source))
+ if (nothing_to_do (surface, op, source)) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
+ }
status = _cairo_surface_begin_modification (surface);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = surface->backend->fill (surface, op, source,
path, fill_rule,
@@ -2375,6 +2561,7 @@ _cairo_surface_fill (cairo_surface_t *surface,
surface->serial++;
}
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
}
@@ -2395,20 +2582,27 @@ _cairo_surface_fill (cairo_surface_t *surface,
void
cairo_surface_copy_page (cairo_surface_t *surface)
{
- if (unlikely (surface->status))
+ CAIRO_TRACE_BEGIN (__func__);
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
assert (surface->snapshot_of == NULL);
if (unlikely (surface->finished)) {
_cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);
+ CAIRO_TRACE_END (__func__);
return;
}
/* It's fine if some backends don't implement copy_page */
- if (surface->backend->copy_page == NULL)
+ if (surface->backend->copy_page == NULL) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
+ CAIRO_TRACE_END (__func__);
_cairo_surface_set_error (surface, surface->backend->copy_page (surface));
}
slim_hidden_def (cairo_surface_copy_page);
@@ -2428,26 +2622,34 @@ slim_hidden_def (cairo_surface_copy_page);
void
cairo_surface_show_page (cairo_surface_t *surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
if (unlikely (surface->finished)) {
_cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);
+ CAIRO_TRACE_END (__func__);
return;
}
status = _cairo_surface_begin_modification (surface);
if (unlikely (status)) {
_cairo_surface_set_error (surface, status);
+ CAIRO_TRACE_END (__func__);
return;
}
/* It's fine if some backends don't implement show_page */
- if (surface->backend->show_page == NULL)
+ if (surface->backend->show_page == NULL) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
+ CAIRO_TRACE_END (__func__);
_cairo_surface_set_error (surface, surface->backend->show_page (surface));
}
slim_hidden_def (cairo_surface_show_page);
diff --git a/src/cairo-traps-compositor.c b/src/cairo-traps-compositor.c
index c26a5df6f..8c13ca202 100644
--- a/src/cairo-traps-compositor.c
+++ b/src/cairo-traps-compositor.c
@@ -59,6 +59,7 @@
#include "cairo-spans-private.h"
#include "cairo-traps-private.h"
#include "cairo-tristrip-private.h"
+#include "cairo-ttrace.h"
typedef cairo_int_status_t
(*draw_func_t) (const cairo_traps_compositor_t *compositor,
@@ -2110,6 +2111,7 @@ static cairo_int_status_t
_cairo_traps_compositor_paint (const cairo_compositor_t *_compositor,
cairo_composite_rectangles_t *extents)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_traps_compositor_t *compositor = (cairo_traps_compositor_t*)_compositor;
cairo_boxes_t boxes;
cairo_int_status_t status;
@@ -2117,13 +2119,16 @@ _cairo_traps_compositor_paint (const cairo_compositor_t *_compositor,
TRACE ((stderr, "%s\n", __FUNCTION__));
status = compositor->check_composite (extents);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
_cairo_clip_steal_boxes (extents->clip, &boxes);
status = clip_and_composite_boxes (compositor, extents, &boxes);
_cairo_clip_unsteal_boxes (extents->clip, &boxes);
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -2131,14 +2136,17 @@ static cairo_int_status_t
_cairo_traps_compositor_mask (const cairo_compositor_t *_compositor,
cairo_composite_rectangles_t *extents)
{
+ CAIRO_TRACE_BEGIN (__func__);
const cairo_traps_compositor_t *compositor = (cairo_traps_compositor_t*)_compositor;
cairo_int_status_t status;
TRACE ((stderr, "%s\n", __FUNCTION__));
status = compositor->check_composite (extents);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
if (extents->mask_pattern.base.type == CAIRO_PATTERN_TYPE_SOLID &&
extents->clip->path == NULL) {
@@ -2157,8 +2165,10 @@ _cairo_traps_compositor_mask (const cairo_compositor_t *_compositor,
&extents->mask_sample_area,
&data.mask_x,
&data.mask_y);
- if (unlikely (data.mask->status))
+ if (unlikely (data.mask->status)) {
+ CAIRO_TRACE_END (__func__);
return data.mask->status;
+ }
status = clip_and_composite (compositor, extents,
composite_mask,
@@ -2168,6 +2178,7 @@ _cairo_traps_compositor_mask (const cairo_compositor_t *_compositor,
cairo_surface_destroy (data.mask);
}
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -2181,14 +2192,17 @@ _cairo_traps_compositor_stroke (const cairo_compositor_t *_compositor,
double tolerance,
cairo_antialias_t antialias)
{
+ CAIRO_TRACE_BEGIN (__func__);
const cairo_traps_compositor_t *compositor = (cairo_traps_compositor_t *)_compositor;
cairo_int_status_t status;
TRACE ((stderr, "%s\n", __FUNCTION__));
status = compositor->check_composite (extents);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = CAIRO_INT_STATUS_UNSUPPORTED;
if (_cairo_path_fixed_stroke_is_rectilinear (path)) {
@@ -2265,6 +2279,7 @@ _cairo_traps_compositor_stroke (const cairo_compositor_t *_compositor,
_cairo_traps_fini (&info.traps);
}
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -2276,14 +2291,17 @@ _cairo_traps_compositor_fill (const cairo_compositor_t *_compositor,
double tolerance,
cairo_antialias_t antialias)
{
+ CAIRO_TRACE_BEGIN (__func__);
const cairo_traps_compositor_t *compositor = (cairo_traps_compositor_t *)_compositor;
cairo_int_status_t status;
TRACE ((stderr, "%s\n", __FUNCTION__));
status = compositor->check_composite (extents);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = CAIRO_INT_STATUS_UNSUPPORTED;
if (_cairo_path_fixed_fill_is_rectilinear (path)) {
@@ -2332,6 +2350,7 @@ _cairo_traps_compositor_fill (const cairo_compositor_t *_compositor,
_cairo_polygon_fini (&polygon);
}
+ CAIRO_TRACE_END (__func__);
return status;
}
@@ -2367,14 +2386,17 @@ _cairo_traps_compositor_glyphs (const cairo_compositor_t *_compositor,
int num_glyphs,
cairo_bool_t overlap)
{
+ CAIRO_TRACE_BEGIN (__func__);
const cairo_traps_compositor_t *compositor = (cairo_traps_compositor_t *)_compositor;
cairo_int_status_t status;
TRACE ((stderr, "%s\n", __FUNCTION__));
status = compositor->check_composite (extents);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
_cairo_scaled_font_freeze_cache (scaled_font);
status = compositor->check_composite_glyphs (extents,
@@ -2395,6 +2417,7 @@ _cairo_traps_compositor_glyphs (const cairo_compositor_t *_compositor,
}
_cairo_scaled_font_thaw_cache (scaled_font);
+ CAIRO_TRACE_END (__func__);
return status;
}
diff --git a/src/cairo-ttrace.h b/src/cairo-ttrace.h
new file mode 100644
index 000000000..0733ba407
--- /dev/null
+++ b/src/cairo-ttrace.h
@@ -0,0 +1,47 @@
+/* Cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2009 Chris Wilson
+ * Copyright © 2014 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ */
+
+
+#ifdef CAIRO_HAS_TTRACE
+#include <ttrace.h>
+//#define CAIRO_TRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_GRAPHICS, NAME)
+//#define CAIRO_TRACE_END() traceEnd(TTRACE_TAG_GRAPHICS)
+#define CAIRO_TRACE_BEGIN(NAME) traceAsyncBegin (TTRACE_TAG_GRAPHICS, 0, NAME);
+#define CAIRO_TRACE_END(NAME) traceAsyncEnd(TTRACE_TAG_GRAPHICS, 0, NAME);
+#else
+#define CAIRO_TRACE_BEGIN(NAME)
+#define CAIRO_TRACE_END(NAME)
+#define CAIRO_TRACE_ASYNC_BEGIN(NAME, KEY)
+#define CAIRO_TRACE_ASYNC_END(NAME, KEY)
+#endif
+
+
diff --git a/src/cairo.c b/src/cairo.c
index 983f02cea..d3396400f 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -49,6 +49,7 @@
#include "cairo-surface-backend-private.h"
#include <assert.h>
+#include "cairo-ttrace.h"
/**
* SECTION:cairo
@@ -226,17 +227,28 @@ _cairo_create_in_error (cairo_status_t status)
cairo_t *
cairo_create (cairo_surface_t *target)
{
- if (unlikely (target == NULL))
+ CAIRO_TRACE_BEGIN (__func__);
+ if (unlikely (target == NULL)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_NULL_POINTER));
- if (unlikely (target->status))
+ }
+ if (unlikely (target->status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_create_in_error (target->status);
- if (unlikely (target->finished))
+ }
+ if (unlikely (target->finished)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
+ }
- if (target->backend->create_context == NULL)
+ if (target->backend->create_context == NULL) {
+ CAIRO_TRACE_END (__func__);
return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_WRITE_ERROR));
+ }
- return target->backend->create_context (target);
+ cairo_t *cr = target->backend->create_context (target);
+ CAIRO_TRACE_END (__func__);
+ return cr;
}
slim_hidden_def (cairo_create);
@@ -299,15 +311,21 @@ _cairo_fini (cairo_t *cr)
void
cairo_destroy (cairo_t *cr)
{
- if (cr == NULL || CAIRO_REFERENCE_COUNT_IS_INVALID (&cr->ref_count))
+ CAIRO_TRACE_BEGIN (__func__);
+ if (cr == NULL || CAIRO_REFERENCE_COUNT_IS_INVALID (&cr->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&cr->ref_count));
- if (! _cairo_reference_count_dec_and_test (&cr->ref_count))
+ if (! _cairo_reference_count_dec_and_test (&cr->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
cr->backend->destroy (cr);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_destroy);
@@ -404,14 +422,19 @@ cairo_get_reference_count (cairo_t *cr)
void
cairo_save (cairo_t *cr)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->save (cr);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def(cairo_save);
@@ -428,14 +451,19 @@ slim_hidden_def(cairo_save);
void
cairo_restore (cairo_t *cr)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->restore (cr);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def(cairo_restore);
@@ -675,14 +703,19 @@ cairo_set_opacity (cairo_t *cr, double opacity)
void
cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->set_source_rgba (cr, red, green, blue, 1.);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_set_source_rgb);
@@ -753,19 +786,25 @@ cairo_set_source_surface (cairo_t *cr,
double x,
double y)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
if (unlikely (surface == NULL)) {
_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
+ CAIRO_TRACE_END (__func__);
return;
}
status = cr->backend->set_source_surface (cr, surface, x, y);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_set_source_surface);
@@ -1191,14 +1230,19 @@ cairo_set_miter_limit (cairo_t *cr, double limit)
void
cairo_translate (cairo_t *cr, double tx, double ty)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->translate (cr, tx, ty);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_translate);
@@ -1218,14 +1262,19 @@ slim_hidden_def (cairo_translate);
void
cairo_scale (cairo_t *cr, double sx, double sy)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->scale (cr, sx, sy);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_scale);
@@ -1246,14 +1295,19 @@ slim_hidden_def (cairo_scale);
void
cairo_rotate (cairo_t *cr, double angle)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->rotate (cr, angle);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -1346,10 +1400,14 @@ cairo_identity_matrix (cairo_t *cr)
void
cairo_user_to_device (cairo_t *cr, double *x, double *y)
{
- if (unlikely (cr->status))
+ CAIRO_TRACE_BEGIN (__func__);
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
cr->backend->user_to_device (cr, x, y);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_user_to_device);
@@ -1369,10 +1427,14 @@ slim_hidden_def (cairo_user_to_device);
void
cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy)
{
- if (unlikely (cr->status))
+ CAIRO_TRACE_BEGIN (__func__);
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
cr->backend->user_to_device_distance (cr, dx, dy);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_user_to_device_distance);
@@ -1391,10 +1453,14 @@ slim_hidden_def (cairo_user_to_device_distance);
void
cairo_device_to_user (cairo_t *cr, double *x, double *y)
{
- if (unlikely (cr->status))
+ CAIRO_TRACE_BEGIN (__func__);
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
cr->backend->device_to_user (cr, x, y);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_device_to_user);
@@ -1626,10 +1692,13 @@ cairo_arc (cairo_t *cr,
double radius,
double angle1, double angle2)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
if (angle2 < angle1) {
/* increase angle2 by multiples of full circle until it
@@ -1642,6 +1711,8 @@ cairo_arc (cairo_t *cr,
status = cr->backend->arc (cr, xc, yc, radius, angle1, angle2, TRUE);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -1670,10 +1741,13 @@ cairo_arc_negative (cairo_t *cr,
double radius,
double angle1, double angle2)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
if (angle2 > angle1) {
/* decrease angle2 by multiples of full circle until it
@@ -1687,6 +1761,7 @@ cairo_arc_negative (cairo_t *cr,
status = cr->backend->arc (cr, xc, yc, radius, angle1, angle2, FALSE);
if (unlikely (status))
_cairo_set_error (cr, status);
+ CAIRO_TRACE_END (__func__);
}
/* XXX: NYI
@@ -1861,14 +1936,19 @@ cairo_rectangle (cairo_t *cr,
double x, double y,
double width, double height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->rectangle (cr, x, y, width, height);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -1906,16 +1986,21 @@ cairo_rounded_rectangle (cairo_t *cr,
double r_top_left, double r_top_right,
double r_bottom_left, double r_bottom_right)
{
- cairo_status_t status;
+ CAIRO_TRACE_BEGIN (__func__);
+ cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->rounded_rectangle (cr, x, y, width, height,
r_top_left, r_top_right,
r_bottom_left, r_bottom_right);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
#if 0
@@ -2041,14 +2126,19 @@ cairo_path_extents (cairo_t *cr,
void
cairo_paint (cairo_t *cr)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->paint (cr);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_paint);
@@ -2068,14 +2158,19 @@ void
cairo_paint_with_alpha (cairo_t *cr,
double alpha)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->paint_with_alpha (cr, alpha);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -2094,24 +2189,31 @@ void
cairo_mask (cairo_t *cr,
cairo_pattern_t *pattern)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
if (unlikely (pattern == NULL)) {
_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
+ CAIRO_TRACE_END (__func__);
return;
}
if (unlikely (pattern->status)) {
_cairo_set_error (cr, pattern->status);
+ CAIRO_TRACE_END (__func__);
return;
}
status = cr->backend->mask (cr, pattern);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_mask);
@@ -2135,11 +2237,14 @@ cairo_mask_surface (cairo_t *cr,
double surface_x,
double surface_y)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_pattern_t *pattern;
cairo_matrix_t matrix;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
pattern = cairo_pattern_create_for_surface (surface);
@@ -2149,6 +2254,7 @@ cairo_mask_surface (cairo_t *cr,
cairo_mask (cr, pattern);
cairo_pattern_destroy (pattern);
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -2188,14 +2294,19 @@ cairo_mask_surface (cairo_t *cr,
void
cairo_stroke (cairo_t *cr)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->stroke (cr);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def(cairo_stroke);
@@ -2217,14 +2328,19 @@ slim_hidden_def(cairo_stroke);
void
cairo_stroke_preserve (cairo_t *cr)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->stroke_preserve (cr);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def(cairo_stroke_preserve);
@@ -2243,14 +2359,19 @@ slim_hidden_def(cairo_stroke_preserve);
void
cairo_fill (cairo_t *cr)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->fill (cr);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -2269,14 +2390,19 @@ cairo_fill (cairo_t *cr)
void
cairo_fill_preserve (cairo_t *cr)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->fill_preserve (cr);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def(cairo_fill_preserve);
@@ -2436,6 +2562,7 @@ void
cairo_stroke_extents (cairo_t *cr,
double *x1, double *y1, double *x2, double *y2)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
if (unlikely (cr->status)) {
@@ -2448,12 +2575,15 @@ cairo_stroke_extents (cairo_t *cr,
if (y2)
*y2 = 0.0;
+ CAIRO_TRACE_END (__func__);
return;
}
status = cr->backend->stroke_extents (cr, x1, y1, x2, y2);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -2487,6 +2617,7 @@ void
cairo_fill_extents (cairo_t *cr,
double *x1, double *y1, double *x2, double *y2)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
if (unlikely (cr->status)) {
@@ -2499,12 +2630,15 @@ cairo_fill_extents (cairo_t *cr,
if (y2)
*y2 = 0.0;
+ CAIRO_TRACE_END (__func__);
return;
}
status = cr->backend->fill_extents (cr, x1, y1, x2, y2);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -2631,6 +2765,7 @@ cairo_clip_extents (cairo_t *cr,
double *x1, double *y1,
double *x2, double *y2)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
if (x1)
@@ -2642,12 +2777,16 @@ cairo_clip_extents (cairo_t *cr,
if (y2)
*y2 = 0.0;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->clip_extents (cr, x1, y1, x2, y2);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -3242,6 +3381,7 @@ cairo_glyph_extents (cairo_t *cr,
void
cairo_show_text (cairo_t *cr, const char *utf8)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_text_extents_t extents;
cairo_status_t status;
cairo_glyph_t *glyphs, *last_glyph;
@@ -3255,15 +3395,20 @@ cairo_show_text (cairo_t *cr, const char *utf8)
cairo_scaled_font_t *scaled_font;
cairo_glyph_text_info_t info, *i;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
- if (utf8 == NULL)
+ if (utf8 == NULL) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
scaled_font = cairo_get_scaled_font (cr);
if (unlikely (scaled_font->status)) {
_cairo_set_error (cr, scaled_font->status);
+ CAIRO_TRACE_END (__func__);
return;
}
@@ -3293,8 +3438,10 @@ cairo_show_text (cairo_t *cr, const char *utf8)
if (unlikely (status))
goto BAIL;
- if (num_glyphs == 0)
+ if (num_glyphs == 0) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
i = NULL;
if (has_show_text_glyphs) {
@@ -3327,6 +3474,8 @@ cairo_show_text (cairo_t *cr, const char *utf8)
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -3344,27 +3493,36 @@ cairo_show_text (cairo_t *cr, const char *utf8)
void
cairo_show_glyphs (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
- if (num_glyphs == 0)
+ if (num_glyphs == 0) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
if (num_glyphs < 0) {
_cairo_set_error (cr, CAIRO_STATUS_NEGATIVE_COUNT);
+ CAIRO_TRACE_END (__func__);
return;
}
if (glyphs == NULL) {
_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
+ CAIRO_TRACE_END (__func__);
return;
}
status = cr->backend->glyphs (cr, glyphs, num_glyphs, NULL);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -3411,10 +3569,13 @@ cairo_show_text_glyphs (cairo_t *cr,
int num_clusters,
cairo_text_cluster_flags_t cluster_flags)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
/* A slew of sanity checks */
@@ -3427,6 +3588,7 @@ cairo_show_text_glyphs (cairo_t *cr,
(utf8_len && utf8 == NULL) ||
(num_clusters && clusters == NULL)) {
_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
+ CAIRO_TRACE_END (__func__);
return;
}
@@ -3437,11 +3599,14 @@ cairo_show_text_glyphs (cairo_t *cr,
/* Apart from that, no negatives */
if (num_glyphs < 0 || utf8_len < 0 || num_clusters < 0) {
_cairo_set_error (cr, CAIRO_STATUS_NEGATIVE_COUNT);
+ CAIRO_TRACE_END (__func__);
return;
}
- if (num_glyphs == 0 && utf8_len == 0)
+ if (num_glyphs == 0 && utf8_len == 0) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
if (utf8) {
/* Make sure clusters cover the entire glyphs and utf8 arrays,
@@ -3474,6 +3639,8 @@ cairo_show_text_glyphs (cairo_t *cr,
}
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -3505,6 +3672,7 @@ cairo_show_text_glyphs (cairo_t *cr,
void
cairo_text_path (cairo_t *cr, const char *utf8)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
cairo_text_extents_t extents;
cairo_glyph_t stack_glyphs[CAIRO_STACK_ARRAY_LENGTH (cairo_glyph_t)];
@@ -3513,11 +3681,15 @@ cairo_text_path (cairo_t *cr, const char *utf8)
int num_glyphs;
double x, y;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
- if (utf8 == NULL)
+ if (utf8 == NULL) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
glyphs = stack_glyphs;
@@ -3526,6 +3698,7 @@ cairo_text_path (cairo_t *cr, const char *utf8)
scaled_font = cairo_get_scaled_font (cr);
if (unlikely (scaled_font->status)) {
_cairo_set_error (cr, scaled_font->status);
+ CAIRO_TRACE_END (__func__);
return;
}
@@ -3536,8 +3709,10 @@ cairo_text_path (cairo_t *cr, const char *utf8)
&glyphs, &num_glyphs,
NULL, NULL, NULL);
- if (num_glyphs == 0)
+ if (num_glyphs == 0) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
status = cr->backend->glyph_path (cr, glyphs, num_glyphs);
@@ -3560,6 +3735,8 @@ cairo_text_path (cairo_t *cr, const char *utf8)
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**
@@ -3577,27 +3754,36 @@ cairo_text_path (cairo_t *cr, const char *utf8)
void
cairo_glyph_path (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
- if (unlikely (cr->status))
+ if (unlikely (cr->status)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
- if (num_glyphs == 0)
+ if (num_glyphs == 0) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
if (unlikely (num_glyphs < 0)) {
_cairo_set_error (cr, CAIRO_STATUS_NEGATIVE_COUNT);
+ CAIRO_TRACE_END (__func__);
return;
}
if (unlikely (glyphs == NULL)) {
_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
+ CAIRO_TRACE_END (__func__);
return;
}
status = cr->backend->glyph_path (cr, glyphs, num_glyphs);
if (unlikely (status))
_cairo_set_error (cr, status);
+
+ CAIRO_TRACE_END (__func__);
}
/**