Demos (master): egl/openvg: blend demo needs a window with alpha channel.

Chia-I Wu olv at kemper.freedesktop.org
Sat Dec 4 16:01:06 UTC 2010


Module: Demos
Branch: master
Commit: 0ed7c64c7f1efc5748a4bb741078d86f512839be
URL:    http://cgit.freedesktop.org/mesa/demos/commit/?id=0ed7c64c7f1efc5748a4bb741078d86f512839be

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Sat Dec  4 23:51:07 2010 +0800

egl/openvg: blend demo needs a window with alpha channel.

Add set_window_alpha_size to eglcommon to request alpha size.  Set alpha
size to 1 in blend demo.

---

 src/egl/openvg/trivial/blend.c     |    1 +
 src/egl/openvg/trivial/eglcommon.c |    9 ++++++++-
 src/egl/openvg/trivial/eglcommon.h |    1 +
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/egl/openvg/trivial/blend.c b/src/egl/openvg/trivial/blend.c
index fe8af87..c69abb8 100644
--- a/src/egl/openvg/trivial/blend.c
+++ b/src/egl/openvg/trivial/blend.c
@@ -145,6 +145,7 @@ draw(void)
 int main(int argc, char **argv)
 {
    set_window_size(300, 300);
+   set_window_alpha_size(1);
    return run(argc, argv, init, reshape,
               draw, 0);
 }
diff --git a/src/egl/openvg/trivial/eglcommon.c b/src/egl/openvg/trivial/eglcommon.c
index 0316e59..7d84031 100644
--- a/src/egl/openvg/trivial/eglcommon.c
+++ b/src/egl/openvg/trivial/eglcommon.c
@@ -18,8 +18,14 @@ static draw_func    draw = 0;
 static reshape_func reshape = 0;
 static key_func     keyPress = 0;
 static VGint width = 300, height = 300;
+static EGLint alpha_size = 0;
 
 
+void set_window_alpha_size(int size)
+{
+   alpha_size = size;
+}
+
 void set_window_size(int w, int h)
 {
    width = w;
@@ -38,10 +44,11 @@ make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
               EGLContext *ctxRet,
               EGLSurface *surfRet)
 {
-   static const EGLint attribs[] = {
+   EGLint attribs[] = {
       EGL_RED_SIZE, 1,
       EGL_GREEN_SIZE, 1,
       EGL_BLUE_SIZE, 1,
+      EGL_ALPHA_SIZE, alpha_size,
       EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
       EGL_NONE
    };
diff --git a/src/egl/openvg/trivial/eglcommon.h b/src/egl/openvg/trivial/eglcommon.h
index 958dae9..eec0e42 100644
--- a/src/egl/openvg/trivial/eglcommon.h
+++ b/src/egl/openvg/trivial/eglcommon.h
@@ -7,6 +7,7 @@ typedef void (*draw_func)();
 typedef int  (*key_func)(unsigned key);
 
 
+void set_window_alpha_size(int size);
 void set_window_size(int width, int height);
 int window_width(void);
 int window_height(void);




More information about the mesa-commit mailing list