.deps
.libs
.perf
-cairo-*.*.*
+#cairo-*.*.*
ChangeLog*
Makefile
Makefile.in
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)
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
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
echo " PDF: $use_pdf"
echo " SVG: $use_svg"
echo " OpenGL: $use_gl"
+ echo " EvasGL: $use_evasgl"
echo " OpenGL ES 2.0: $use_glesv2"
echo " OpenGL ES 3.0: $use_glesv3"
echo " BeOS: $use_beos"
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:"
dnl We also abuse the warning-flag facility to enable other compiler
dnl options. Namely, the following:
-
-dnl -flto working really needs a test link, not just a compile
-
-safe_MAYBE_WARN="$MAYBE_WARN"
-MAYBE_WARN="$MAYBE_WARN -flto"
-AC_TRY_LINK([],[
- int main(int argc, char **argv) { return 0; }
-],[],[
- MAYBE_WARN="$safe_MAYBE_WARN"
-])
-
MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common"
dnl Also to turn various gcc/glibc-specific preprocessor checks
AM_INIT_AUTOMAKE([1.11 foreign -Wall no-define no-dist-gzip dist-xz])
AM_SILENT_RULES([yes])
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) dnl Workaround for Automake 1.12
# Initialize libtool
LT_PREREQ([2.2])
[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"
+
save_LIBS="$LIBS"
AC_CHECK_LIB(lzo2, lzo2a_decompress,
[AC_CHECK_HEADER(lzo/lzo2a.h, [
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)"
* In Tizen, Cairo provides gl backend in order to do hardware-accelerated rendering.
* Since the EGL is not public supported in Tizen, Cairo Evas_GL has been provided to user interfaces instead to allow indirect access to EGL layer.
*
+ *
* Features :\n
* - Support a new cairo_device structure for interface to the underlying GL or EvasGL.\n
* - Support a new cairo_surface structure for representing GL or Evas_GL_Surface object that cairo can render to.\n
Version: 1.12.14
Release: 10
Group: System/Libraries
-License: LGPL-2.1+ or MPL-1.1
+License: MPL-1.1 or LGPL-2.1+
URL: http://www.cairographics.org
Source0: http://cairographics.org/releases/%{name}-%{version}.tar.gz
Source1001: packaging/cairo.manifest
BuildRequires: pkgconfig(xcb-render)
#BuildRequires: pkgconfig(xcb-renderutil)
BuildRequires: pkgconfig(xcb-shm)
-BuildRequires: pkgconfig(opengl-es-20)
+BuildRequires: pkgconfig(gles20)
BuildRequires: pkgconfig(ecore)
BuildRequires: pkgconfig(evas)
-BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(ttrace)
+
#BuildRequires: pkgconfig(librsvg-2.0)
BuildRequires: binutils-devel
BuildRequires: which
--x-libraries=%{_libdir} \
--disable-gtk-doc \
%ifarch %ix86
- --enable-xcb \
+ --enable-xcb\
--enable-egl=no \
--enable-glesv2=no \
- --enable-evasgl=yes \
+ --enable-evasgl=yes\
%else
--enable-xcb \
--enable-egl=yes \
--enable-glesv2=yes \
- --enable-evasgl=yes
+ --enable-evasgl=yes \
+ --enable-ttrace=no
%endif
make %{?jobs:-j%jobs}
%files
%manifest cairo.manifest
-%{_libdir}/libcairo.so.*
+%{_libdir}/libcairo.so*
+%if "%{?tizen_profile_name}" == "tv"
+%{_libdir}/libcairo-*.so.*
+%endif
/usr/share/license/%{name}
-%exclude %{_libdir}/libcairo-*.so.*
%files devel
%manifest cairo.manifest
%{_includedir}/*
-%{_libdir}/libcairo*.so
+%{_libdir}/libcairo-*.so
+%if "%{?tizen_profile_name}" == "mobile"
+%{_libdir}/libcairo-*.so.*
+%endif
+%if "%{?tizen_profile_name}" == "wearable"
%{_libdir}/libcairo-*.so.*
+%endif
%{_libdir}/pkgconfig/*
-
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)
cairo_bo_event_t **event_ptrs;
cairo_bo_start_event_t *stack_event_y[64];
cairo_bo_start_event_t **event_y = NULL;
- int i, num_events, y, ymin = 0, ymax = 0;
+ int i, num_events, y;
+ int ymin= 0;
+ int ymax= 0;
cairo_status_t status;
num_events = polygon->num_edges;
{
struct quorem qr;
long long xa = (long long)x*a;
- qr.quo = xa/b;
- qr.rem = xa%b;
+ qr.quo = (int32_t)(xa/b);
+ qr.rem = (int32_t)(xa%b);
if ((xa>=0) != (b>=0) && qr.rem) {
qr.quo--;
qr.rem += b;
HAVE_BX = 0x2,
HAVE_BOTH = HAVE_AX | HAVE_BX
} have_ax_bx = HAVE_BOTH;
- int32_t ax, bx;
+ int32_t ax = 0;
+ int32_t bx = 0;
/* XXX given we have x and dx? */
{
struct quorem qr;
long long xa = (long long)x*a;
- qr.quo = xa/b;
- qr.rem = xa%b;
+ qr.quo = (int32_t)(xa/b);
+ qr.rem = (int32_t)(xa%b);
if ((xa>=0) != (b>=0) && qr.rem) {
qr.quo -= 1;
qr.rem += b;
#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,
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;
surface,
op, source,
clip);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
do {
while (compositor->paint == NULL)
clip);
initialized = TRUE;
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
}
status = compositor->paint (compositor, &extents);
_cairo_composite_rectangles_fini (&extents);
+ CAIRO_TRACE_END (__func__);
return status;
}
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;
surface,
op, source,
mask, clip);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
do {
while (compositor->mask == NULL)
mask, clip);
initialized = TRUE;
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
}
status = compositor->mask (compositor, &extents);
_cairo_composite_rectangles_fini (&extents);
+ CAIRO_TRACE_END (__func__);
return status;
}
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)
+ 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,
op, source,
path, style,
ctm, clip);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
do {
while (compositor->stroke == NULL)
clip);
initialized = TRUE;
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
}
status = compositor->stroke (compositor, &extents,
_cairo_composite_rectangles_fini (&extents);
+ CAIRO_TRACE_END (__func__);
return status;
}
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;
surface,
op, source,
path, clip);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
do {
while (compositor->fill == NULL)
path, clip);
initialized = TRUE;
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
}
status = compositor->fill (compositor, &extents,
_cairo_composite_rectangles_fini (&extents);
+ CAIRO_TRACE_END (__func__);
return status;
}
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;
scaled_font,
glyphs, num_glyphs,
clip, &overlap);
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
do {
while (compositor->glyphs == NULL)
clip, &overlap);
initialized = TRUE;
- if (unlikely (status))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
}
status = compositor->glyphs (compositor, &extents,
_cairo_composite_rectangles_fini (&extents);
+ CAIRO_TRACE_END (__func__);
return status;
}
#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)
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);
/* 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 *
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))
+ 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);
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;
}
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
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))
+ 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);
+ CAIRO_TRACE_END (__func__);
return _cairo_create_in_error (status);
}
+ CAIRO_TRACE_END (__func__);
return &cr->base;
}
#include "cairo-device-private.h"
#include "cairo-error-private.h"
#include "cairo-list-inline.h"
+#include "cairo-ttrace.h"
/**
* SECTION:cairo-device
_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;
cairo_list_init (&device->shadow_caches);
device->shadow_caches_size = 0;
+ CAIRO_TRACE_END (__func__);
}
/**
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))
{
+ CAIRO_TRACE_END (__func__);
return;
}
assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&device->ref_count));
- if (! _cairo_reference_count_dec_and_test (&device->ref_count))
+ 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;
device->backend->destroy (device);
_cairo_user_data_array_fini (&user_data);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_device_destroy);
#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);
/* If any of the values were none, assume they are all none. Not all
drivers seem well behaved when it comes to using these values across
- multiple threads. */
+ multiple threads. (2013-3-29)*/
+ /* In case of supporting the EGL_KHR_surfaceless_context extension,
+ the below code do not fit and dummy_surface is not created. (2015-7-22)*/
+ if (ctx->dummy_surface) {
if (ctx->previous_surface == EGL_NO_SURFACE ||
ctx->previous_context == EGL_NO_CONTEXT || ctx->previous_display == EGL_NO_DISPLAY) {
ctx->previous_surface = EGL_NO_SURFACE;
ctx->previous_context = EGL_NO_CONTEXT;
ctx->previous_display = EGL_NO_DISPLAY;
+ }
}
}
if (!_context_acquisition_changed_egl_state (ctx, current_surface))
return;
- _cairo_gl_context_reset (&ctx->base);
+ /* If current context is not cairo-gl context, some problem can be occurred at gl API
+ in _cairo_gl_context_reset() when it is called before eglMakeCurrent().
+ So, _cairo_gl_context_reset() should be moved after eglMakeCurrent(). (2015-9-15)*/
+
+ //_cairo_gl_context_reset (&ctx->base);
eglMakeCurrent (ctx->display,
current_surface, current_surface, ctx->context);
+ _cairo_gl_context_reset (&ctx->base);
ctx->current_surface = current_surface;
}
_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
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[] = {
EGLint numConfigs;
ctx = calloc (1, sizeof (cairo_egl_context_t));
- if (unlikely (ctx == NULL))
+ 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;
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);
}
}
_cairo_egl_get_proc_address, NULL);
if (unlikely (status)) {
free (ctx);
+ CAIRO_TRACE_END (__func__);
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);
}
ctx->current_surface = EGL_NO_SURFACE;
+ CAIRO_TRACE_END (__func__);
return &ctx->base.base;
}
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_egl_surface_t *surface;
- if (unlikely (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)
+ 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))
+ 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;
}
#if CAIRO_HAS_DLSYM
#include <dlfcn.h>
#endif
-
#include "cairo-evas-gl.h"
+#include "cairo-ttrace.h"
typedef struct _cairo_evas_gl_context {
cairo_gl_context_t base;
{ offsetof (Evas_GL_API, glRenderbufferStorage ), "glRenderbufferStorage" },
{ offsetof (Evas_GL_API, glFramebufferRenderbuffer), "glFramebufferRenderbuffer" },
{ offsetof (Evas_GL_API, glDeleteRenderbuffers ), "glDeleteRenderbuffers" },
- /* multisampling functions, none supported in efl-1.12.0 */
+ /* multisampling functions */
+ { offsetof (Evas_GL_API, glFramebufferTexture2DMultisampleEXT ), "glFramebufferTexture2DMultisampleEXT" },
+ { offsetof (Evas_GL_API, glRenderbufferStorageMultisampleEXT ), "glRenderbufferStorageMultisampleEXT" },
+ { offsetof (Evas_GL_API, glFramebufferTexture2DMultisampleIMG ), "glFramebufferTexture2DMultisampleIMG" },
+ { offsetof (Evas_GL_API, glRenderbufferStorageMultisampleIMG ), "glRenderbufferStorageMultisampleIMG" },
{ 0, NULL }
};
if (!_context_acquisition_changed_evas_gl_state (ctx, current_surface))
return;
- _cairo_gl_context_reset (&ctx->base);
+ /* If current context is not cairo-gl context, some problem can be occurred at gl API
+ in _cairo_gl_context_reset() when it is called before eglMakeCurrent().
+ So, _cairo_gl_context_reset() should be moved after eglMakeCurrent(). (2015-9-15)*/
+
+ //_cairo_gl_context_reset (&ctx->base);
evas_gl_make_current (ctx->evas_gl, current_surface, ctx->context);
+ _cairo_gl_context_reset (&ctx->base);
ctx->current_surface = current_surface;
//ctx->base.current_target = &ctx->dummy_surface->base;
ctx->dummy_surface = evas_gl_pbuffer_surface_create (ctx->evas_gl,
evas_cfg,
1, 1, NULL);
- //evas_gl_config_free (evas_cfg);
+ evas_gl_config_free (evas_cfg);
if (ctx->dummy_surface == NULL) {
free (ctx);
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_evas_gl_surface_t *surface;
if ((! device)||(cairo_device_status(device)!= CAIRO_STATUS_SUCCESS)){
fprintf (stderr, "cairo_gl_surface_create_for_evas_gl(): cairo device is NULL or not available\n");
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error(CAIRO_STATUS_NULL_POINTER);
}
- if (unlikely (device->status))
+ if (unlikely (device->status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (device->status);
+ }
if (! evas_surface || ! evas_config) {
fprintf (stderr, "cairo_gl_surface_create_for_evas_gl(): evas_surface or evas_config is NULL\n");
- return _cairo_surface_create_in_error (CAIRO_STATUS_NULL_POINTER);
+ CAIRO_TRACE_END (__func__);
+ return _cairo_surface_create_in_error (CAIRO_STATUS_NULL_POINTER);
}
- if (device->backend->type != CAIRO_DEVICE_TYPE_GL)
+ 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_evas_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));
+ }
_cairo_gl_surface_init (device, &surface->base,
CAIRO_CONTENT_COLOR_ALPHA, width, height);
surface->surface = evas_surface;
+ CAIRO_TRACE_END (__func__);
return &surface->base.base;
}
*
* @param[in] abstract_surface The given cairo_surface_t object
*
- * @return the surface width or NULL on failure
+ * @return the surface width or 0 on failure
* The error value on failure can be retrieved with cairo_status().
*/
*
* @param[in] abstract_surface The given cairo_surface_t object
*
- * @return the surface height or NULL on failure
+ * @return the surface height or 0 on failure
* The error value on failure can be retrieved with cairo_status().
*/
dest = data;
for (i = height; i; i--) {
memcpy (dest, source, bitmap->pitch);
- memset (dest + bitmap->pitch, '\0', stride - bitmap->pitch);
+ memset (dest + bitmap->pitch,'\0', stride-bitmap->pitch);
source += bitmap->pitch;
dest += stride;
assert (own_buffer != 0);
assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY);
- data = bitmap->buffer;
- stride = bitmap->pitch;
- format = CAIRO_FORMAT_ARGB32;
+ data = bitmap->buffer;
+ stride = bitmap->pitch;
+ format = CAIRO_FORMAT_ARGB32;
}
}
break;
// color font
case FT_PIXEL_MODE_BGRA:
stride = bitmap->pitch;
- if (own_buffer) {
- data = bitmap->buffer;
- } else {
- data = _cairo_malloc_ab (height, stride);
- if (!data)
+ if (own_buffer) {
+ data = bitmap->buffer;
+ } else {
+ data = _cairo_malloc_ab (height, stride);
+ if (!data)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
- memcpy (data, bitmap->buffer, stride * height);
+ memcpy (data, bitmap->buffer, stride * height);
}
- format = CAIRO_FORMAT_ARGB32;
+ format = CAIRO_FORMAT_ARGB32;
component_alpha = FALSE;
break;
case FT_PIXEL_MODE_GRAY2:
vertical_layout = TRUE;
}
- #ifdef FT_LOAD_COLOR
+ #ifdef FT_LOAD_COLOR
/*Color-glyph support */
- load_flags |= FT_LOAD_COLOR;
- #endif
+ load_flags |= FT_LOAD_COLOR;
+ #endif
error = FT_Load_Glyph (face,
_cairo_scaled_glyph_index(scaled_glyph),
#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,
_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))
+ if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return status;
+ }
setup->dst->content_cleared = FALSE;
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);
ctx->dispatch.DrawElements (GL_TRIANGLE_STRIP, _cairo_array_num_elements (indices), GL_UNSIGNED_SHORT, 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);
ctx->dispatch.DrawElements (type, _cairo_array_num_elements (indices), GL_UNSIGNED_SHORT, 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 {
_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);
+ CAIRO_TRACE_END (__func__);
return;
}
_enable_scissor_buffer (ctx);
_cairo_gl_composite_draw_triangles (ctx, count);
}
+ CAIRO_TRACE_END (__func__);
}
static void
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;
+ }
count = ctx->vb_offset / ctx->vertex_size;
_cairo_gl_composite_unmap_vertex_buffer (ctx);
_cairo_gl_glyph_cache_unlock (&ctx->glyph_cache[i]);
_cairo_gl_image_cache_unlock (ctx);
+ CAIRO_TRACE_END (__func__);
}
static void
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)
+ 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;
}
#include "cairo-error-private.h"
#include "cairo-gl-private.h"
#include "cairo-rtree-private.h"
-
-#if CAIRO_HAS_EVASGL_SURFACE
-#include "cairo-evas-gl.h"
-#endif
+#include "cairo-ttrace.h"
#define MAX_MSAA_SAMPLES 4
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);
cairo_list_init (&ctx->fonts);
/* Support only GL version >= 1.3 */
- if (gl_version < CAIRO_GL_VERSION_ENCODE (1, 3))
+ 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) {
} 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") ||
}
if (is_desktop && gl_version < CAIRO_GL_VERSION_ENCODE (2, 1) &&
- ! _cairo_gl_has_extension (&ctx->dispatch, "GL_ARB_pixel_buffer_object"))
+ ! _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"))
+ 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"));
ctx->num_samples = 1;
ctx->msaa_type = CAIRO_GL_NONE_MULTISAMPLE_TO_TEXTURE;
-#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_EVASGL_SURFACE
+#if CAIRO_HAS_GL_SURFACE
if (is_desktop && ctx->has_packed_depth_stencil &&
(gl_version >= CAIRO_GL_VERSION_ENCODE (3, 0) ||
_cairo_gl_has_extension (&ctx->dispatch, "GL_ARB_framebuffer_object") ||
#endif
#if (CAIRO_HAS_GLESV2_SURFACE || CAIRO_HAS_EVASGL_SURFACE) && GL_MAX_SAMPLES_EXT
- if (is_gles && ctx->has_packed_depth_stencil &&
+ if (is_gles && ctx->has_packed_depth_stencil && ctx->num_samples <= 1 &&
_cairo_gl_has_extension (&ctx->dispatch, "GL_EXT_multisampled_render_to_texture")) {
ctx->dispatch.GetIntegerv(GL_MAX_SAMPLES_EXT, &ctx->num_samples);
- ctx->msaa_type = CAIRO_GL_EXT_MULTISAMPLE_TO_TEXTURE;
+ if (ctx->num_samples > 1)
+ ctx->msaa_type = CAIRO_GL_EXT_MULTISAMPLE_TO_TEXTURE;
}
#endif
#if (CAIRO_HAS_GLESV2_SURFACE || CAIRO_HAS_EVASGL_SURFACE) && GL_MAX_SAMPLES_IMG
- if (ctx->msaa_type == CAIRO_GL_NONE_MULTISAMPLE_TO_TEXTURE &&
+ if (ctx->num_samples == 1 &&
is_gles &&
ctx->has_packed_depth_stencil &&
_cairo_gl_has_extension (&ctx->dispatch, "GL_IMG_multisampled_render_to_texture")) {
ctx->dispatch.GetIntegerv(GL_MAX_SAMPLES_IMG, &ctx->num_samples);
- ctx->msaa_type = CAIRO_GL_IMG_MULTISAMPLE_TO_TEXTURE;
+ if (ctx->num_samples > 1)
+ ctx->msaa_type = CAIRO_GL_IMG_MULTISAMPLE_TO_TEXTURE;
}
#endif
#if (CAIRO_HAS_GLESV2_SURFACE || CAIRO_HAS_EVASGL_SURFACE) && GL_MAX_SAMPLES_ANGLE
- if (ctx->msaa_type == CAIRO_GL_NONE_MULTISAMPLE_TO_TEXTURE &&
- is_gles &&
- ctx->has_packed_depth_stencil &&
+ if (ctx->num_samples == 1 &&
+ is_gles &&
+ ctx->has_packed_depth_stencil &&
_cairo_gl_has_extension (&ctx->dispatch, "GL_ANGLE_framebuffer_blit") &&
- _cairo_gl_has_extension (&ctx->dispatch, "GL_ANGLE_framebuffer_multisample")) {
- ctx->dispatch.GetIntegerv(GL_MAX_SAMPLES_ANGLE, &ctx->num_samples);
- ctx->has_angle_multisampling = TRUE;
+ _cairo_gl_has_extension (&ctx->dispatch, "GL_ANGLE_framebuffer_multisample")) {
+ ctx->dispatch.GetIntegerv(GL_MAX_SAMPLES_ANGLE, &ctx->num_samples);
+ if (ctx->num_samples > 1)
+ ctx->has_angle_multisampling = TRUE;
}
#endif
-#if CAIRO_HAS_GLESV3_SURFACE || CAIRO_HAS_EVASGL_SURFACE
- if (ctx->msaa_type == CAIRO_GL_NONE_MULTISAMPLE_TO_TEXTURE &&
+#if CAIRO_HAS_GLESV3_SURFACE
+ if (ctx->num_samples == 1 &&
is_gles && ctx->has_packed_depth_stencil) {
ctx->dispatch.GetIntegerv(GL_MAX_SAMPLES, &ctx->num_samples);
- /* this is work around for evasgl. At this moment, if
- we still get samples == 1, it means gles2 does not have any
- support for extensions we have supported
- */
- if (gl_flavor == CAIRO_GL_FLAVOR_ES2)
- ctx->num_samples = 1;
}
#endif
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->vb = malloc (CAIRO_GL_VBO_SIZE);
if (unlikely (ctx->vb == NULL)) {
_cairo_cache_fini (&ctx->gradients);
+ CAIRO_TRACE_END (__func__);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
_cairo_gl_context_reset (ctx);
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
{
/* This is necessary to properly handle the situation where both
OpenGL and OpenGLES are active and returning a sane default. */
-#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_EVASGL_SURFACE
+#if CAIRO_HAS_GL_SURFACE
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_DESKTOP)
return GL_DEPTH_STENCIL;
#endif
_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;
_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
_cairo_gl_ensure_msaa_gles_framebuffer (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface)
{
- if (ctx->has_angle_multisampling)
+ CAIRO_TRACE_BEGIN (__func__);
+ if (ctx->has_angle_multisampling) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
- if (surface->msaa_active)
+ if (surface->msaa_active) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
ctx->dispatch.FramebufferTexture2DMultisample(GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
/* From now on MSAA will always be active on this surface. */
surface->msaa_active = TRUE;
+ CAIRO_TRACE_END (__func__);
}
#endif
_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.
surface->tex,
0);
-#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_EVASGL_SURFACE
+#if CAIRO_HAS_GL_SURFACE
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_DESKTOP &&
ctx->dispatch.DrawBuffer &&
ctx->dispatch.ReadBuffer) {
"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)
+ ! ctx->has_angle_multisampling) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
assert (surface->supports_msaa);
- if (surface->msaa_fb)
+ 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
surface->msaa_rb = 0;
ctx->dispatch.DeleteRenderbuffers (1, &surface->msaa_fb);
surface->msaa_fb = 0;
+ CAIRO_TRACE_END (__func__);
return;
}
// reset cached clear colors
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)
+ if (surface->msaa_depth_stencil) {
+ CAIRO_TRACE_END (__func__);
return TRUE;
+ }
_cairo_gl_ensure_multisampling (ctx, surface);
surface->width,
surface->height);
-#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_GLESV3_SURFACE || CAIRO_HAS_EVASGL_SURFACE
+#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_GLESV3_SURFACE
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_DESKTOP ||
ctx->gl_flavor == CAIRO_GL_FLAVOR_ES3) {
dispatch->FramebufferRenderbuffer (GL_FRAMEBUFFER,
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;
}
_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);
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;
}
bind_multisample_framebuffer (cairo_gl_context_t *ctx,
cairo_gl_surface_t *surface)
{
-#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_EVASGL_SURFACE
+ CAIRO_TRACE_BEGIN (__func__);
+#if CAIRO_HAS_GL_SURFACE
cairo_bool_t stencil_test_enabled, scissor_test_enabled;
cairo_bool_t has_stencil_cache;
GLbitfield mask;
_cairo_gl_ensure_multisampling (ctx, surface);
if (surface->msaa_active) {
-#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_EVASGL_SURFACE
+#if CAIRO_HAS_GL_SURFACE
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_DESKTOP)
ctx->dispatch.Enable (GL_MULTISAMPLE);
#endif
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, surface->msaa_fb);
+ CAIRO_TRACE_END (__func__);
return;
}
_cairo_gl_composite_flush (ctx);
-#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_EVASGL_SURFACE
+#if CAIRO_HAS_GL_SURFACE
/* we must disable scissor and stencil test */
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_DESKTOP) {
- _disable_stencil_buffer (ctx);
- _disable_scissor_buffer (ctx);
+ _disable_stencil_buffer (ctx);
+ _disable_scissor_buffer (ctx);
ctx->dispatch.Enable (GL_MULTISAMPLE);
- if (has_stencil_cache)
- mask |= GL_STENCIL_BUFFER_BIT;
-
- /* The last time we drew to the surface, we were not using multisampling,
- so we need to blit from the non-multisampling framebuffer into the
- multisampling framebuffer. */
- ctx->dispatch.BindFramebuffer (GL_DRAW_FRAMEBUFFER, surface->msaa_fb);
- ctx->dispatch.BindFramebuffer (GL_READ_FRAMEBUFFER, surface->fb);
- ctx->dispatch.BlitFramebuffer (0, 0, surface->width, surface->height,
- 0, 0, surface->width, surface->height,
- mask, GL_NEAREST);
- surface->content_synced = TRUE;
+ if (has_stencil_cache)
+ mask |= GL_STENCIL_BUFFER_BIT;
+
+ /* The last time we drew to the surface, we were not using multisampling,
+ so we need to blit from the non-multisampling framebuffer into the
+ multisampling framebuffer. */
+ ctx->dispatch.BindFramebuffer (GL_DRAW_FRAMEBUFFER, surface->msaa_fb);
+ ctx->dispatch.BindFramebuffer (GL_READ_FRAMEBUFFER, surface->fb);
+ ctx->dispatch.BlitFramebuffer (0, 0, surface->width, surface->height,
+ 0, 0, surface->width, surface->height,
+ mask, GL_NEAREST);
+ surface->content_synced = TRUE;
}
#endif
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, surface->msaa_fb);
-#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_EVASGL_SURFACE
+#if CAIRO_HAS_GL_SURFACE
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_DESKTOP) {
- /* re-enable stencil and scissor test */
- if (scissor_test_enabled)
- _enable_scissor_buffer (ctx);
- if (stencil_test_enabled)
- _enable_stencil_buffer (ctx);
+ /* re-enable stencil and scissor test */
+ if (scissor_test_enabled)
+ _enable_scissor_buffer (ctx);
+ if (stencil_test_enabled)
+ _enable_stencil_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 = ctx->states_cache.stencil_test_enabled;
cairo_bool_t scissor_test_enabled = ctx->states_cache.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);
ctx->dispatch.Disable (GL_MULTISAMPLE);
#endif
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, surface->fb);
+ CAIRO_TRACE_END (__func__);
return;
}
non-multisampling framebuffer. */
#if CAIRO_HAS_GLESV2_SURFACE || CAIRO_HAS_EVASGL_SURFACE
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_ES2) {
- ctx->dispatch.BindFramebuffer (GL_DRAW_FRAMEBUFFER_ANGLE, surface->fb);
- ctx->dispatch.BindFramebuffer (GL_READ_FRAMEBUFFER_ANGLE, surface->msaa_fb);
+ ctx->dispatch.BindFramebuffer (GL_DRAW_FRAMEBUFFER_ANGLE, surface->fb);
+ ctx->dispatch.BindFramebuffer (GL_READ_FRAMEBUFFER_ANGLE, surface->msaa_fb);
}
-#if CAIRO_HAS_EVASGL_SURFACE
- else {
- ctx->dispatch.BindFramebuffer (GL_DRAW_FRAMEBUFFER, surface->fb);
- ctx->dispatch.BindFramebuffer (GL_READ_FRAMEBUFFER, surface->msaa_fb);
- }
-#endif
#else
ctx->dispatch.BindFramebuffer (GL_DRAW_FRAMEBUFFER, surface->fb);
ctx->dispatch.BindFramebuffer (GL_READ_FRAMEBUFFER, surface->msaa_fb);
_enable_scissor_buffer (ctx);
if (stencil_test_enabled)
_enable_stencil_buffer (ctx);
+ CAIRO_TRACE_END (__func__);
}
void
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. */
_cairo_gl_ensure_framebuffer (ctx, surface);
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, surface->fb);
_cairo_gl_clear_framebuffer (ctx, surface);
+ CAIRO_TRACE_END (__func__);
return;
}
ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, 0);
#endif
-#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_EVASGL_SURFACE
+#if CAIRO_HAS_GL_SURFACE
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_DESKTOP) {
if (multisampling)
ctx->dispatch.Enable (GL_MULTISAMPLE);
if (ctx->gl_flavor != CAIRO_GL_FLAVOR_DESKTOP && multisampling)
_cairo_gl_clear_framebuffer (ctx, surface);
+ CAIRO_TRACE_END (__func__);
}
void
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
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;
}
_cairo_gl_context_bind_framebuffer (ctx, surface, multisampling);
if (! _cairo_gl_surface_is_texture (surface)) {
-#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_EVASGL_SURFACE
+#if CAIRO_HAS_GL_SURFACE
if (ctx->gl_flavor == CAIRO_GL_FLAVOR_DESKTOP &&
ctx->dispatch.DrawBuffer &&
ctx->dispatch.ReadBuffer) {
else
_gl_identity_ortho (ctx->modelviewprojection_matrix,
0, surface->width, surface->height, 0);
+ CAIRO_TRACE_END (__func__);
}
void
_cairo_error_throw (CAIRO_STATUS_DEVICE_TYPE_MISMATCH);
return;
}
- if(thread_aware == 0 || thread_aware == 1){
+ if(thread_aware == 0 || thread_aware == 1)
+ {
((cairo_gl_context_t *) device)->thread_aware = thread_aware;
}
- else{
+ else
+ {
_cairo_device_set_error (device, CAIRO_STATUS_INVALID_STATUS);
return;
}
void _cairo_gl_context_reset (cairo_gl_context_t *ctx)
{
+ cairo_gl_shader_t *shader = ctx->current_shader;
+ GLint current_program;
+
+ /* reset current shader, this is because if cairo shadres a same
+ * context other extern libraries or applications, the current
+ * program may well be changed, in this case, we must set cairo
+ * to use cairo program
+ */
+ if (shader) {
+ ctx->dispatch.GetIntegerv (GL_CURRENT_PROGRAM, ¤t_program);
+ if ((GLint)(ctx->current_shader->program) != current_program)
+ _cairo_gl_set_shader (ctx, shader);
+ }
+
ctx->states_cache.viewport_box.width = 0;
ctx->states_cache.viewport_box.height = 0;
ctx->states_cache.depth_mask = FALSE;
- /* FIXME: this is hack to fix mali driver*/
- ctx->dispatch.Disable (GL_DITHER);
+ /* FIXME: this is hack to fix mali driver */
+ ctx->dispatch.Disable (GL_DITHER);
- ctx->current_shader = NULL;
+ //ctx->current_shader = NULL;
}
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
#endif
+#ifndef GL_READ_FRAMEBUFFER_ANGLE
+#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
+#endif
+
+#ifndef GL_DRAW_FRAMEBUFFER_ANGLE
+#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
+#endif
+
#endif /* CAIRO_GL_EXT_DEF_PRIVATE_H */
cairo_gl_context_get_glyph_cache (cairo_gl_context_t *ctx,
cairo_format_t format,
cairo_bool_t has_component_alpha,
- cairo_gl_glyph_cache_t **cache_out)
+ cairo_gl_glyph_cache_t **cache_out)
{
cairo_gl_glyph_cache_t *cache;
cairo_content_t content;
case CAIRO_FORMAT_ARGB32:
case CAIRO_FORMAT_RGB24:
if (has_component_alpha) {
- cache = &ctx->glyph_cache[0];
+ cache = &ctx->glyph_cache[0];
} else {
cache = &ctx->glyph_cache[2];
}
content = CAIRO_CONTENT_COLOR_ALPHA;
- break;
break;
case CAIRO_FORMAT_A8:
case CAIRO_FORMAT_A1:
_cairo_gl_composite_set_source_operand (&setup, &cache->surface->operand);
*is_color_glyph = TRUE;
} else {
- _cairo_gl_composite_set_mask_operand (&setup, &cache->surface->operand);
+ _cairo_gl_composite_set_mask_operand (&setup, &cache->surface->operand);
*is_color_glyph = FALSE;
}
}
/* Create the mask if it has not yet been initialized or it was too small and deleted above. */
- if (! ctx->glyph_mask) {
+ if(!ctx->glyph_mask) {
width = MAX (width, info->extents.width);
height = MAX (height, info->extents.height);
/* XXX: For non-CA, this should be CAIRO_CONTENT_ALPHA to save memory */
}
}
else
- status = _cairo_surface_mask (&dst->base, op,
+ status = _cairo_surface_mask (&dst->base, op,
&source_pattern.base,
- &mask_pattern.base,
- clip);
+ &mask_pattern.base,
+ clip);
_cairo_clip_destroy (clip);
#include "cairo-gl.h"
-#if 0
-#if CAIRO_HAS_EVASGL_SURFACE
-#include <Evas_GL.h>
-#else
- #if CAIRO_HAS_GL_SURFACE
- #include <GL/gl.h>
- #include <GL/glext.h>
- #elif CAIRO_HAS_GLESV2_SURFACE
- #include <GLES2/gl2.h>
- #include <GLES2/gl2ext.h>
- #elif CAIRO_HAS_GLESV3_SURFACE
- #include <GLES3/gl3.h>
- #include <GLES3/gl3ext.h>
- #endif
-#endif
-#endif
-
#define CAIRO_GL_GRADIENT_CACHE_SIZE 4096
/* XXX: Declare in a better place */
ctx->dispatch.TexImage2D (ctx->tex_target, 0, internal_format,
tex_width, 1, 0,
- GL_BGRA, GL_UNSIGNED_BYTE, data);
+ GL_BGRA, GL_UNSIGNED_BYTE, data);
free (data);
#include "cairo-gl-private.h"
#include "cairo-path-private.h"
#include "cairo-traps-private.h"
+#include "cairo-ttrace.h"
static cairo_bool_t
can_use_msaa_compositor (cairo_gl_surface_t *surface,
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;
}
_cairo_gl_msaa_compositor_set_clip (cairo_composite_rectangles_t *composite,
cairo_gl_composite_t *setup)
{
+ CAIRO_TRACE_BEGIN (__func__);
uint32_t is_bounded;
/* We don't need to check CAIRO_OPERATOR_BOUND_BY_MASK in these
situations. */
is_bounded = composite->is_bounded;
composite->is_bounded = CAIRO_OPERATOR_BOUND_BY_SOURCE;
- if (_cairo_composite_rectangles_can_reduce_clip (composite, composite->clip))
+ if (_cairo_composite_rectangles_can_reduce_clip (composite, composite->clip)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
_cairo_gl_composite_set_clip (setup, composite->clip);
composite->is_bounded = is_bounded;
+ CAIRO_TRACE_END (__func__);
}
static cairo_bool_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;
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)) {
+ if (clip)
+ _cairo_traps_fini (&traps);
+ 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)) {
+ if (clip)
+ _cairo_traps_fini (&traps);
+ CAIRO_TRACE_END (__func__);
return status;
+ }
status = _cairo_gl_composite_set_source (&setup,
composite->original_mask_pattern,
&composite->mask_sample_area,
if (clip)
_cairo_traps_fini (&traps);
+ CAIRO_TRACE_END (__func__);
return status;
}
_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;
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
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);
}
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) {
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 (! 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,
if (ctx)
status = _cairo_gl_context_release (ctx, status);
+ CAIRO_TRACE_END (__func__);
return status;
}
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);
stroke_extents.height < 10) ||
(stroke_extents.height / stroke_extents.width > 10 &&
stroke_extents.width < 10)) {
+ 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_stroke (compositor, surface,
CAIRO_OPERATOR_SOURCE,
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);
if (info.ctx)
status = _cairo_gl_context_release (info.ctx, status);
+ CAIRO_TRACE_END (__func__);
return status;
}
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;
cairo_bool_t draw_path_with_traps;
cairo_rectangle_int_t fill_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_fill_is_rectilinear (path)) {
_cairo_path_fixed_approximate_fill_extents (path, &fill_extents);
fill_extents.height < 10) ||
(fill_extents.height / fill_extents.width > 10 &&
fill_extents.width < 10)) {
+ 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_fill (compositor, surface,
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);
if (draw_path_with_traps)
_cairo_traps_fini (&traps);
+ CAIRO_TRACE_END (__func__);
return status;
}
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;
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,
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);
}
finish:
cairo_surface_destroy (src);
-
+ CAIRO_TRACE_END (__func__);
return status;
}
_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->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 *
operand->texture.p2.x = (double) blur_extents.width / (double) blur_surface->width;
operand->texture.p2.y = (double) blur_extents.height / (double) blur_surface->height;
- operand->texture.p1.x += 0.5 / blur_surface->width;
- operand->texture.p1.y += 0.5 / blur_surface->height;
- operand->texture.p2.x -= 0.5 / blur_surface->width;
- operand->texture.p2.y -= 0.5 / blur_surface->height;
-
+ operand->texture.p1.x += 0.5 / blur_surface->width;
+ operand->texture.p1.y += 0.5 / blur_surface->height;
+ operand->texture.p2.x -= 0.5 / blur_surface->width;
+ operand->texture.p2.y -= 0.5 / blur_surface->height;
operand->texture.surface = blur_surface;
operand->texture.owns_surface = NULL;
operand->texture.p2.x = image_node->p2.x;
operand->texture.p2.y = image_node->p2.y;
- operand->texture.p1.x += 0.5 / ctx->image_cache->surface->width;
- operand->texture.p1.y += 0.5 / ctx->image_cache->surface->height;
- operand->texture.p2.x -= 0.5 / ctx->image_cache->surface->width;
- operand->texture.p2.y -= 0.5 / ctx->image_cache->surface->height;
-
+ operand->texture.p1.x += 0.5 / ctx->image_cache->surface->width;
+ operand->texture.p1.y += 0.5 / ctx->image_cache->surface->height;
+ operand->texture.p2.x -= 0.5 / ctx->image_cache->surface->width;
+ operand->texture.p2.y -= 0.5 / ctx->image_cache->surface->height;
cairo_matrix_multiply (&attributes->matrix,
&matrix,
operand->texture.p2.x = (double) blur_extents.width / (double) blur_surface->width;
operand->texture.p2.y = (double) blur_extents.height / (double) blur_surface->height;
- operand->texture.p1.x += 0.5 / blur_surface->width;
- operand->texture.p1.y += 0.5 / blur_surface->height;
- operand->texture.p2.x -= 0.5 / blur_surface->width;
- operand->texture.p2.y -= 0.5 / blur_surface->height;
-
+ operand->texture.p1.x += 0.5 / blur_surface->width;
+ operand->texture.p1.y += 0.5 / blur_surface->height;
+ operand->texture.p2.x -= 0.5 / blur_surface->width;
+ operand->texture.p2.y -= 0.5 / blur_surface->height;
operand->texture.surface = blur_surface;
operand->texture.owns_surface = NULL;
operand->texture.p2.x = image_node->p2.x;
operand->texture.p2.y = image_node->p2.y;
- operand->texture.p1.x += 0.5 / ctx->image_cache->surface->width;
- operand->texture.p1.y += 0.5 / ctx->image_cache->surface->height;
- operand->texture.p2.x -= 0.5 / ctx->image_cache->surface->width;
- operand->texture.p2.y -= 0.5 / ctx->image_cache->surface->height;
-
+ operand->texture.p1.x += 0.5 / ctx->image_cache->surface->width;
+ operand->texture.p1.y += 0.5 / ctx->image_cache->surface->height;
+ operand->texture.p2.x -= 0.5 / ctx->image_cache->surface->width;
+ operand->texture.p2.y -= 0.5 / ctx->image_cache->surface->height;
operand->texture.surface = ctx->image_cache->surface;
operand->texture.owns_surface = NULL;
#endif
#endif
-
#include "cairo-gl-ext-def-private.h"
#define DEBUG_GL 0
void (*ClearStencil) (GLint s);
void (*ColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
void (*DeleteTextures) (GLsizei n, const GLuint *textures);
- void (*DepthMask)(GLboolean flag);
+ void (*DepthMask) (GLboolean flag);
void (*Disable) (GLenum cap);
void (*DrawArrays) (GLenum mode, GLint first, GLsizei count);
void (*DrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
#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;
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];
shadow_height >= height) {
*width_out = width;
*height_out = height;
+ CAIRO_TRACE_END (__func__);
return cairo_surface_reference (&shadow_surface->base);
}
else {
shadow_height);
if (unlikely (shadow_surface->base.status)) {
cairo_surface_destroy (&shadow_surface->base);
+ CAIRO_TRACE_END (__func__);
return NULL;
}
*height_out *= 0.5;
}
+ CAIRO_TRACE_END (__func__);
return cairo_surface_reference (&shadow_surface->base);
}
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];
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);
mask_surface->needs_to_cache = FALSE;
mask_surface->force_no_cache = TRUE;
-
+ CAIRO_TRACE_END (__func__);
return cairo_surface_reference (&mask_surface->base);
}
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];
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);
shadow_surface->needs_to_cache = FALSE;
shadow_surface->force_no_cache = TRUE;
+ CAIRO_TRACE_END (__func__);
return cairo_surface_reference (&shadow_surface->base);
}
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];
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);
mask_surface->needs_to_cache = FALSE;
mask_surface->force_no_cache = TRUE;
+ CAIRO_TRACE_END (__func__);
return cairo_surface_reference (&mask_surface->base);
}
cairo_content_t content,
int width, int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
assert (width > 0 && height > 0);
_cairo_surface_init (&surface->base,
surface->content_cleared = FALSE;
_cairo_gl_surface_embedded_operand_init (surface);
+ CAIRO_TRACE_END (__func__);
}
static cairo_surface_t *
int height,
cairo_bool_t set_tex_param)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_surface_t *surface;
assert (width <= ctx->max_framebuffer_size && height <= ctx->max_framebuffer_size);
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);
ctx->dispatch.TexParameteri (ctx->tex_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
+ CAIRO_TRACE_END (__func__);
return &surface->base;
}
int height,
cairo_bool_t for_caching)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_surface_t *surface;
GLenum format;
GLuint tex;
surface = (cairo_gl_surface_t *)
_cairo_gl_surface_create_scratch_for_texture (ctx, content,
tex, width, height, FALSE);
- if (unlikely (surface->base.status))
+ if (unlikely (surface->base.status)) {
+ CAIRO_TRACE_END (__func__);
return &surface->base;
+ }
surface->owns_tex = TRUE;
ctx->dispatch.TexImage2D (ctx->tex_target, 0, format,
width, height, 0,
- format, GL_UNSIGNED_BYTE, NULL);
+ format, GL_UNSIGNED_BYTE, NULL);
+ CAIRO_TRACE_END (__func__);
return &surface->base;
}
_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);
}
/* optimize for mobile gl driver with deferred rendering */
- if (surface->clip_on_stencil_buffer ||
- ctx->gl_flavor == CAIRO_GL_FLAVOR_DESKTOP)
+ // if (surface->clip_on_stencil_buffer ||
+ if( ctx->gl_flavor == CAIRO_GL_FLAVOR_DESKTOP){
ctx->dispatch.Clear (GL_COLOR_BUFFER_BIT);
- else {
- if (surface->clip_on_stencil_buffer) {
- _cairo_clip_destroy(surface->clip_on_stencil_buffer);
- surface->clip_on_stencil_buffer = NULL;
- }
- ctx->dispatch.Clear (GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ //fprintf(stderr,"\n##########glClear Color### \n");
+ }else{
+ if(surface->clip_on_stencil_buffer){
+ _cairo_clip_destroy(surface->clip_on_stencil_buffer);
+ surface->clip_on_stencil_buffer = NULL;
+ }
+ ctx->dispatch.Clear (GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ //fprintf(stderr,"\n##########glClear Color, Stencil, Depth### \n");
}
-
if (a == 0)
surface->base.is_clear = TRUE;
surface->content_changed = TRUE;
surface->content_synced = FALSE;
surface->content_cleared = TRUE;
+ CAIRO_TRACE_END (__func__);
return _cairo_gl_context_release (ctx, status);
}
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;
}
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);
+ }
surface = (cairo_gl_surface_t *)
_cairo_gl_surface_create_and_clear_scratch (ctx, content, width, height);
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);
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);
+ }
surface = (cairo_gl_surface_t *)
_cairo_gl_surface_create_scratch_for_texture (ctx, content,
tex, width, height, TRUE);
status = _cairo_gl_context_release (ctx, status);
-
+ CAIRO_TRACE_END (__func__);
return &surface->base;
}
slim_hidden_def (cairo_gl_surface_create_for_texture);
void
cairo_gl_surface_swapbuffers (cairo_surface_t *abstract_surface)
{
+ CAIRO_TRACE_BEGIN (__func__);
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;
}
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);
+
/* For swapping on EGL, at least, we need a valid context/target. */
_cairo_gl_context_set_destination (ctx, surface, FALSE);
if (status)
status = _cairo_surface_set_error (abstract_surface, status);
}
+ CAIRO_TRACE_END (__func__);
}
static cairo_bool_t
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;
}
int x, int y,
int width, int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_gl_composite_t setup;
cairo_status_t status;
_cairo_gl_composite_flush (ctx);
ctx->dispatch.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ CAIRO_TRACE_END (__func__);
return status;
}
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;
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) {
ctx->dispatch.TexParameteri (ctx->tex_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
ctx->dispatch.TexParameteri (ctx->tex_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
ctx->dispatch.TexSubImage2D (ctx->tex_target, 0,
- dst_x, dst_y, width, height,
- format, type, data_start);
+ dst_x, dst_y, width, height,
+ format, type, data_start);
free (data_start_gles2);
dst->content_synced = FALSE;
}
+ CAIRO_TRACE_END (__func__);
return status;
}
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) &&
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);
}
_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;
status = _cairo_gl_context_acquire (surface->base.device, &ctx);
if (unlikely (status)) {
+ CAIRO_TRACE_END (__func__);
return _cairo_image_surface_create_in_error (status);
}
cpp = 1;
} else {
ASSERT_NOT_REACHED;
+ CAIRO_TRACE_END (__func__);
return NULL;
}
-1);
if (unlikely (image->base.status)) {
status = _cairo_gl_context_release (ctx, status);
+ CAIRO_TRACE_END (__func__);
return image;
}
* 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;
}
y = surface->height - extents->y - extents->height;
ctx->dispatch.ReadPixels (extents->x, y,
- extents->width, extents->height,
- format, type, image->data);
+ extents->width, extents->height,
+ format, type, image->data);
if (mesa_invert)
ctx->dispatch.PixelStorei (GL_PACK_INVERT_MESA, 0);
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);
}
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));
}
}
image->base.is_clear = FALSE;
+ CAIRO_TRACE_END (__func__);
return image;
}
_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,
cairo_surface_finish (&image->base);
cairo_surface_destroy (&image->base);
+ CAIRO_TRACE_END (__func__);
return status;
}
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) &&
status = _cairo_gl_surface_resolve_multisampling (surface);
- if (ctx->msaa_type != CAIRO_GL_NONE_MULTISAMPLE_TO_TEXTURE)
- ctx->dispatch.Flush ();
+// if (ctx->msaa_type != CAIRO_GL_NONE_MULTISAMPLE_TO_TEXTURE)
+// ctx->dispatch.Flush ();
+ CAIRO_TRACE_END (__func__);
return _cairo_gl_context_release (ctx, status);
}
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_TRACE_END (__func__);
return status;
}
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
-#if 0 // Currently glClear does not get flushed to GPU so do not use this fast path for the time being
+#if 1 // Currently glClear does not get flushed to GPU so do not use this fast path for the time being
/* simplify the common case of clearing the surface */
if (clip == NULL) {
+ /* workaround to solve background color issue at the initial page of CanvasPerf */
+ /*
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 &&
+ else */
+ if (source->type == CAIRO_PATTERN_TYPE_SOLID &&
(op == CAIRO_OPERATOR_SOURCE ||
(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_TRACE_END (__func__);
return status;
}
}
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
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_TRACE_END (__func__);
return status;
}
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
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,
ctx->source_scratch_in_use = FALSE;
if (unlikely (status)) {
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
source->shadow.draw_shadow_only) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
if (unlikely (status)) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
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,
ctx->source_scratch_in_use = FALSE;
if (unlikely (status)) {
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
source->shadow.draw_shadow_only) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
if (unlikely (status)) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
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,
ctx->source_scratch_in_use = FALSE;
if (unlikely (status)) {
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
source->shadow.draw_shadow_only) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
if (unlikely (status)) {
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
ctx->source_scratch_in_use = FALSE;
cairo_device_release (dst->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
if (!_context_acquisition_changed_glx_state (ctx))
return;
- _cairo_gl_context_reset (&ctx->base);
+ /* If current context is not cairo-gl context, some problem can be occurred at gl API
+ in _cairo_gl_context_reset() when it is called before eglMakeCurrent().
+ So, _cairo_gl_context_reset() should be moved after eglMakeCurrent(). (2015-9-15)*/
+
+ //_cairo_gl_context_reset (&ctx->base);
glXMakeCurrent (ctx->display, current_drawable, ctx->context);
+ _cairo_gl_context_reset (&ctx->base);
+
ctx->current_drawable = current_drawable;
}
return func_map[i].func;
}
- return glXGetProcAddress (name);
+ return glXGetProcAddress (name);
}
cairo_device_t *
#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)
_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;
/* 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;
}
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);
memset (&gstate->shadow, 0, sizeof (cairo_shadow_t));
+ CAIRO_TRACE_END (__func__);
VG (VALGRIND_MAKE_MEM_NOACCESS (gstate, sizeof (cairo_gstate_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;
}
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;
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);
gstate->clip);
if (destroy_pattern)
cairo_pattern_destroy ((cairo_pattern_t *)pattern);
-
+ CAIRO_TRACE_END (__func__);
return status;
}
_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;
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);
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;
}
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];
cairo_status_t 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,
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);
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,
gstate->tolerance,
gstate->antialias,
gstate->clip);
+ CAIRO_TRACE_END (__func__);
+ return status;
}
cairo_status_t
double y,
cairo_bool_t *inside_ret)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
cairo_rectangle_int_t extents;
cairo_box_t limit;
if (gstate->stroke_style.line_width <= 0.0) {
*inside_ret = FALSE;
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
y < extents.y || y > extents.y + extents.height)
{
*inside_ret = FALSE;
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
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,
if (destroy_pattern)
cairo_pattern_destroy ((cairo_pattern_t *)pattern);
+ CAIRO_TRACE_END (__func__);
return status;
}
if (glyph_surface->format != CAIRO_FORMAT_ARGB32 ||
pixman_image_get_component_alpha (glyph_surface->pixman_image))
- pixman_image_composite32 (_pixman_operator (op),
- ((cairo_image_source_t *)_src)->pixman_image,
- glyph_surface->pixman_image,
- to_pixman_image (_dst),
- x + src_x, y + src_y,
- 0, 0,
- x - dst_x, y - dst_y,
- glyph_surface->width,
- glyph_surface->height);
+ pixman_image_composite32 (_pixman_operator (op),
+ ((cairo_image_source_t *)_src)->pixman_image,
+ glyph_surface->pixman_image,
+ to_pixman_image (_dst),
+ x + src_x, y + src_y,
+ 0, 0,
+ x - dst_x, y - dst_y,
+ glyph_surface->width,
+ glyph_surface->height);
else /* color glyph */
pixman_image_composite32 (_pixman_operator (op),
glyph_surface->pixman_image,
glyph_surface->base.device_transform.y0);
if (glyph_surface->format != CAIRO_FORMAT_ARGB32 ||
- pixman_image_get_component_alpha (glyph_surface->pixman_image))
- pixman_image_composite32 (op, src, glyph_surface->pixman_image, dst,
+pixman_image_get_component_alpha (glyph_surface->pixman_image))
+ pixman_image_composite32 (op, src, glyph_surface->pixman_image, dst,
x + src_x, y + src_y,
0, 0,
- x - dst_x, y - dst_y,
- glyph_surface->width,
- glyph_surface->height);
+ x - dst_x, y - dst_y,
+ glyph_surface->width,
+ glyph_surface->height);
else /* Color glyph. */
- pixman_image_composite32 (op, glyph_surface->pixman_image, NULL, dst,
- 0, 0,
- x + src_x, y + src_y,
- x - dst_x, y - dst_y,
- glyph_surface->width,
- glyph_surface->height);
- }
+ pixman_image_composite32 (op, glyph_surface->pixman_image, NULL, dst,
+ 0, 0,
+ x + src_x, y + src_y,
+ x - dst_x, y - dst_y,
+ glyph_surface->width,
+ glyph_surface->height);
+ }
}
out_thaw:
0, 0,
width, height);
+ if (src_width == 0 || src_height == 0) {
+ cairo_surface_destroy (&clone_image->base);
+ clone_image = (cairo_image_surface_t *)cairo_surface_reference (src);
+ goto DONE;
+ }
+
/* paint scratch_surfaces[0] to clone */
/* set up transform matrix */
cairo_matrix_init_scale (&matrix,
#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
pixman_image_t *pixman_image,
pixman_format_code_t pixman_format)
{
+ CAIRO_TRACE_BEGIN (__func__);
surface->parent = NULL;
surface->pixman_image = pixman_image;
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,
_cairo_image_surface_init (surface, pixman_image, pixman_format);
+ CAIRO_TRACE_END (__func__);
return &surface->base;
}
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;
}
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);
pixman_format_code_t pixman_format;
int minstride;
- if (! CAIRO_FORMAT_VALID (format))
+ if (! CAIRO_FORMAT_VALID (format)) {
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
+ }
- if ((stride & (CAIRO_STRIDE_ALIGNMENT-1)) != 0)
+ if ((stride & (CAIRO_STRIDE_ALIGNMENT-1)) != 0) {
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
+ }
- if (! _cairo_image_surface_is_size_valid (width, height))
+ if (! _cairo_image_surface_is_size_valid (width, height)) {
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
+ }
minstride = cairo_format_stride_for_width (format, width);
if (stride < 0) {
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;
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;
clone->owns_data = image->owns_data;
image->owns_data = FALSE;
+ CAIRO_TRACE_END (__func__);
return &clone->base;
}
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);
image->width, image->height);
}
clone->base.is_clear = FALSE;
+ CAIRO_TRACE_END (__func__);
return &clone->base;
}
_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;
other->stride);
cairo_surface_set_device_offset (surface, -extents->x, -extents->y);
+ CAIRO_TRACE_END (__func__);
return (cairo_image_surface_t *) 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) {
_cairo_image_shadow_caches_destroy ();
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
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;
__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;
}
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;
__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;
}
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;
__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,
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;
}
if (unlikely (status)) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
&source->shadow);
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
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;
__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,
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;
}
if (unlikely (status)) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
&source->shadow);
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
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;
__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,
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;
}
if (unlikely (status)) {
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
&source->shadow);
cairo_device_release (surface->base.device);
+ CAIRO_TRACE_END (__func__);
return status;
}
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;
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;
}
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;
surface->base.is_clear = FALSE;
surface->owns_data = mem != NULL;
+ CAIRO_TRACE_END (__func__);
return surface;
cleanup_image:
free (mem);
cleanup:
cairo_surface_destroy (&surface->base);
+ CAIRO_TRACE_END (__func__);
return (cairo_image_surface_t *) _cairo_surface_create_in_error (status);
}
_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;
_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? */
_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));
}
{
struct quorem qr;
long long xa = (long long)x*a;
- qr.quo = xa/b;
- qr.rem = xa%b;
+ qr.quo = (int32_t)(xa/b);
+ qr.rem = (int32_t)(xa%b);
if ((xa>=0) != (b>=0) && qr.rem) {
qr.quo -= 1;
qr.rem += b;
cairo_pdf_source_surface_entry_t *surface_entry;
cairo_status_t status;
cairo_bool_t interpolate;
- unsigned char *unique_id;
+ unsigned char *unique_id = NULL;
unsigned long unique_id_length = 0;
cairo_image_surface_t *image;
void *image_extra;
#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>
png_rw_ptr write_func,
void *closure)
{
+ CAIRO_TRACE_BEGIN (__func__);
int i;
cairo_int_status_t status;
cairo_image_surface_t *image;
&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))
+ }
+ 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) {
BAIL1:
_cairo_surface_release_source_image (surface, image, image_extra);
+ CAIRO_TRACE_END (__func__);
return status;
}
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);
#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 *)
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 (®ion->ref_count, 1);
pixman_region32_init (®ion->rgn);
+ CAIRO_TRACE_END (__func__);
return region;
}
void
cairo_region_destroy (cairo_region_t *region)
{
- if (region == NULL || CAIRO_REFERENCE_COUNT_IS_INVALID (®ion->ref_count))
+ CAIRO_TRACE_BEGIN (__func__);
+ if (region == NULL || CAIRO_REFERENCE_COUNT_IS_INVALID (®ion->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (®ion->ref_count));
- if (! _cairo_reference_count_dec_and_test (®ion->ref_count))
+ if (! _cairo_reference_count_dec_and_test (®ion->ref_count)) {
+ CAIRO_TRACE_END (__func__);
return;
+ }
_cairo_region_fini (region);
free (region);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_region_destroy);
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 (®ion,
rectangle->x, rectangle->y,
status = _cairo_region_set_error (dst, CAIRO_STATUS_NO_MEMORY);
pixman_region32_fini (®ion);
+ CAIRO_TRACE_END (__func__);
return status;
}
BAIL:
inactive (surface);
+ if (base85_stream != NULL)
+ status = _cairo_output_stream_destroy (base85_stream);
+
return status;
}
#include "cairo-region-private.h"
#include "cairo-surface-inline.h"
#include "cairo-tee-surface-private.h"
+#include "cairo-ttrace.h"
/**
* SECTION:cairo-surface
int width,
int height)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_surface_t *surface;
- 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);
+ }
surface = _cairo_surface_create_similar_solid (other,
content, width, height,
CAIRO_COLOR_TRANSPARENT);
assert (surface->is_clear);
+ CAIRO_TRACE_END (__func__);
return surface;
}
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)
assert (image->is_clear);
+ CAIRO_TRACE_END (__func__);
return image;
}
slim_hidden_def (cairo_surface_create_similar_image);
_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);
if (image == NULL)
image = _cairo_image_surface_clone_subimage (surface, extents);
+ CAIRO_TRACE_END (__func__);
return image;
}
_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;
! _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);
cairo_surface_finish (&image->base);
cairo_surface_destroy (&image->base);
+ CAIRO_TRACE_END (__func__);
return status;
}
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 = ▭
} else {
cairo_rectangle_int_t surface_extents;
/* 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);
+ }
}
}
status = image->base.status;
if (unlikely (status)) {
cairo_surface_destroy (&image->base);
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_create_in_error (status);
}
image = _cairo_image_surface_clone_subimage (surface, extents);
}
+ CAIRO_TRACE_END (__func__);
return &image->base;
}
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)) {
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 *
int height,
const cairo_color_t *color)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
cairo_surface_t *surface;
cairo_solid_pattern_t pattern;
surface = _cairo_surface_create_similar_scratch (other, content,
width, height);
- if (unlikely (surface->status))
+ if (unlikely (surface->status)) {
+ CAIRO_TRACE_END (__func__);
return surface;
+ }
_cairo_pattern_init_solid (&pattern, color);
status = _cairo_surface_paint (surface,
surface = _cairo_surface_create_in_error (status);
}
+ CAIRO_TRACE_END (__func__);
return surface;
}
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);
/* 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);
}
assert (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count));
free (surface);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def(cairo_surface_destroy);
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);
_cairo_surface_finish (surface);
cairo_surface_destroy (surface);
+ CAIRO_TRACE_END (__func__);
}
slim_hidden_def (cairo_surface_finish);
const unsigned char **data,
unsigned long *length)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_user_data_slot_t *slots;
int i, num_slots;
*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
*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);
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);
_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;
}
_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;
}
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);
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;
}
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;
}
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 (_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) {
surface->serial++;
}
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
}
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 (_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) {
surface->serial++;
}
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
}
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 (_cairo_clip_is_all_clipped (clip))
+ 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)
- {
+ stroke_op == CAIRO_OPERATOR_CLEAR) {
+ CAIRO_TRACE_END (__func__);
return CAIRO_STATUS_SUCCESS;
}
status = _pattern_has_error (fill_source);
- if (unlikely (status))
+ 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;
surface->serial++;
}
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
}
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 (_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,
surface->serial++;
}
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
}
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 (_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,
surface->serial++;
}
+ CAIRO_TRACE_END (__func__);
return _cairo_surface_set_error (surface, status);
}
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);
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));
}
&font_options);
}
status = cairo_scaled_font_status (dev_scaled_font);
- if (unlikely (status))
+ if (unlikely (status)) {
return _cairo_surface_set_error (surface, status);
+ }
status = CAIRO_INT_STATUS_UNSUPPORTED;
{
struct quorem qr;
long long xa = (long long)x*a;
- qr.quo = xa/b;
- qr.rem = xa%b;
+ qr.quo = (int32_t)(xa/b);
+ qr.rem = (int32_t)(xa%b);
if ((xa>=0) != (b>=0) && qr.rem) {
qr.quo -= 1;
qr.rem += b;
{
struct quorem qr;
long long xa = (long long)x*a;
- qr.quo = xa/b;
- qr.rem = xa%b;
+ qr.quo = (int32_t)(xa/b);
+ qr.rem = (int32_t)(xa%b);
if ((xa>=0) != (b>=0) && qr.rem) {
qr.quo -= 1;
qr.rem += b;
#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,
extents,
antialias, &traps);
else
- status = compositor->composite_traps (mask, CAIRO_OPERATOR_IN, src,
- src_x, src_y,
- extents->x, extents->y,
- extents,
- antialias, &traps);
+ status = compositor->composite_traps (mask, CAIRO_OPERATOR_IN, src,
+ src_x, src_y,
+ extents->x, extents->y,
+ extents,
+ antialias, &traps);
_cairo_traps_extents (&traps, &box);
_cairo_box_round_to_rectangle (&box, &fixup);
&extents->bounded, NULL);
if (unlikely (status)){
if (cairo_surface_get_content (surface) == CAIRO_CONTENT_COLOR_ALPHA)
- goto error;
+ goto error;
else {
compositor->release (surface);
cairo_surface_destroy (surface);
if (mask->content == CAIRO_CONTENT_ALPHA) {
/* This is real mask */
- if (src != NULL || dst->content != CAIRO_CONTENT_ALPHA) {
- compositor->composite (dst, op, src, mask,
- extents->bounded.x + src_x,
- extents->bounded.y + src_y,
- 0, 0,
- extents->bounded.x, extents->bounded.y,
- extents->bounded.width, extents->bounded.height);
- } else {
- compositor->composite (dst, op, mask, NULL,
- 0, 0,
- 0, 0,
- extents->bounded.x, extents->bounded.y,
- extents->bounded.width, extents->bounded.height);
- }
+ if (src != NULL || dst->content != CAIRO_CONTENT_ALPHA) {
+ compositor->composite (dst, op, src, mask,
+ extents->bounded.x + src_x,
+ extents->bounded.y + src_y,
+ 0, 0,
+ extents->bounded.x, extents->bounded.y,
+ extents->bounded.width, extents->bounded.height);
+ } else {
+ compositor->composite (dst, op, mask, NULL,
+ 0, 0,
+ 0, 0,
+ extents->bounded.x, extents->bounded.y,
+ extents->bounded.width, extents->bounded.height);
+ }
} else {
compositor->composite (dst, op, mask, NULL,
0, 0,
extents->bounded.width, extents->bounded.height);
} else {
if (mask->content == CAIRO_CONTENT_ALPHA)
- compositor->lerp (dst, src, mask,
- extents->bounded.x + src_x, extents->bounded.y + src_y,
- 0, 0,
- extents->bounded.x, extents->bounded.y,
- extents->bounded.width, extents->bounded.height);
+ compositor->lerp (dst, src, mask,
+ extents->bounded.x + src_x, extents->bounded.y + src_y,
+ 0, 0,
+ extents->bounded.x, extents->bounded.y,
+ extents->bounded.width, extents->bounded.height);
else
compositor->lerp_color_glyph (dst, mask, white_mask,
0, 0,
extents->bounded.x + src_x, extents->bounded.y + src_y,
extents->bounded.x, extents->bounded.y,
extents->bounded.width, extents->bounded.height);
- }
+ }
skip:
cairo_surface_destroy (mask);
_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;
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;
}
_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) {
&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,
cairo_surface_destroy (data.mask);
}
+ CAIRO_TRACE_END (__func__);
return status;
}
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)) {
_cairo_traps_fini (&info.traps);
}
+ CAIRO_TRACE_END (__func__);
return status;
}
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)) {
_cairo_polygon_fini (&polygon);
}
+ CAIRO_TRACE_END (__func__);
return status;
}
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;
+ }
#if ! CAIRO_HAS_TG_SURFACE
_cairo_scaled_font_freeze_cache (scaled_font);
_cairo_scaled_font_thaw_cache (scaled_font);
#endif
+ CAIRO_TRACE_END (__func__);
return status;
}
--- /dev/null
+/* 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
+
+
return CAIRO_STATUS_SUCCESS;
}
+ if (composite->clip == NULL)
+ return CAIRO_STATUS_NULL_POINTER;
+
_cairo_clip_steal_boxes(composite->clip, &boxes);
status = _clip_and_composite_boxes (surface, op, source, &boxes, composite);
_cairo_clip_unsteal_boxes (composite->clip, &boxes);
cairo_xlib_shm_surface_t *shm = abstract_surface;
cairo_xlib_display_t *display;
Display *dpy;
+ _XQEvent *qev;
cairo_status_t status;
if (shm->active == 0)
while (! seqno_passed (shm->active, LastKnownRequestProcessed (dpy))) {
LockDisplay(dpy);
_XReadEvents(dpy);
+ while (dpy->head){
+ qev = dpy->head;
+ _XDeq (dpy, NULL, qev);
+ }
UnlockDisplay(dpy);
}
#include "cairo-surface-backend-private.h"
#include <assert.h>
+#include "cairo-ttrace.h"
/**
* SECTION:cairo
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 (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);
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);
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);
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);
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);
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);
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);
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);
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__);
}
/**
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);
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);
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);
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
status = cr->backend->arc (cr, xc, yc, radius, angle1, angle2, TRUE);
if (unlikely (status))
_cairo_set_error (cr, status);
+ CAIRO_TRACE_END (__func__);
}
/**
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
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
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__);
}
#if 0
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);
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__);
}
/**
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);
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);
cairo_mask (cr, pattern);
cairo_pattern_destroy (pattern);
+ CAIRO_TRACE_END (__func__);
}
/**
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);
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);
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__);
}
/**
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);
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)) {
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__);
}
/**
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)) {
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__);
}
/**
double *x1, double *y1,
double *x2, double *y2)
{
+ CAIRO_TRACE_BEGIN (__func__);
cairo_status_t status;
if (x1)
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__);
}
/**
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;
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;
}
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) {
if (unlikely (status))
_cairo_set_error (cr, status);
+ CAIRO_TRACE_END (__func__);
}
/**
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__);
}
/**
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 */
(utf8_len && utf8 == NULL) ||
(num_clusters && clusters == NULL)) {
_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
+ CAIRO_TRACE_END (__func__);
return;
}
/* 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,
}
if (unlikely (status))
_cairo_set_error (cr, status);
+ CAIRO_TRACE_END (__func__);
}
/**
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)];
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;
scaled_font = cairo_get_scaled_font (cr);
if (unlikely (scaled_font->status)) {
_cairo_set_error (cr, scaled_font->status);
+ CAIRO_TRACE_END (__func__);
return;
}
&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);
if (unlikely (status))
_cairo_set_error (cr, status);
+ CAIRO_TRACE_END (__func__);
}
/**
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__);
}
/**
endif
if CAIRO_HAS_TRACE
+#SUBDIRS += cairo-trace
if CAIRO_HAS_DLSYM
if CAIRO_HAS_SCRIPT_SURFACE
if CAIRO_HAS_TEE_SURFACE
+#SUBDIRS += cairo-fdr
endif
endif
endif
if CAIRO_HAS_DLSYM
if CAIRO_HAS_SCRIPT_SURFACE
if CAIRO_HAS_TEE_SURFACE
+#SUBDIRS += cairo-sphinx
endif
endif
endif