[cairo] [PATCH] test: Add test for egl-surface-source
Bryce Harrington
bryce at osg.samsung.com
Mon Sep 29 16:09:05 PDT 2014
On Mon, Sep 22, 2014 at 11:40:05AM +0530, RAVI NANJUNDAPPA wrote:
> hi,
>
> PFA the patch along with the reference images used for the test file.
> Please review the same.
>
> Thanks and Best Regards,
> N Ravi
>
> PS: Unicode problem with the patch is still persisting. Will fix the issue
> while sending the next patches. Please bear with the attachement of the
> patch as of now.
Thanks, looks good to me, I've applied it to trunk.
Bryce
> [0;0m>From 9539e33a638f320c47d2bc55c415c4b464793e62 Mon Sep 17 00:00:00 2001[0;0m
> [0;0mFrom: Ravi Nanjundappa <nravi.n at samsung.com>[0;0m
> [0;0mDate: Mon, 22 Sep 2014 10:19:17 +0530[0;0m
> [0;0mSubject: [PATCH] test: Add test for egl-surface-source[0;0m
> [0;0m[0;0m
> [0;0mThis test file attempts to use a EGL backend surface as a source[0;0m
> [0;0msurface for all other backends.[0;0m
> [0;0m[0;0m
> [0;0mSigned-off-by: Ravi Nanjundappa <nravi.n at samsung.com>[0;0m
> [0;32m---[0;0m
> [0;0m test/Makefile.sources | 3 +-[0;0m
> [0;0m test/egl-surface-source.c | 135 ++++++++++++++++++++[0;0m
> [0;0m test/reference/egl-surface-source.argb32.ref.png | Bin 0 -> 377 bytes[0;0m
> [0;0m .../egl-surface-source.base.argb32.ref.png | Bin 0 -> 377 bytes[0;0m
> [0;0m .../egl-surface-source.base.rgb24.ref.png | Bin 0 -> 301 bytes[0;0m
> [0;0m test/reference/egl-surface-source.image16.ref.png | Bin 0 -> 305 bytes[0;0m
> [0;0m test/reference/egl-surface-source.rgb24.ref.png | Bin 0 -> 301 bytes[0;0m
> [0;0m 7 files changed, 137 insertions(+), 1 deletion(-)[0;0m
> [0;0m create mode 100644 test/egl-surface-source.c[0;0m
> [0;0m create mode 100644 test/reference/egl-surface-source.argb32.ref.png[0;0m
> [0;0m create mode 100644 test/reference/egl-surface-source.base.argb32.ref.png[0;0m
> [0;0m create mode 100644 test/reference/egl-surface-source.base.rgb24.ref.png[0;0m
> [0;0m create mode 100644 test/reference/egl-surface-source.image16.ref.png[0;0m
> [0;0m create mode 100644 test/reference/egl-surface-source.rgb24.ref.png[0;0m
> [0;0m[0;0m
> [0;34mdiff --git a/test/Makefile.sources b/test/Makefile.sources[0;0m
> [0;0mindex 689645c..66d4a26 100644[0;0m
> [0;32m--- a/test/Makefile.sources[0;0m
> [1;32m+++ b/test/Makefile.sources[0;0m
> [1;34m@@ -402,7 +402,8 @@ gl_surface_test_sources = \[0;0m
> [0;0m gl-surface-source.c[0;0m
> [0;0m [0;0m
> [0;0m egl_surface_test_sources = \[0;0m
> [0;32m- egl-oversized-surface.c[0;0m
> [1;32m+ egl-oversized-surface.c \[0;0m
> [1;32m+ egl-surface-source.c[0;0m
> [0;0m [0;0m
> [0;0m quartz_surface_test_sources = quartz-surface-source.c[0;0m
> [0;0m [0;0m
> [0;34mdiff --git a/test/egl-surface-source.c b/test/egl-surface-source.c[0;0m
> [0;0mnew file mode 100644[0;0m
> [0;0mindex 0000000..4a84d70[0;0m
> [0;32m--- /dev/null[0;0m
> [1;32m+++ b/test/egl-surface-source.c[0;0m
> [1;34m@@ -0,0 +1,135 @@[0;0m
> [1;32m+/*[0;0m
> [1;32m+ * Copyright © 2014 Samsung Electronics[0;0m
> [1;32m+ *[0;0m
> [1;32m+ * Permission is hereby granted, free of charge, to any person[0;0m
> [1;32m+ * obtaining a copy of this software and associated documentation[0;0m
> [1;32m+ * files (the "Software"), to deal in the Software without[0;0m
> [1;32m+ * restriction, including without limitation the rights to use, copy,[0;0m
> [1;32m+ * modify, merge, publish, distribute, sublicense, and/or sell copies[0;0m
> [1;32m+ * of the Software, and to permit persons to whom the Software is[0;0m
> [1;32m+ * furnished to do so, subject to the following conditions:[0;0m
> [1;32m+ *[0;0m
> [1;32m+ * The above copyright notice and this permission notice shall be[0;0m
> [1;32m+ * included in all copies or substantial portions of the Software.[0;0m
> [1;32m+ *[0;0m
> [1;32m+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,[0;0m
> [1;32m+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF[0;0m
> [1;32m+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND[0;0m
> [1;32m+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS[0;0m
> [1;32m+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN[0;0m
> [1;32m+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN[0;0m
> [1;32m+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE[0;0m
> [1;32m+ * SOFTWARE.[0;0m
> [1;32m+ *[0;0m
> [1;32m+ * Author: Ravi Nanjundappa <nravi.n at samsung.com>[0;0m
> [1;32m+ */[0;0m
> [1;32m+[0;0m
> [1;32m+/*[0;0m
> [1;32m+ * This case tests using a EGL surface as the source[0;0m
> [1;32m+ *[0;0m
> [1;32m+ */[0;0m
> [1;32m+[0;0m
> [1;32m+#include "cairo-test.h"[0;0m
> [1;32m+#include <cairo-gl.h>[0;0m
> [1;32m+[0;0m
> [1;32m+#include "surface-source.c"[0;0m
> [1;32m+[0;0m
> [1;32m+struct closure {[0;0m
> [1;32m+ EGLDisplay dpy;[0;0m
> [1;32m+ EGLContext ctx;[0;0m
> [1;32m+};[0;0m
> [1;32m+[0;0m
> [1;32m+static void[0;0m
> [1;32m+cleanup (void *data)[0;0m
> [1;32m+{[0;0m
> [1;32m+ struct closure *arg = data;[0;0m
> [1;32m+[0;0m
> [1;32m+ eglDestroyContext (arg->dpy, arg->ctx);[0;0m
> [1;32m+ eglMakeCurrent (arg->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);[0;0m
> [1;32m+ eglTerminate (arg->dpy);[0;0m
> [1;32m+[0;0m
> [1;32m+ free (arg);[0;0m
> [1;32m+}[0;0m
> [1;32m+[0;0m
> [1;32m+static cairo_surface_t *[0;0m
> [1;32m+create_source_surface (int size)[0;0m
> [1;32m+{[0;0m
> [1;32m+ EGLint config_attribs[] = {[0;0m
> [1;32m+ EGL_RED_SIZE, 8,[0;0m
> [1;32m+ EGL_GREEN_SIZE, 8,[0;0m
> [1;32m+ EGL_BLUE_SIZE, 8,[0;0m
> [1;32m+ EGL_ALPHA_SIZE, 8,[0;0m
> [1;32m+ EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,[0;0m
> [1;32m+#if CAIRO_HAS_GL_SURFACE[0;0m
> [1;32m+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,[0;0m
> [1;32m+#elif CAIRO_HAS_GLESV2_SURFACE[0;0m
> [1;32m+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,[0;0m
> [1;32m+#endif[0;0m
> [1;32m+ EGL_NONE[0;0m
> [1;32m+ };[0;0m
> [1;32m+ const EGLint ctx_attribs[] = {[0;0m
> [1;32m+#if CAIRO_HAS_GLESV2_SURFACE[0;0m
> [1;32m+ EGL_CONTEXT_CLIENT_VERSION, 2,[0;0m
> [1;32m+#endif[0;0m
> [1;32m+ EGL_NONE[0;0m
> [1;32m+ };[0;0m
> [1;32m+[0;0m
> [1;32m+ struct closure *arg;[0;0m
> [1;32m+ cairo_device_t *device;[0;0m
> [1;32m+ cairo_surface_t *surface;[0;0m
> [1;32m+ EGLConfig config;[0;0m
> [1;32m+ EGLint numConfigs;[0;0m
> [1;32m+ EGLDisplay dpy;[0;0m
> [1;32m+ EGLContext ctx;[0;0m
> [1;32m+ int major, minor;[0;0m
> [1;32m+[0;0m
> [1;32m+ dpy = eglGetDisplay (EGL_DEFAULT_DISPLAY);[0;0m
> [1;32m+ if (! eglInitialize (dpy, &major, &minor)) {[0;0m
> [1;32m+ return NULL;[0;0m
> [1;32m+ }[0;0m
> [1;32m+[0;0m
> [1;32m+ eglChooseConfig (dpy, config_attribs, &config, 1, &numConfigs);[0;0m
> [1;32m+ if (numConfigs == 0) {[0;0m
> [1;32m+ return NULL;[0;0m
> [1;32m+ }[0;0m
> [1;32m+[0;0m
> [1;32m+#if CAIRO_HAS_GL_SURFACE[0;0m
> [1;32m+ eglBindAPI (EGL_OPENGL_API);[0;0m
> [1;32m+#elif CAIRO_HAS_GLESV2_SURFACE[0;0m
> [1;32m+ eglBindAPI (EGL_OPENGL_ES_API);[0;0m
> [1;32m+#endif[0;0m
> [1;32m+[0;0m
> [1;32m+ ctx = eglCreateContext (dpy, config, EGL_NO_CONTEXT,[0;0m
> [1;32m+ ctx_attribs);[0;0m
> [1;32m+ if (ctx == EGL_NO_CONTEXT) {[0;0m
> [1;32m+ eglTerminate (dpy);[0;0m
> [1;32m+ return NULL;[0;0m
> [1;32m+ }[0;0m
> [1;32m+[0;0m
> [1;32m+ arg = xmalloc (sizeof (struct closure));[0;0m
> [1;32m+ arg->dpy = dpy;[0;0m
> [1;32m+ arg->ctx = ctx;[0;0m
> [1;32m+ device = cairo_egl_device_create (dpy, ctx);[0;0m
> [1;32m+ if (cairo_device_set_user_data (device,[0;0m
> [1;32m+ (cairo_user_data_key_t *) cleanup,[0;0m
> [1;32m+ arg,[0;0m
> [1;32m+ cleanup))[0;0m
> [1;32m+ {[0;0m
> [1;32m+ cleanup (arg);[0;0m
> [1;32m+ return NULL;[0;0m
> [1;32m+ }[0;0m
> [1;32m+[0;0m
> [1;32m+ surface = cairo_gl_surface_create (device,[0;0m
> [1;32m+ CAIRO_CONTENT_COLOR_ALPHA,[0;0m
> [1;32m+ size, size);[0;0m
> [1;32m+ cairo_device_destroy (device);[0;0m
> [1;32m+[0;0m
> [1;32m+ return surface;[0;0m
> [1;32m+}[0;0m
> [1;32m+[0;0m
> [1;32m+CAIRO_TEST (egl_surface_source,[0;0m
> [1;32m+ "Test using a EGL surface as the source",[0;0m
> [1;32m+ "source", /* keywords */[0;0m
> [1;32m+ NULL, /* requirements */[0;0m
> [1;32m+ SIZE, SIZE,[0;0m
> [1;32m+ preamble, draw)[0;0m
> [0;34mdiff --git a/test/reference/egl-surface-source.argb32.ref.png b/test/reference/egl-surface-source.argb32.ref.png[0;0m
> [0;0mnew file mode 100644[0;0m
> [0;0mindex 0000000000000000000000000000000000000000..018297208e7e69c63dc671094b4659d2f64f26b6[0;0m
> [0;0mGIT binary patch[0;0m
> [0;0mliteral 377[0;0m
> [0;0mzcmeAS at N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGoY)RhkE)4%caKYZ?lNlHo^*mi1[0;0m
> [0;0mzLn`LHz3Z5D#6W<-(f7pu>3i-}Ht{#FI9zr&S8|pm$LWf5mghM?FP49BTa-bYA&g-S[0;0m
> [0;0mzLj>anrUcdlTn#7!`)^Cz at Yl^XNS+=acb^4C{zjGjhqPyZVq+hCGJ7)f^UliuYIu#p[0;0m
> [0;0mzFq`$jwdYOGp0 at n?yPo~sx({{#>c6)-2&3AMMH89}i?^|7e~CZQW`E$-D>Mgu``xg{[0;0m
> [0;0mhgb};PU<QBVuRp<iM0Mdk31C<<c)I$ztaD0e0sx;ke`){#[0;0m
> [0;0m[0;0m
> [0;0mliteral 0[0;0m
> [0;0mHcmV?d00001[0;0m
> [0;0m[0;0m
> [0;34mdiff --git a/test/reference/egl-surface-source.base.argb32.ref.png b/test/reference/egl-surface-source.base.argb32.ref.png[0;0m
> [0;0mnew file mode 100644[0;0m
> [0;0mindex 0000000000000000000000000000000000000000..018297208e7e69c63dc671094b4659d2f64f26b6[0;0m
> [0;0mGIT binary patch[0;0m
> [0;0mliteral 377[0;0m
> [0;0mzcmeAS at N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGoY)RhkE)4%caKYZ?lNlHo^*mi1[0;0m
> [0;0mzLn`LHz3Z5D#6W<-(f7pu>3i-}Ht{#FI9zr&S8|pm$LWf5mghM?FP49BTa-bYA&g-S[0;0m
> [0;0mzLj>anrUcdlTn#7!`)^Cz at Yl^XNS+=acb^4C{zjGjhqPyZVq+hCGJ7)f^UliuYIu#p[0;0m
> [0;0mzFq`$jwdYOGp0 at n?yPo~sx({{#>c6)-2&3AMMH89}i?^|7e~CZQW`E$-D>Mgu``xg{[0;0m
> [0;0mhgb};PU<QBVuRp<iM0Mdk31C<<c)I$ztaD0e0sx;ke`){#[0;0m
> [0;0m[0;0m
> [0;0mliteral 0[0;0m
> [0;0mHcmV?d00001[0;0m
> [0;0m[0;0m
> [0;34mdiff --git a/test/reference/egl-surface-source.base.rgb24.ref.png b/test/reference/egl-surface-source.base.rgb24.ref.png[0;0m
> [0;0mnew file mode 100644[0;0m
> [0;0mindex 0000000000000000000000000000000000000000..0d68a82cc27532aa78fc12af7646f6821a730a2b[0;0m
> [0;0mGIT binary patch[0;0m
> [0;0mliteral 301[0;0m
> [0;0mzcmeAS at N?(olHy`uVBq!ia0vp^2_VeD1SE5RJ;(=AY)RhkE)4%caKYZ?lYt_SJY5_^[0;0m
> [0;0mzD(1Ysy^*iUK*S+1>rej2(}h=B at 0d(;Js;WVUVNE%S1wQ;!=K59zYi43gs*v=>!Y8U[0;0m
> [0;0mz_vgvq?cQM at omse;SR0!h92Y1A>{u^la;*65g4(k)k}t|wYjB7lNebZM8vKpTne!)c[0;0m
> [0;0mzbN%i~M<*ZqX0g}kFdxELd^!~Z1T at ab2krlH<ByqM{lP1D%YXuKdqK|r at Q}6kF=t0)[0;0m
> [0;0mR<@7`l*VEO{Wt~$(698O(XEy)<[0;0m
> [0;0m[0;0m
> [0;0mliteral 0[0;0m
> [0;0mHcmV?d00001[0;0m
> [0;0m[0;0m
> [0;34mdiff --git a/test/reference/egl-surface-source.image16.ref.png b/test/reference/egl-surface-source.image16.ref.png[0;0m
> [0;0mnew file mode 100644[0;0m
> [0;0mindex 0000000000000000000000000000000000000000..2a7460e284f3ed8ad59e28c1498357559937e421[0;0m
> [0;0mGIT binary patch[0;0m
> [0;0mliteral 305[0;0m
> [0;0mzcmeAS at N?(olHy`uVBq!ia0vp^2_VeD1SE5RJ;(=AY)RhkE)4%caKYZ?lYt`7JY5_^[0;0m
> [0;0mzD(1Ysy^*iUK*S+1>rb{Y`{Mh(i}ju at +o)4 at j>~4&?7R!P%s{0N=J(uW|5j_CB&(lX[0;0m
> [0;0mz<yrh#{k^^HrY?D<009jS5f&~c*2Y7XR~Hz{WwYJA)^l at x_Oly~jtdkJvP}-SxvekX[0;0m
> [0;0mzCp|taZ}xrt^i5@#Zs^IcKeM43p9a=OWZBQ{SNQGB_V*r+Hz?gM3vmosUI6HBhCP)`[0;0m
> [0;0mXvmH4neBSVCGl=Wy>gTe~DWM4fL|kN5[0;0m
> [0;0m[0;0m
> [0;0mliteral 0[0;0m
> [0;0mHcmV?d00001[0;0m
> [0;0m[0;0m
> [0;34mdiff --git a/test/reference/egl-surface-source.rgb24.ref.png b/test/reference/egl-surface-source.rgb24.ref.png[0;0m
> [0;0mnew file mode 100644[0;0m
> [0;0mindex 0000000000000000000000000000000000000000..0d68a82cc27532aa78fc12af7646f6821a730a2b[0;0m
> [0;0mGIT binary patch[0;0m
> [0;0mliteral 301[0;0m
> [0;0mzcmeAS at N?(olHy`uVBq!ia0vp^2_VeD1SE5RJ;(=AY)RhkE)4%caKYZ?lYt_SJY5_^[0;0m
> [0;0mzD(1Ysy^*iUK*S+1>rej2(}h=B at 0d(;Js;WVUVNE%S1wQ;!=K59zYi43gs*v=>!Y8U[0;0m
> [0;0mz_vgvq?cQM at omse;SR0!h92Y1A>{u^la;*65g4(k)k}t|wYjB7lNebZM8vKpTne!)c[0;0m
> [0;0mzbN%i~M<*ZqX0g}kFdxELd^!~Z1T at ab2krlH<ByqM{lP1D%YXuKdqK|r at Q}6kF=t0)[0;0m
> [0;0mR<@7`l*VEO{Wt~$(698O(XEy)<[0;0m
> [0;0m[0;0m
> [0;0mliteral 0[0;0m
> [0;0mHcmV?d00001[0;0m
> [0;0m[0;0m
> [0;32m-- [0;0m
> [0;0m1.7.9.5[0;0m
> [0;0m[0;0m
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
More information about the cairo
mailing list