changeset 579:e2c9117b1e12 openvg

Add an option to enable OpenVG graphic engine
author Thinker K.F. Li <thinker@branda.to>
date Wed, 16 Jun 2010 21:28:57 +0800
parents fd5f5d9e00d2
children 7bfeccdc91cb
files configure.ac include/mb_config.h.in include/mb_graph_engine.h
diffstat 3 files changed, 44 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Wed Jun 16 21:02:49 2010 +0800
+++ b/configure.ac	Wed Jun 16 21:28:57 2010 +0800
@@ -76,16 +76,34 @@
   no) skia=false ;;
   *) AC_MSG_ERROR([bad value ${enableval} for --enable-skia]) ;;
 esac],[skia=false])
-AM_CONDITIONAL([SKIA_GRAPH_ENGINE], [test x$skia = xtrue])
-AM_CONDITIONAL([CAIRO_GRAPH_ENGINE], [test x$skia != xtrue])
+
+AC_ARG_ENABLE([openvg],
+	[  --enable-openvg	Turn on OpenVG instead of Cairo or Skia],
+[case "${enableval}" in
+  yes) openvg=true ;;
+  no) openvg=false ;;
+  *)  AC_MSG_ERROR([bad value ${enableval} for --enable-openvg]) ;;
+esac],[openvg=false])
+
+[if [ x"$skia-%openvg" = xtrue-true ]; then]
+   AC_MSG_ERROR([confliction on --enable-skia and --enable-openvg])
+[fi]
+
 [if [ x"${skia}" = xtrue ]; then ]
 AC_DEFINE([SKIA_GRAPH_ENGINE])
 cairo=false
+[elif [ x"${openvg}" = xtrue ]; then ]
+AC_DEFINE([OPENVG_GRAPH_ENGINE])
+cairo=false
 [else]
 AC_DEFINE([CAIRO_GRAPH_ENGINE])
 cairo=true
 [fi]
 
+AM_CONDITIONAL([SKIA_GRAPH_ENGINE], [test x$skia = xtrue])
+AM_CONDITIONAL([OPENVG_GRAPH_ENGINE], [test x$openvg = xtrue])
+AM_CONDITIONAL([CAIRO_GRAPH_ENGINE], [test x"$cairo" = xtrue])
+
 AC_ARG_ENABLE([nodejs],
 	[  --enable-nodejs	Turn on nodejs support],
 [case "${enableval}" in
@@ -113,6 +131,10 @@
 [fi]
 
 # Checks for libraries.
+[if [ x"${openvg}" = xtrue ]; then]
+AC_CHECK_HEADERS([GL/glut.h],, [AC_MSG_ERROR([can not find GL/glut.h])])
+[fi]
+
 [if [ x"${cairo}" = xtrue ]; then]
 PKG_CHECK_MODULES([cairo], [cairo >= 1.6], , AC_MSG_ERROR([cairo >= 1.6 not found]))
 PKG_CHECK_MODULES([pangocairo], [pangocairo >= 1.0], , AC_MSG_ERROR([pangocairo >= 1.0 not found]))
@@ -137,6 +159,7 @@
 AH_TEMPLATE([SH_TEXT],[Enable sh_text object])
 AH_TEMPLATE([SH_STEXT],[Enable sh_stext object])
 AH_TEMPLATE([SKIA_GRAPH_ENGINE], [Enable Skia Graphic Engine])
+AH_TEMPLATE([OPENVG_GRAPH_ENGINE], [Enable OpenVG Graphic Engine])
 AH_TEMPLATE([CAIRO_GRAPH_ENGINE], [Enable Cairo Graphic Engine])
 AH_TEMPLATE([X_SUPP], [Enable X backend])
 
--- a/include/mb_config.h.in	Wed Jun 16 21:02:49 2010 +0800
+++ b/include/mb_config.h.in	Wed Jun 16 21:28:57 2010 +0800
@@ -7,6 +7,9 @@
 /* Enable Skia Graphic Engine */
 #undef SKIA_GRAPH_ENGINE
 
+/* Enable OpenVG Graphic Engine */
+#undef OPENVG_GRAPH_ENGINE
+
 /* Enable sh_text */
 #undef SH_TEXT
 
--- a/include/mb_graph_engine.h	Wed Jun 16 21:02:49 2010 +0800
+++ b/include/mb_graph_engine.h	Wed Jun 16 21:28:57 2010 +0800
@@ -1,3 +1,15 @@
+/*! \page create_graph_engine Create a Graphic Engine.
+ *
+ * To create a graphic engine, you need to declare and define types
+ * and functions that had been declared in
+ * include/mb_graph_engine_cairo.h in a separated header an c file.
+ * Likes what mb_graph_engine_skia.h does.
+ *
+ * You should also add options in configure.ac to enable the graphic
+ * engine.  You also need to add lines in include/mb_config.h.in and
+ * include/mb_graph_engine.h to include correct header for the graphic
+ * engine enabled by the user.
+ */
 #ifndef __MBE_H_
 #define __MBE_H_
 #include <mb_config.h>
@@ -10,4 +22,8 @@
 #include <mb_graph_engine_skia.h>
 #endif
 
+#ifdef OPENVG_GRAPH_ENGINE
+#include <mb_graph_engine_openvg.h>
+#endif
+
 #endif /* __MBE_H_ */