[PATCH] trace: Wrap GL surfaces
김동연 <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Adds wrappers for GL surfaces in cairo-trace.
Please review my patch and check if this suits the cairo-trace framework.
---
util/cairo-trace/trace.c | 183 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 183 insertions(+), 0 deletions(-)
mode change 100644 => 100755 util/cairo-trace/trace.c
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
old mode 100644
new mode 100755
index 0b574a1..e7dfd65
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -5187,3 +5187,186 @@ cairo_vg_surface_create_for_image (cairo_vg_context_t *context,
return ret;
}
#endif
+
+#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_GLESV2_SURFACE
+#include <cairo-gl.h>
+cairo_surface_t *
+cairo_gl_surface_create (cairo_device_t *abstract_device,
+ cairo_content_t content,
+ int width,
+ int height)
+{
+ cairo_surface_t *ret;
+
+ _enter_trace ();
+
+ ret = DLCALL (cairo_gl_surface_create, abstract_device, content, width, height);
+
+ _emit_line_info ();
+ if (_write_lock ()) {
+ Object *obj = _create_surface (ret);
+
+ _trace_printf ("dict\n"
+ " /type /gl set\n"
+ " /content //%s set\n"
+ " /width %d set\n"
+ " /height %d set\n"
+ " surface dup /s%ld exch def\n",
+ _content_to_string (content),
+ width, height,
+ obj->token);
+ obj->width = width;
+ obj->height = height;
+ obj->defined = TRUE;
+ _push_object (obj);
+ _write_unlock ();
+ }
+
+ _exit_trace ();
+ return ret;
+}
+
+cairo_surface_t *
+cairo_gl_surface_create_for_texture (cairo_device_t *abstract_device,
+ cairo_content_t content,
+ unsigned int tex,
+ int width,
+ int height)
+{
+ cairo_surface_t *ret;
+
+ _enter_trace ();
+
+ ret = DLCALL (cairo_gl_surface_create_for_texture, abstract_device, content, tex, width, height);
+
+ _emit_line_info ();
+ if (_write_lock ()) {
+ Object *obj = _create_surface (ret);
+
+ _trace_printf ("dict\n"
+ " /type /gl set\n"
+ " /content //%s set\n"
+ " /width %d set\n"
+ " /height %d set\n"
+ " surface dup /s%ld exch def\n",
+ _content_to_string (content),
+ width, height,
+ obj->token);
+ obj->width = width;
+ obj->height = height;
+ obj->defined = TRUE;
+ _push_object (obj);
+ _write_unlock ();
+ }
+
+ _exit_trace ();
+ return ret;
+}
+
+#if CAIRO_HAS_GLX_FUNCTIONS
+cairo_surface_t *
+cairo_gl_surface_create_for_window (cairo_device_t *device,
+ Window win,
+ int width, int height)
+{
+ cairo_surface_t *ret;
+
+ _enter_trace ();
+
+ ret = DLCALL (cairo_gl_surface_create_for_window, device, win, width, height);
+
+ _emit_line_info ();
+ if (_write_lock ()) {
+ Object *obj = _create_surface (ret);
+
+ _trace_printf ("dict\n"
+ " /type /gl set\n"
+ " /width %d set\n"
+ " /height %d set\n"
+ " surface dup /s%ld exch def\n",
+ width, height,
+ obj->token);
+ obj->width = width;
+ obj->height = height;
+ obj->defined = TRUE;
+ _push_object (obj);
+ _write_unlock ();
+ }
+
+ _exit_trace ();
+ return ret;
+}
+#endif
+
+#if CAIRO_HAS_WGL_FUNCTIONS
+cairo_surface_t *
+cairo_gl_surface_create_for_dc (cairo_device_t *device,
+ HDC dc,
+ int width,
+ int height)
+{
+ cairo_surface_t *ret;
+
+ _enter_trace ();
+
+ ret = DLCALL (cairo_gl_surface_create_for_dc, device, dc, width, height);
+
+ _emit_line_info ();
+ if (_write_lock ()) {
+ Object *obj = _create_surface (ret);
+
+ _trace_printf ("dict\n"
+ " /type /gl set\n"
+ " /width %d set\n"
+ " /height %d set\n"
+ " surface dup /s%ld exch def\n",
+ width, height,
+ obj->token);
+ obj->width = width;
+ obj->height = height;
+ obj->defined = TRUE;
+ _push_object (obj);
+ _write_unlock ();
+ }
+
+ _exit_trace ();
+ return ret;
+}
+#endif
+
+#if CAIRO_HAS_EGL_FUNCTIONS
+cairo_surface_t *
+cairo_gl_surface_create_for_egl (cairo_device_t *device,
+ EGLSurface egl,
+ int width,
+ int height)
+{
+ cairo_surface_t *ret;
+
+ _enter_trace ();
+
+ ret = DLCALL (cairo_gl_surface_create_for_egl, device, egl, width, height);
+
+ _emit_line_info ();
+ if (_write_lock ()) {
+ Object *obj = _create_surface (ret);
+
+ _trace_printf ("dict\n"
+ " /type /gl set\n"
+ " /width %d set\n"
+ " /height %d set\n"
+ " surface dup /s%ld exch def\n",
+ width, height,
+ obj->token);
+ obj->width = width;
+ obj->height = height;
+ obj->defined = TRUE;
+ _push_object (obj);
+ _write_unlock ();
+ }
+
+ _exit_trace ();
+ return ret;
+}
+#endif
+#endif
--
1.7.4.1
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
0001-trace-Wrap-GL-surfaces.patch
(application/octet-stream, 4.7 KB)
From 0f05f9ad408d58226a504c56219f67e026e1941b Mon Sep 17 00:00:00 2001 From: Dongyeon Kim <[email protected]> Date: Fri, 16 Mar 2012 10:31:05 +0900 Subject: [PATCH] trace: Wrap GL surfaces --- util/cairo-trace/trace.c | 183 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 183 insertions(+), 0 deletions(-) mode change 100644 => 100755 util/cairo-trace/trace.c diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c old mode 100644 new mode 100755 index 0b574a1..e7dfd65 --- a/util/cairo-trace/trace.c +++ b/util/cairo-trace/trace.c @@ -5187,3 +5187,186 @@ cairo_vg_surface_create_for_image (cairo_vg_context_t *context, return ret; } #endif + +#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_GLESV2_SURFACE +#include <cairo-gl.h> +cairo_surface_t * +cairo_gl_surface_create (cairo_device_t *abstract_device, + cairo_content_t content, + int width, + int height) +{ + cairo_surface_t *ret; + + _enter_trace (); + + ret = DLCALL (cairo_gl_surface_create, abstract_device, content, width, height); + + _emit_line_info (); + if (_write_lock ()) { + Object *obj = _create_surface (ret); + + _trace_printf ("dict\n" + " /type /gl set\n" + " /content //%s set\n" + " /width %d set\n" + " /height %d set\n" + " surface dup /s%ld exch def\n", + _content_to_string (content), + width, height, + obj->token); + obj->width = width; + obj->height = height; + obj->defined = TRUE; + _push_object (obj); + _write_unlock (); + } + + _exit_trace (); + return ret; +} + +cairo_surface_t * +cairo_gl_surface_create_for_texture (cairo_device_t *abstract_device, + cairo_content_t content, + unsigned int tex, + int width, + int height) +{ + cairo_surface_t *ret; + + _enter_trace (); + + ret = DLCALL (cairo_gl_surface_create_for_texture, abstract_device, content, tex, width, height); + + _emit_line_info (); + if (_write_lock ()) { + Object *obj = _create_surface (ret); + + _trace_printf ("dict\n" + " /type /gl set\n" + " /content //%s set\n" + " /width %d set\n" + " /height %d set\n" + " surface dup /s%ld exch def\n", + _content_to_string (content), + width, height, + obj->token); + obj->width = width; + obj->height = height; + obj->defined = TRUE; + _push_object (obj); + _write_unlock (); + } + + _exit_trace (); + return ret; +} + +#if CAIRO_HAS_GLX_FUNCTIONS +cairo_surface_t * +cairo_gl_surface_create_for_window (cairo_device_t *device, + Window win, + int width, int height) +{ + cairo_surface_t *ret; + + _enter_trace (); + + ret = DLCALL (cairo_gl_surface_create_for_window, device, win, width, height); + + _emit_line_info (); + if (_write_lock ()) { + Object *obj = _create_surface (ret); + + _trace_printf ("dict\n" + " /type /gl set\n" + " /width %d set\n" + " /height %d set\n" + " surface dup /s%ld exch def\n", + width, height, + obj->token); + obj->width = width; + obj->height = height; + obj->defined = TRUE; + _push_object (obj); + _write_unlock (); + } + + _exit_trace (); + return ret; +} +#endif + +#if CAIRO_HAS_WGL_FUNCTIONS +cairo_surface_t * +cairo_gl_surface_create_for_dc (cairo_device_t *device, + HDC dc, + int width, + int height) +{ + cairo_surface_t *ret; + + _enter_trace (); + + ret = DLCALL (cairo_gl_surface_create_for_dc, device, dc, width, height); + + _emit_line_info (); + if (_write_lock ()) { + Object *obj = _create_surface (ret); + + _trace_printf ("dict\n" + " /type /gl set\n" + " /width %d set\n" + " /height %d set\n" + " surface dup /s%ld exch def\n", + width, height, + obj->token); + obj->width = width; + obj->height = height; + obj->defined = TRUE; + _push_object (obj); + _write_unlock (); + } + + _exit_trace (); + return ret; +} +#endif + +#if CAIRO_HAS_EGL_FUNCTIONS +cairo_surface_t * +cairo_gl_surface_create_for_egl (cairo_device_t *device, + EGLSurface egl, + int width, + int height) +{ + cairo_surface_t *ret; + + _enter_trace (); + + ret = DLCALL (cairo_gl_surface_create_for_egl, device, egl, width, height); + + _emit_line_info (); + if (_write_lock ()) { + Object *obj = _create_surface (ret); + + _trace_printf ("dict\n" + " /type /gl set\n" + " /width %d set\n" + " /height %d set\n" + " surface dup /s%ld exch def\n", + width, height, + obj->token); + obj->width = width; + obj->height = height; + obj->defined = TRUE; + _push_object (obj); + _write_unlock (); + } + + _exit_trace (); + return ret; +} +#endif +#endif -- 1.7.4.1