diff --git a/legacy/evas/.cvsignore b/legacy/evas/.cvsignore deleted file mode 100644 index b6329d76a8..0000000000 --- a/legacy/evas/.cvsignore +++ /dev/null @@ -1,22 +0,0 @@ -.icons -evas-config -Makefile -Makefile.in -aclocal.m4 -config.status -config.log -config.cache -configure -stamp-h -stamp-h.in -config.sub -config.guess -libtool -config.h -ltmain.sh -ltconfig -config.h.in -libltdl -install-sh -missing -mkinstalldirs diff --git a/legacy/evas/AUTHORS b/legacy/evas/AUTHORS deleted file mode 100644 index 207158677d..0000000000 --- a/legacy/evas/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -The Rasterman (Carsten Haitzler) diff --git a/legacy/evas/COPYING b/legacy/evas/COPYING deleted file mode 100644 index dee3047c34..0000000000 --- a/legacy/evas/COPYING +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (C) 2000 Carsten Haitzler and various contributors (see AUTHORS) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies of the Software, its documentation and marketing & publicity -materials, and acknowledgment shall be given in the documentation, materials -and software packages that this Software was used. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/legacy/evas/FAQ-EVAS b/legacy/evas/FAQ-EVAS deleted file mode 100644 index 3190217666..0000000000 --- a/legacy/evas/FAQ-EVAS +++ /dev/null @@ -1,42 +0,0 @@ -Q: Why is EVAS faster with software acceleration than than when I run it - with hardware acceleration switched on? - -A: When run with hardware acceleration EVAS uses the GL libraries on your - system; this means that if you have Mesa installed then EVAS will use - the Mesa GL liberties. Mesa however only provides software acceleration - and therefore will run slow compared to EVASs in-built software mode. If - you have a video card that supports hardware acceleration then you should - attempt to get the manufacturers own GL drivers for your computer and - install them making sure that none of the Mesa libraries are left behind - and that where needed sym-links are made to the real drivers. - -Q: Why is 'program x' which uses EVAS so slow? - -A: See last question. The chance is that the program is trying to use - hardware acceleration by default and that you have Mesa GL libraries - installed on your system. If you don't have acceleration on your video - card then you should search for a way to switch to software acceleration - in the program. - -Q: Is there a packaged version of SGI's GLU Implementation for my computer - anywhere? - -A: At present SGI's GLU Implementation is available only in the form of a - Redhat package from http://www.mesa3d.org/downloads/sgi.html. You should - download this package and convert it to whatever distribution you are - on using "alien". - -Q: Why is my CPU usage at 100% when I use a program running EVAS? - -A: When used in software mode, EVAS will use a lot of CPU. In hardware - mode however it depends on your OpenGL drivers. What a lot of drivers - do is limit buffer buffer swaps to vertical blanking gaps only. This - means that the buffers wont be swapped until the vertical blanking gap - is reached, however since there is no method of using interrupts under - Linux/X the GL drivers have to poll in a tight loop waiting for the gap. - Also if the GL libs are accessing the GFX hardware directory then if the - hardware is busy then the app will sit and poll registers until the - hardware is ready. It's basically down to your OpenGL drivers. It's worth - noting as well that your CPU will be high whenever you run evas_test as - it is pushing your system to try and achieve the highest frame rate it - can, a situation that most software using EVAS will never be in. diff --git a/legacy/evas/Makefile.am b/legacy/evas/Makefile.am deleted file mode 100644 index 8ccb6e22ee..0000000000 --- a/legacy/evas/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ - -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = 1.4 foreign - -# A list of all the files in the current directory which can be regenerated -MAINTAINERCLEANFILES = INSTALL Makefile.in aclocal.m4 config.guess \ - config.h.in config.sub configure install-sh \ - ltconfig ltmain.sh missing mkinstalldirs \ - stamp-h.in - -SUBDIRS = src test doc debian - -bin_SCRIPTS = evas-config - -EXTRA_DIST = README AUTHORS COPYING evas.spec evas.m4 FAQ-EVAS - -m4datadir = @aclocaldir@ -m4data_DATA = evas.m4 diff --git a/legacy/evas/README b/legacy/evas/README deleted file mode 100644 index b82b4213cd..0000000000 --- a/legacy/evas/README +++ /dev/null @@ -1,104 +0,0 @@ -------------------------------------------------------------------------------- - E V A S - 0.6.0 -------------------------------------------------------------------------------- - -This is the ``E Canvas'' - a rip off of some of the other canvas's floating -about - Tk and gnome too. it's at the Xlib level. it's intended to be -accelerated by hardware or highly optimised software where possible. It is -intended to be simple and allow for the building of interfaces ontop of it. - -What you NEED: -* Imlib2 1.0.3 or higher (and development headers) -* Freetype 1.1, 1.2 or 1.3 - NOT 2.0 and development headers -* X11R6 and development headersand libraries - -If you want hardware acceleration to be available: -* OpenGL 1.0 and headers, with hardware accel support and an Xserver with -that too - your milage will vary (Xfree86 4.0 with DRI or Nvidia drivers for -example). make sure you dont have mutliepl libGL's and multiple GL headers -on your system. Rememebr most GL drivers are buggy and you will experience -problems. See your driver maintainers for these :) - -if you got this from cvs do: -./autogen.sh - -otherwise do: -./configure - -then to compile: -make - -if you wish to install (as root): -make install - -in the test directory you will find a test program: - -cd test -./evas_test - -This is an overall demo of what Evas can do. You can select the rendering mode -on the left by simply clicking it. Just sit back, watch and relax. - -There is also - -./evas_test_old - -this will by default try the software engine - if you don't have a fast cpu -it will be slow. You can try the other engines: -./evas_test_old -m x11 -./evas_test_old -m soft -s 0 -./evas_test_old -m hard - -x11 is the X11 pixmap engine. -s 0 turns off ``dithering'' and smooth shading -for image objects here for better speed. hard is the opengl hardware 3D -engine. Note that if you do NOT have real hardware accelerated GL it will be -SLOOOOOOOOOOOOOW - VERY slow. Much slower than software. Also Mesa 3.2 and -below has known bugs that cause a segv. It's been fixed in Mesa 3.3. - -If evas didn't find OpenGL it will have built a software only engine so you -don't need to try hardware since this will fall back to software mode -automatically. - -There is a new evas_test program being written too - it's in progress, so -wait for it to be complete. - -------------------------------------------------------------------------------- -MORE DETAILED DESCRIPTION: -------------------------------------------------------------------------------- - -Evas? Canvas? What? OK.. you're baffled as to what that stuff is. Time to -explain. - -A canvas is a high-level rendering engine. Instead of a program having to -handle exposes or updates then redraw bit by bit (draw line, draw box, -paste image etc.) after having figured out what has changed and what need to -be re-rendered - what data loaded in maps to what... then finally order the -draw in the right way to optimize it - a canvas provides a high-level API to -this kind of thing and handles all the smarts inside. - -The result is an application creates an Evas & attaches that evas to a window. -Now it just creates objects - create an image object, a text object, a line -object, a rectangle object etc. It just moves and resizes these objects around -by calling routines in Evas - Evas handles redrawing, scaling, ordering the -draws to account for layers, clipping objects out that don't exist in the -visible Evas area etc. All the application need do is call evas_redraw when -it becomes idle to have the evas redraw what has changed. - -This means less headache for the application programmer. Now why do this as -a whole new library? Well - because the library can render the Evas as fast -as possible. It uses Imlib2 to do the grunt work of loading images - and -beyond that it can currently use either imlib2, OpenGL or X11 to render to the -Evas - if you have decent hardware that's supported by OpenGL you will see -in the area of 10-50 times (in future even higher) speedups in rendering -using the GL backend instead of the Imlib2 one (even though Imlib2 is a -highly optimized software rendering engine). The good thing here is that the -application can choose what system to use. If that system isn't available or -Evas didn't compile with it, it will fall back to the nearest approximation -(it will ALWAYS have Imlib2 and X11 rendering backends - Imlib2 being able to -actually alpha blend, but X11 keeping the rendering server-side with pixmaps -and clip masks) so this means a highly optimized rendering subsystem to build -more complex things ontop of. - -As it stands right now the API is still under construction - don't bank on it -remaining 100% stable. The backend of evas currently seems to have no bugs or -leaks that I know of, so feel free to punish it. diff --git a/legacy/evas/acconfig.h b/legacy/evas/acconfig.h deleted file mode 100644 index c6f0f64515..0000000000 --- a/legacy/evas/acconfig.h +++ /dev/null @@ -1,3 +0,0 @@ -#undef HAVE_GL -#undef HAVE_GLU -#undef HAVE_RENDER diff --git a/legacy/evas/autogen.sh b/legacy/evas/autogen.sh deleted file mode 100755 index c7d148a4d6..0000000000 --- a/legacy/evas/autogen.sh +++ /dev/null @@ -1,39 +0,0 @@ -#! /bin/sh - -abort () { - echo "$1 not found or command failed. Aborting!" - exit 1 -} - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -THEDIR="`pwd`" -cd "$srcdir" -DIE=0 - -set -x -aclocal || abort "aclocal" -libtoolize --ltdl --force --copy || abort "libtoolize" -autoheader || abort "autoheader" -automake --foreign --add-missing || abort "automake" -autoconf || abort "autoconf" - -if test -z "$*"; then - echo "I am going to run ./configure with no arguments - if you wish " - echo "to pass any to it, please specify them on the $0 command line." -fi - -cd "$THEDIR" - -$srcdir/configure "$@" || abort "configure" - -set +x - -echo "Now type:" -echo -echo "make" -echo "make install" -echo -echo "have fun." - diff --git a/legacy/evas/configure.ac b/legacy/evas/configure.ac deleted file mode 100644 index b6d68d0607..0000000000 --- a/legacy/evas/configure.ac +++ /dev/null @@ -1,288 +0,0 @@ -# SETUP -AC_INIT(src/Evas.h) -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(evas, 0.6.0) - -IMLIB2_CONFIG_IN_PATH=xyes -AC_PROGRAM_CHECK(IMLIB2_CONFIG_IN_PATH, imlib2-config, xyes, xno) -if test $IMLIB2_CONFIG_IN_PATH = xno; then - echo "ERROR:" - echo "The imlib2-config development script was not found in your execute" - echo "path. This may mean one of several things" - echo "1. You may not have installed the Imlib2-devel (or Imlib2-dev)" - echo " packages." - echo "2. You may have Imlib2 installed somewhere not covered by your path." - echo "" - echo "If this is the case make sure you have the packages installed, AND" - echo "that the imlib2-config script is in your execute path (see your" - echo "shell's manual page on setting the \$PATH environment variable)." - AC_MSG_ERROR([Fatal Error: no imlib2-config detected.]) - exit; -fi - -AC_ARG_WITH(ttf, -[ --with-ttf=DIR use DIR where freetype was installed (eg /opt/freetype)], -[ -CPPFLAGS="$CPPFLAGS -I$withval/include"; -LDFLAGS="$LDFLAGS -L$withval/lib"; -LIBS_TTF="-L"$withval"/lib" -]) - -gl=yes -AC_ARG_ENABLE(gl, -[ --disable-gl disable building with opengl support], -[ - if test x$enableval = xyes; then - gl=yes - else - gl=no - fi -] -) - -AC_ARG_WITH(gl, -[ --with-gl=DIR use DIR where opengl was installed (eg /usr/X11R6)], -[ - if test x$gl = xyes; then - CPPFLAGS="$CPPFLAGS -I$withval/include"; - LDFLAGS="$LDFLAGS -L$withval/lib"; - LIBS_GL="-L"$withval"/lib" - fi -]) - -AC_C_BIGENDIAN -AC_PROG_CC -AM_PROG_CC_STDC -AM_WITH_DMALLOC -AC_C_CONST -AM_ENABLE_SHARED -AM_PROG_LIBTOOL -AC_PROG_INSTALL -AC_PROG_MAKE_SET - -if test X"$enable_shared" = Xyes; then - DLLDFLAGS=-export-dynamic - AC_SUBST(DLLDFLAGS) -fi - -AC_PATH_X -AC_PATH_XTRA - -if test "x$x_includes" = "x"; then - x_includes="/usr/include" -fi - -x_cflags="$X_CFLAGS" -x_ldflags="$X_LDFLAGS" -x_libs="$X_LIBS $X_EXTRA_LIBS -lX11" - -AC_CHECK_LIB( -X11, -XOpenDisplay, -x_libs="$x_libs", -AC_MSG_ERROR([ERROR: libX11 not found.]); exit, -$X_LDFLAGS $X_EXTRA_LIBS $X_LIBS -) -AC_CHECK_LIB( -Xext, -XShmAttach, -x_libs="-lXext $x_libs", - AC_CHECK_LIB( - XextSam, - XShmAttach, - x_libs="-lXextSam -lXext $x_libs", - AC_MSG_ERROR([ERROR: XShm not found.]); exit, - $x_libs), -$x_libs) -AC_CHECK_LIB( -Xext, -XShapeCombineMask, -x_libs="-lXext $x_libs", -AC_MSG_ERROR([ERROR: XShape not found.]); exit, -$x_libs) - -x_libs="$x_libs -lX11" - -AC_CHECK_LIB( -Xrender, -XRenderCreatePicture, -[ -x_libs=" -lXrender -lXext $x_libs"; -AC_DEFINE(HAVE_RENDER) -], -[], -$x_libs) - -AC_CHECK_LIB( -ttf, -TT_Init_FreeType, -TTF_LIBS="-lttf "$LIBS_TTF, -[ -echo "ERROR: Evas needs a system with libttf.so (TrueType Font Library)" -echo "You can obtain it from:" -echo "ftp://ftp.enlightenment.org/pub/enlightenment/" -echo "You can also obtain it from:" -echo "http://www.freetype.org/" -echo "You can obtain some truetype fonts from:" -echo "http://voyager.cns.ohiou.edu/~sadkins/web_library/fonts/font_archive/" -echo "" -AC_MSG_ERROR([Fatal Error: no FreeType detected.]) -], -$LIBS_TTF -lm) - -AC_CHECK_HEADERS(freetype.h freetype/freetype.h freetype1/freetype/freetype.h,[ break] , ) -AC_CHECK_HEADER(freetype.h, [ ftype=yes ], [ ftype=no ]) -AC_CHECK_HEADER(freetype/freetype.h, [ ftype_ftype=yes ], [ ftype_ftype=no ]) -AC_CHECK_HEADER(freetype1/freetype/freetype.h, [ ftype1_ftype=yes ], [ ftype1_ftype=no ]) - -if test x$ftype = xno; then -if test x$ftype_ftype = xno; then -if test x$ftype1_ftype = xno; then - -echo "" -echo "ERROR: freetype.h not found in freetype.h or freetype/freetype.h include" -echo "paths. (ie /usr/include, /usr/local/include etc.). You need the freetype" -echo "header files to build Evas. This may mean you have to install the" -echo "freetype-devel packages for your distribution or if all else fails" -echo "find the source for freetype and install that somewhere where Evas" -echo "can find the header files." -echo "" -echo "You can obtain it from:" -echo "ftp://ftp.enlightenment.org/pub/enlightenment/" -echo "You can also obtain it from:" -echo "http://www.freetype.org/" -echo "You can obtain some truetype fonts from:" -echo "http://voyager.cns.ohiou.edu/~sadkins/web_library/fonts/font_archive/" -echo "" -AC_MSG_ERROR([Fatal Error: no FreeType header files detected.]) -fi -fi -fi -ttf_includes="$CPPFLAGS" -ttf_libs="$LIBS_TTF -lm -lttf" - -if test x$gl = xyes ; then -gl_includes="" -PREV_CPPFLAGS=$CPPFLAGS -CPPFLAGS=$CPPFLAGS" -I/usr/include -I/usr/local/include "$x_cflags - -header_gl_h=xno -header_glu_h=xno -AC_TRY_CPP( -[ -#include -], -[ -echo "checking for GL/gl.h... yes"; -gl_includes=$CPPFLAGS; -header_gl_h=xyes; -] -, -[ -echo "checking for GL/gl.h... no"; -header_gl_h=xno; -]) - -if test $header_gl_h = xyes; then -AC_TRY_CPP( -[ -#include -#include -], -[ -echo "checking for GL/glu.h... yes"; -glu_includes=$CPPFLAGS; -header_glu_h=xyes; -] -, -[ -echo "checking for GL/glu.h... no"; -header_glu_h=xno; -]) -fi - -have_gl=no -have_glu=no - -if test $header_gl_h = xyes; then -AC_CHECK_LIB( -GL, -glBindTexture, -have_gl=yes, -[], --L/usr/local/lib -lGL $x_libs $x_ldflags $x_cflags $LIBS_GL -lm) -fi -if test "x$have_gl" = "xyes"; then -gl_includes=$gl_includes -gl_ldflags="$gl_ldflags -L/usr/local/lib -lGL $x_libs $x_ldflags $x_cflags $LIBS_GL -lm"; -gl_libs=$gl_libs" -lGL" -AC_DEFINE(HAVE_GL) -fi - -if test $header_glu_h = xyes; then -AC_CHECK_LIB( -GLU, -gluBuild2DMipmaps, -have_glu=yes, -echo "WARNING:......."; -echo "no libGLU was found. This means filtered (anti-aliased) scaling down"; -echo "of images will be disabled."; -echo "Please read the config.log file for more information as to why this library"; -echo "was not found."; -, -$gl_ldflags -lGL -lGLU) -AC_CHECK_LIB( -GLU, -gluTessBeginPolygon, -have_glu=yes, -echo ""; -echo "ERROR: evas needs a system with libGLU 1.3"; -echo "You can obtain it from:"; -echo "http://www.mesa3d.org/downloads/sgi.html"; -echo "You will need to obtain the SGI'd libGLU."; -echo "debian: download the rpm and use alien to convert it"; -echo ""; -have_glu = no; -, -$gl_ldflags -lGL -lGLU) -fi - -if test have_gl = no; then - echo "WARNING:......." - echo "no OpenGL libraries / headers found. This means no GL support will be" - echo "built into Evas. Ifapplications request 3D Hardware rendering from" - echo "evas, they will be forcibly moved back to using software alpha" - echo "rendering." - echo "Please read the config.log file for more information as to why this library" - echo "was not found." -fi -fi -CPPFLAGS=$PREV_CPPFLAGS - -imlib2_includes=`imlib2-config --cflags` -imlib2_libs=`imlib2-config --libs` - -AC_SUBST(x_cflags) -AC_SUBST(x_includes) -AC_SUBST(x_ldflags) -AC_SUBST(x_libs) -AC_SUBST(gl_includes) -AC_SUBST(gl_ldflags) -AC_SUBST(gl_libs) -AC_SUBST(imlib2_includes) -AC_SUBST(imlib2_libs) -AC_SUBST(ttf_includes) -AC_SUBST(ttf_libs) - -AC_OUTPUT([ -Makefile -src/Makefile -test/Makefile -test/img/Makefile -test/fnt/Makefile -evas-config -doc/Makefile -debian/Makefile -], [ -chmod +x evas-config -]) diff --git a/legacy/evas/configure.in b/legacy/evas/configure.in deleted file mode 100644 index a929d95174..0000000000 --- a/legacy/evas/configure.in +++ /dev/null @@ -1,306 +0,0 @@ -# SETUP -AC_INIT(src/Evas.h) -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(evas, 0.6.0) - -IMLIB2_CONFIG_IN_PATH=xyes -AC_PROGRAM_CHECK(IMLIB2_CONFIG_IN_PATH, imlib2-config, xyes, xno) -if test $IMLIB2_CONFIG_IN_PATH = xno; then - echo "ERROR:" - echo "The imlib2-config development script was not found in your execute" - echo "path. This may mean one of several things" - echo "1. You may not have installed the Imlib2-devel (or Imlib2-dev)" - echo " packages." - echo "2. You may have Imlib2 installed somewhere not covered by your path." - echo "" - echo "If this is the case make sure you have the packages installed, AND" - echo "that the imlib2-config script is in your execute path (see your" - echo "shell's manual page on setting the \$PATH environment variable)." - AC_MSG_ERROR([Fatal Error: no imlib2-config detected.]) - exit; -fi - -AC_ARG_WITH(ttf, -[ --with-ttf=DIR use DIR where freetype was installed (eg /opt/freetype)], -[ -CPPFLAGS="$CPPFLAGS -I$withval/include"; -LDFLAGS="$LDFLAGS -L$withval/lib"; -LIBS_TTF="-L"$withval"/lib" -]) - -aclocal_usr=yes -AC_ARG_ENABLE(aclocal_usr, -[ --disable-aclocal_usr disable evas forcibly puting evas.m4 in /usr/aclocal and use prefix instead], -[ - if test x$enableval = xyes; then - aclocal_usr=yes - else - aclocal_usr=no - fi -] -) - -gl=yes -AC_ARG_ENABLE(gl, -[ --disable-gl disable building with opengl support], -[ - if test x$enableval = xyes; then - gl=yes - else - gl=no - fi -] -) - -AC_ARG_WITH(gl, -[ --with-gl=DIR use DIR where opengl was installed (eg /usr/X11R6)], -[ - if test x$gl = xyes; then - CPPFLAGS="$CPPFLAGS -I$withval/include"; - LDFLAGS="$LDFLAGS -L$withval/lib"; - LIBS_GL="-L"$withval"/lib" - fi -]) - -AC_C_BIGENDIAN -AC_PROG_CC -AM_PROG_CC_STDC -AM_WITH_DMALLOC -AC_C_CONST -AM_ENABLE_SHARED -AM_PROG_LIBTOOL -AC_PROG_INSTALL -AC_PROG_MAKE_SET - -if test X"$enable_shared" = Xyes; then - DLLDFLAGS=-export-dynamic - AC_SUBST(DLLDFLAGS) -fi - -AC_PATH_X -AC_PATH_XTRA - -if test "x$x_includes" = "x"; then - x_includes="/usr/include" -fi - -x_cflags="$X_CFLAGS" -x_ldflags="$X_LDFLAGS" -x_libs="$X_LIBS $X_EXTRA_LIBS -lX11" - -AC_CHECK_LIB( -X11, -XOpenDisplay, -x_libs="$x_libs", -AC_MSG_ERROR([ERROR: libX11 not found.]); exit, -$X_LDFLAGS $X_EXTRA_LIBS $X_LIBS -) -AC_CHECK_LIB( -Xext, -XShmAttach, -x_libs="-lXext $x_libs", - AC_CHECK_LIB( - XextSam, - XShmAttach, - x_libs="-lXextSam -lXext $x_libs", - AC_MSG_ERROR([ERROR: XShm not found.]); exit, - $x_libs), -$x_libs) -AC_CHECK_LIB( -Xext, -XShapeCombineMask, -x_libs="-lXext $x_libs", -AC_MSG_ERROR([ERROR: XShape not found.]); exit, -$x_libs) - -x_libs="$x_libs -lX11" - -AC_CHECK_LIB( -Xrender, -XRenderCreatePicture, -[ -x_libs=" -lXrender -lXext $x_libs"; -AC_DEFINE(HAVE_RENDER) -], -[], -$x_libs) - -AC_CHECK_LIB( -ttf, -TT_Init_FreeType, -TTF_LIBS="-lttf "$LIBS_TTF, -[ -echo "ERROR: Evas needs a system with libttf.so (TrueType Font Library)" -echo "You can obtain it from:" -echo "ftp://ftp.enlightenment.org/pub/enlightenment/" -echo "You can also obtain it from:" -echo "http://www.freetype.org/" -echo "You can obtain some truetype fonts from:" -echo "http://voyager.cns.ohiou.edu/~sadkins/web_library/fonts/font_archive/" -echo "" -AC_MSG_ERROR([Fatal Error: no FreeType detected.]) -], -$LIBS_TTF -lm) - -AC_CHECK_HEADERS(freetype.h freetype/freetype.h freetype1/freetype/freetype.h, [ break ], ) -AC_CHECK_HEADER(freetype.h, [ ftype=yes ], [ ftype=no ]) -AC_CHECK_HEADER(freetype/freetype.h, [ ftype_ftype=yes ], [ ftype_ftype=no ]) -AC_CHECK_HEADER(freetype1/freetype/freetype.h, [ ftype1_ftype=yes ], [ ftype1_ftype=no ]) -if test x$ftype = xno; then -if test x$ftype_ftype = xno; then -if test x$ftype1_ftype = xno; then -echo "" -echo "ERROR: freetype.h not found in freetype.h or freetype/freetype.h include" -echo "paths. (ie /usr/include, /usr/local/include etc.). You need the freetype" -echo "header files to build Evas. This may mean you have to install the" -echo "freetype-devel packages for your distribution or if all else fails" -echo "find the source for freetype and install that somewhere where Evas" -echo "can find the header files." -echo "" -echo "You can obtain it from:" -echo "ftp://ftp.enlightenment.org/pub/enlightenment/" -echo "You can also obtain it from:" -echo "http://www.freetype.org/" -echo "You can obtain some truetype fonts from:" -echo "http://voyager.cns.ohiou.edu/~sadkins/web_library/fonts/font_archive/" -echo "" -AC_MSG_ERROR([Fatal Error: no FreeType header files detected.]) -fi -fi -fi - -ttf_includes="$CPPFLAGS" -ttf_libs="$LIBS_TTF -lm -lttf" - -if test x$gl = xyes ; then -gl_includes="" -PREV_CPPFLAGS=$CPPFLAGS -CPPFLAGS=$CPPFLAGS" -I/usr/include -I/usr/local/include "$x_cflags - -header_gl_h=xno -header_glu_h=xno -AC_TRY_CPP( -[ -#include -], -[ -echo "checking for GL/gl.h... yes"; -gl_includes=$CPPFLAGS; -header_gl_h=xyes; -] -, -[ -echo "checking for GL/gl.h... no"; -header_gl_h=xno; -]) - -if test $header_gl_h = xyes; then -AC_TRY_CPP( -[ -#include -#include -], -[ -echo "checking for GL/glu.h... yes"; -glu_includes=$CPPFLAGS; -header_glu_h=xyes; -] -, -[ -echo "checking for GL/glu.h... no"; -header_glu_h=xno; -]) -fi - -have_gl=no -have_glu=no - -if test $header_gl_h = xyes; then -AC_CHECK_LIB( -GL, -glBindTexture, -have_gl=yes, -[], --L/usr/local/lib -lGL $x_libs $x_ldflags $x_cflags $LIBS_GL -lm) -fi -if test "x$have_gl" = "xyes"; then -gl_includes=$gl_includes -gl_ldflags="$gl_ldflags -L/usr/local/lib -lGL $x_libs $x_ldflags $x_cflags $LIBS_GL -lm"; -gl_libs=$gl_libs" -lGL" -AC_DEFINE(HAVE_GL) -fi - -if test $header_glu_h = xyes; then -AC_CHECK_LIB( -GLU, -gluBuild2DMipmaps, -have_glu=yes, -echo "WARNING:......."; -echo "no libGLU was found. This means filtered (anti-aliased) scaling down"; -echo "of images will be disabled."; -echo "Please read the config.log file for more information as to why this library"; -echo "was not found."; -, -$gl_ldflags -lGL -lGLU) -AC_CHECK_LIB( -GLU, -gluTessBeginPolygon, -have_glu=yes, -echo ""; -echo "ERROR: evas needs a system with libGLU 1.3"; -echo "You can obtain it from:"; -echo "http://www.mesa3d.org/downloads/sgi.html"; -echo "You will need to obtain the SGI'd libGLU."; -echo "debian: download the rpm and use alien to convert it"; -echo ""; -have_glu=no; -, -$gl_ldflags -lGL -lGLU) -fi - -if test have_gl = no; then - echo "WARNING:......." - echo "no OpenGL libraries / headers found. This means no GL support will be" - echo "built into Evas. Ifapplications request 3D Hardware rendering from" - echo "evas, they will be forcibly moved back to using software alpha" - echo "rendering." - echo "Please read the config.log file for more information as to why this library" - echo "was not found." -fi -fi -CPPFLAGS=$PREV_CPPFLAGS - -imlib2_includes=`imlib2-config --cflags` -imlib2_libs=`imlib2-config --libs` - -AC_SUBST(x_cflags) -AC_SUBST(x_includes) -AC_SUBST(x_ldflags) -AC_SUBST(x_libs) -AC_SUBST(gl_includes) -AC_SUBST(gl_ldflags) -AC_SUBST(gl_libs) -AC_SUBST(imlib2_includes) -AC_SUBST(imlib2_libs) -AC_SUBST(ttf_includes) -AC_SUBST(ttf_libs) - -aclocaldir=$datadir"/aclocal" -if test X"$aclocal_usr" = Xyes; then - aclocaldir="/usr/share/aclocal" -fi - -AC_SUBST(aclocaldir) - -AC_OUTPUT([ -Makefile -src/Makefile -test/Makefile -test/img/Makefile -test/fnt/Makefile -evas-config -doc/Makefile -debian/Makefile -], [ -chmod +x evas-config -]) diff --git a/legacy/evas/debian/.cvsignore b/legacy/evas/debian/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/legacy/evas/debian/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/legacy/evas/debian/Makefile.am b/legacy/evas/debian/Makefile.am deleted file mode 100644 index ed1efe672a..0000000000 --- a/legacy/evas/debian/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -EXTRA_DIST = \ -changelog \ -control \ -copyright \ -libevas-dev.files \ -libevas-sample.dirs \ -libevas-sample.files \ -libevas.dirs \ -libevas.files \ -libevas0.postinst \ -rules diff --git a/legacy/evas/debian/changelog b/legacy/evas/debian/changelog deleted file mode 100644 index d8a492f219..0000000000 --- a/legacy/evas/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -evas (0.6.0-0cvs2001103001) unstable; urgency=low - - * a CVS release - - -- Laurence J. Lane Tue, 30 Oct 2001 13:03:50 +0000 diff --git a/legacy/evas/debian/control b/legacy/evas/debian/control deleted file mode 100644 index 8f0614033e..0000000000 --- a/legacy/evas/debian/control +++ /dev/null @@ -1,48 +0,0 @@ -Source: evas -Section: libs -Priority: optional -Maintainer: Laurence J. Lane -Build-Depends: xlibs-dev, xlibmesa-dev, libttf-dev, libimlib2-dev, debhelper (>=2.0) -Standards-Version: 3.5.6.0 - -Package: libevas0 -Section: libs -Architecture: any -Suggests: evas-demo -Depends: ${shlibs:Depends} -Description: enlightenment advanced canvas library - Evas is an advanced canvas library, providing three backends for - rendering: X11 (without some features like alpha-blending), imlib2, or - OpenGL (hardware accelerated). Due to its simple API, evas can be - developed with rapidly, and cleanly. - Install evas if you want to develop applications against the only - hardware-accelerated canvas library, or if you want to try out the - applications under development. - -Package: libevas0-dev -Section: devel -Architecture: any -Depends: libevas0 (= ${Source-Version}), libc6-dev -Description: development files for libevas - Headers and static libraries required to develop against evas. - -Package: evas-doc -Section: doc -Architecture: all -Depends: -Description: TFM for evas - The evas application programming interface documentation is presented - in pdf and sdw format. - -Package: evas-demo -Section: graphics -Architecture: any -Depends: ${shlibs:Depends} -Description: evas library demo - Evas is an advanced canvas library, providing three backends for - rendering: X11 (without some features like alpha-blending), imlib2, or - OpenGL (hardware accelerated). Due to its simple API, evas can be - developed with rapidly, and cleanly. - Install evas if you want to develop applications against the only - hardware-accelerated canvas library, or if you want to try out the - applications under development. diff --git a/legacy/evas/debian/copyright b/legacy/evas/debian/copyright deleted file mode 100644 index 7b4c5060bb..0000000000 --- a/legacy/evas/debian/copyright +++ /dev/null @@ -1,27 +0,0 @@ -This package was debianized by Laurence J. Lane on -Sat, 28 Oct 2000 17:56:46 -0400. - -The source code was downloaded from: - - http://download.sourceforge.net/enlightenment/evas-0.5.0.tar.gz - -Copyright (C) 2000 Carsten Haitzler and various contributors (see AUTHORS) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies of the Software, its documentation and marketing & publicity -materials, and acknowledgment shall be given in the documentation, materials -and software packages that this Software was used. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/legacy/evas/debian/evas-config.3 b/legacy/evas/debian/evas-config.3 deleted file mode 100644 index 86a5e56fe3..0000000000 --- a/legacy/evas/debian/evas-config.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\" This -*- nroff -*- file has been generated from -.\" DocBook SGML with docbook-to-man on Debian GNU/Linux. -...\" -...\" transcript compatibility for postscript use. -...\" -...\" synopsis: .P! -...\" -.de P! -\\&. -.fl \" force out current output buffer -\\!%PB -\\!/showpage{}def -...\" the following is from Ken Flowers -- it prevents dictionary overflows -\\!/tempdict 200 dict def tempdict begin -.fl \" prolog -.sy cat \\$1\" bring in postscript file -...\" the following line matches the tempdict above -\\!end % tempdict % -\\!PE -\\!. -.sp \\$2u \" move below the image -.. -.de pF -.ie \\*(f1 .ds f1 \\n(.f -.el .ie \\*(f2 .ds f2 \\n(.f -.el .ie \\*(f3 .ds f3 \\n(.f -.el .ie \\*(f4 .ds f4 \\n(.f -.el .tm ? font overflow -.ft \\$1 -.. -.de fP -.ie !\\*(f4 \{\ -. ft \\*(f4 -. ds f4\" -' br \} -.el .ie !\\*(f3 \{\ -. ft \\*(f3 -. ds f3\" -' br \} -.el .ie !\\*(f2 \{\ -. ft \\*(f2 -. ds f2\" -' br \} -.el .ie !\\*(f1 \{\ -. ft \\*(f1 -. ds f1\" -' br \} -.el .tm ? font underflow -.. -.ds f1\" -.ds f2\" -.ds f3\" -.ds f4\" -'\" t -.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n -.TH "evas-config" "3" -.SH "NAME" -evas-config \(em evas library build dependecies -.SH "SYNOPSIS" -.PP -\fBevas-config\fP -.SH "DESCRIPTION" -.PP -This manual page documents briefly the -\fBevas-config\fP command. -.PP -This manual page was written for the \fBDebian GNU/Linux\fP distribution -because the original program does not have a manual page. - -.PP -\fBevas-config\fP is a program used to provide info -libs and cflags parameters required to build appications that use the evas -library. -.SH "AUTHOR" -.PP -This manual page was written by Laurence J. Lane (ljlane@debian.org) for -the \fBDebian GNU/Linux\fP system (but may be used by others). -...\" created by instant / docbook-to-man, Mon 28 May 2001, 15:04 diff --git a/legacy/evas/debian/evas_test.1 b/legacy/evas/debian/evas_test.1 deleted file mode 100644 index 7e73555261..0000000000 --- a/legacy/evas/debian/evas_test.1 +++ /dev/null @@ -1,78 +0,0 @@ -.\" This -*- nroff -*- file has been generated from -.\" DocBook SGML with docbook-to-man on Debian GNU/Linux. -...\" -...\" transcript compatibility for postscript use. -...\" -...\" synopsis: .P! -...\" -.de P! -\\&. -.fl \" force out current output buffer -\\!%PB -\\!/showpage{}def -...\" the following is from Ken Flowers -- it prevents dictionary overflows -\\!/tempdict 200 dict def tempdict begin -.fl \" prolog -.sy cat \\$1\" bring in postscript file -...\" the following line matches the tempdict above -\\!end % tempdict % -\\!PE -\\!. -.sp \\$2u \" move below the image -.. -.de pF -.ie \\*(f1 .ds f1 \\n(.f -.el .ie \\*(f2 .ds f2 \\n(.f -.el .ie \\*(f3 .ds f3 \\n(.f -.el .ie \\*(f4 .ds f4 \\n(.f -.el .tm ? font overflow -.ft \\$1 -.. -.de fP -.ie !\\*(f4 \{\ -. ft \\*(f4 -. ds f4\" -' br \} -.el .ie !\\*(f3 \{\ -. ft \\*(f3 -. ds f3\" -' br \} -.el .ie !\\*(f2 \{\ -. ft \\*(f2 -. ds f2\" -' br \} -.el .ie !\\*(f1 \{\ -. ft \\*(f1 -. ds f1\" -' br \} -.el .tm ? font underflow -.. -.ds f1\" -.ds f2\" -.ds f3\" -.ds f4\" -'\" t -.ta 8n 16n 24n 32n 40n 48n 56n 64n 72n -.TH "evas_test" "1" -.SH "NAME" -evas_test \(em evas library demonstartion program -.SH "SYNOPSIS" -.PP -\fBevas_test\fP -.SH "DESCRIPTION" -.PP -This manual page documents briefly the -\fBevas_test\fP command. -.PP -This manual page was written for the \fBDebian GNU/Linux\fP distribution -because the original program does not have a manual page. - -.PP -\fBevas_test\fP and \fBevas_test_old\fP are programs that demonstrate the capabilites of evas, the enlightenment -canvasing library. run "evas_test_old -h" for a description of command -line options. -.SH "AUTHOR" -.PP -This manual page was written by Laurence J. Lane (ljlane@debian.org) for -the \fBDebian GNU/Linux\fP system (but may be used by others). -...\" created by instant / docbook-to-man, Mon 28 May 2001, 15:04 diff --git a/legacy/evas/debian/libevas-dev.files b/legacy/evas/debian/libevas-dev.files deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/legacy/evas/debian/libevas-sample.dirs b/legacy/evas/debian/libevas-sample.dirs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/legacy/evas/debian/libevas-sample.files b/legacy/evas/debian/libevas-sample.files deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/legacy/evas/debian/libevas.dirs b/legacy/evas/debian/libevas.dirs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/legacy/evas/debian/libevas.files b/legacy/evas/debian/libevas.files deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/legacy/evas/debian/libevas0.postinst b/legacy/evas/debian/libevas0.postinst deleted file mode 100644 index 0284698614..0000000000 --- a/legacy/evas/debian/libevas0.postinst +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -e - -if test "$1" = "configure"; then - ldconfig -fi - -#DEBHELPER# - diff --git a/legacy/evas/debian/rules b/legacy/evas/debian/rules deleted file mode 100644 index f6ed02ad2c..0000000000 --- a/legacy/evas/debian/rules +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# GNU copyright 1997 by Joey Hess. - -export DH_COMPAT=3 -export DH_OPTIONS - -INSTALL = /usr/bin/install -p -BUILDDIR = debian/build -package = libevas0 -CONFIGURE_OPTS = --datadir=/usr/share --prefix=/usr - -configure: $(BUILDDIR)/configure-stamp -$(BUILDDIR)/configure-stamp: - $(INSTALL) -d $(BUILDDIR) - cd $(BUILDDIR); datadir=/usr/share $(CURDIR)/autogen.sh $(CONFIGURE_OPTS) - touch $@ - -build: configure $(BUILDDIR)/build-stamp -$(BUILDDIR)/build-stamp: - dh_testdir - $(MAKE) -C $(BUILDDIR) - touch $@ - -clean: - dh_testdir - -$(MAKE) distclean - -rm -rf $(BUILDDIR) - dh_clean - -install: DH_OPTIONS= -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - $(MAKE) install -C $(BUILDDIR) DESTDIR=$(CURDIR)/debian/$(package)/ - - $(INSTALL) -d debian/$(package)-dev/usr/lib - $(INSTALL) -d debian/$(package)-dev/usr/bin - $(INSTALL) -d debian/$(package)-dev/usr/share - $(INSTALL) -d debian/evas-doc/usr/share/doc/evas-doc/ - $(INSTALL) -d debian/evas-demo/usr/bin - - rm -rvf debian/$(package)/usr/share/evas/doc/ - #mv debian/$(package)/usr/share/aclocal debian/$(package)-dev/usr/share/ - $(INSTALL) -D debian/$(package)/@aclocaldir@/evas.m4 debian/$(package)-dev/usr/share/aclocal/evas.m4 - rm -rf debian/$(package)/@aclocaldir@/ - mv debian/$(package)/usr/share debian/evas-demo/usr - - mv debian/$(package)/usr/include debian/$(package)-dev/usr - mv debian/$(package)/usr/lib/*.so debian/$(package)-dev/usr/lib/ - mv debian/$(package)/usr/lib/*.la debian/$(package)-dev/usr/lib/ - mv debian/$(package)/usr/lib/*.a debian/$(package)-dev/usr/lib/ - mv debian/$(package)/usr/bin/evas-config debian/$(package)-dev/usr/bin/ - mv debian/$(package)/usr/bin/evas_test* debian/evas-demo/usr/bin/ - - - $(INSTALL) -m0644 doc/*.pdf doc/*.sdw debian/evas-doc/usr/share/doc/evas-doc - - $(INSTALL) -d debian/evas-demo/usr/share/man/man1 - $(INSTALL) debian/evas_test.1 debian/evas-demo/usr/share/man/man1/ - $(INSTALL) -d debian/$(package)-dev/usr/share/man/man3 - $(INSTALL) debian/evas-config.3 debian/$(package)-dev/usr/share/man/man3/ - cd debian/evas-demo/usr/share/man/man1; ln -s evas_test.1.gz evas_test_old.1.gz - - rm -rvf debian/evas-demo/usr/share/evas/evas/doc - -binary-indep: DH_OPTIONS=-i -binary-indep: build install - dh_testdir - dh_testroot - dh_installdocs AUTHORS README - dh_installchangelogs - dh_compress -Xpdf -Xsdw - dh_fixperms - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -binary-arch: DH_OPTIONS=-a -binary-arch: build install - dh_testdir - dh_testroot - dh_installdocs AUTHORS README - dh_installmenu - dh_installchangelogs - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_makeshlibs - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch - -stuff: - docbook-to-man evas_test.1.sgml > evas_test.1 - docbook-to-man evas-config.3.sgml > evas-config.3 - -.PHONY: build clean binary-indep binary-arch binary install diff --git a/legacy/evas/doc/.cvsignore b/legacy/evas/doc/.cvsignore deleted file mode 100644 index 3dda72986f..0000000000 --- a/legacy/evas/doc/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile.in -Makefile diff --git a/legacy/evas/doc/Makefile.am b/legacy/evas/doc/Makefile.am deleted file mode 100644 index e0d0864d28..0000000000 --- a/legacy/evas/doc/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -EXTRA_DIST = \ -evas.sdw evas.pdf -evasdir = $(datadir)/evas/doc -evas_DATA = \ -evas.sdw evas.pdf diff --git a/legacy/evas/doc/evas.pdf b/legacy/evas/doc/evas.pdf deleted file mode 100644 index 4056997f0b..0000000000 Binary files a/legacy/evas/doc/evas.pdf and /dev/null differ diff --git a/legacy/evas/doc/evas.sdw b/legacy/evas/doc/evas.sdw deleted file mode 100644 index 8c6910aeb7..0000000000 Binary files a/legacy/evas/doc/evas.sdw and /dev/null differ diff --git a/legacy/evas/evas-config.in b/legacy/evas/evas-config.in deleted file mode 100644 index 7da1319b11..0000000000 --- a/legacy/evas/evas-config.in +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -exec_prefix_set=no - -usage="\ -Usage: evas-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]" - -if test $# -eq 0; then - echo "${usage}" 1>&2 - exit 1 -fi - -while test $# -gt 0; do - case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case $1 in - --prefix=*) - prefix=$optarg - if test $exec_prefix_set = no ; then - exec_prefix=$optarg - fi - ;; - --prefix) - echo $prefix - ;; - --exec-prefix=*) - exec_prefix=$optarg - exec_prefix_set=yes - ;; - --exec-prefix) - echo $exec_prefix - ;; - --version) - echo @VERSION@ - ;; - --cflags) - if test @includedir@ != /usr/include ; then - includes=-I@includedir@ - fi - echo $includes @x_cflags@ @gl_includes@ @imlib2_includes@ - ;; - --libs) - libdirs=-L@libdir@ - echo $libdirs -levas @gl_ldflags@ @gl_libs@ @LDFLAGS@ @x_libs@ @x_ldflags@ @imlib2_libs@ - ;; - *) - echo "${usage}" 1>&2 - exit 1 - ;; - esac - shift -done - -exit 0 diff --git a/legacy/evas/evas.m4 b/legacy/evas/evas.m4 deleted file mode 100644 index 89e9ed4a57..0000000000 --- a/legacy/evas/evas.m4 +++ /dev/null @@ -1,198 +0,0 @@ -# Configure paths for Evas -# Conrad Parker 2001-01-23 -# blatantly ripped from gtk.m4, Owen Taylor 97-11-3 - -dnl AM_PATH_EVAS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) -dnl Test for Evas, and define EVAS_CFLAGS and EVAS_LIBS -dnl -AC_DEFUN(AM_PATH_EVAS, -[dnl -dnl Get the cflags and libraries from the evas-config script -dnl -AC_ARG_WITH(evas-prefix,[ --with-evas-prefix=PFX Prefix where Evas is installed (optional)], - evas_config_prefix="$withval", evas_config_prefix="") -AC_ARG_WITH(evas-exec-prefix,[ --with-evas-exec-prefix=PFX Exec prefix where Evas is installed (optional)], - evas_config_exec_prefix="$withval", evas_config_exec_prefix="") -AC_ARG_ENABLE(evastest, [ --disable-evastest Do not try to compile and run a test Evas program], - , enable_evastest=yes) - - if test x$evas_config_exec_prefix != x ; then - evas_config_args="$evas_config_args --exec-prefix=$evas_config_exec_prefix" - if test x${EVAS_CONFIG+set} != xset ; then - EVAS_CONFIG=$evas_config_exec_prefix/bin/evas-config - fi - fi - if test x$evas_config_prefix != x ; then - evas_config_args="$evas_config_args --prefix=$evas_config_prefix" - if test x${EVAS_CONFIG+set} != xset ; then - EVAS_CONFIG=$evas_config_prefix/bin/evas-config - fi - fi - - AC_PATH_PROG(EVAS_CONFIG, evas-config, no) - min_evas_version=ifelse([$1], ,0.0.3,$1) - AC_MSG_CHECKING(for Evas - version >= $min_evas_version) - no_evas="" - if test "$EVAS_CONFIG" = "no" ; then - no_evas=yes - else - EVAS_CFLAGS=`$EVAS_CONFIG $evas_config_args --cflags` - EVAS_LIBS=`$EVAS_CONFIG $evas_config_args --libs` - evas_config_major_version=`$EVAS_CONFIG $evas_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - evas_config_minor_version=`$EVAS_CONFIG $evas_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - evas_config_micro_version=`$EVAS_CONFIG $evas_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - -dnl ********************************************************************** -dnl Evas cannot currently report its own version ; version info is not -dnl given in Evas.h -dnl Thus, the "enable_evastest" stuff is currently disabled, enable once -dnl you can determine the currently installed version by querying Evas[.h] -dnl -dnl K. 2001-01-23 -dnl ********************************************************************** - -dnl if test "x$enable_evastest" = "xyes" ; then -dnl ac_save_CFLAGS="$CFLAGS" -dnl ac_save_LIBS="$LIBS" -dnl CFLAGS="$CFLAGS $EVAS_CFLAGS" -dnl LIBS="$EVAS_LIBS $LIBS" -dnl dnl -dnl dnl Now check if the installed Evas is sufficiently new. (Also sanity -dnl dnl checks the results of evas-config to some extent -dnl dnl -dnl rm -f conf.evastest -dnl AC_TRY_RUN([ -dnl #include -dnl #include -dnl #include -dnl -dnl int -dnl main () -dnl { -dnl int major, minor, micro; -dnl char *tmp_version; -dnl -dnl system ("touch conf.evastest"); -dnl -dnl /* HP/UX 9 (%@#!) writes to sscanf strings */ -dnl tmp_version = g_strdup("$min_evas_version"); -dnl if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { -dnl printf("%s, bad version string\n", "$min_evas_version"); -dnl exit(1); -dnl } -dnl -dnl if ((evas_major_version != $evas_config_major_version) || -dnl (evas_minor_version != $evas_config_minor_version) || -dnl (evas_micro_version != $evas_config_micro_version)) -dnl { -dnl printf("\n*** 'evas-config --version' returned %d.%d.%d, but Evas (%d.%d.%d)\n", -dnl $evas_config_major_version, $evas_config_minor_version, $evas_config_micro_version, -dnl evas_major_version, evas_minor_version, evas_micro_version); -dnl printf ("*** was found! If evas-config was correct, then it is best\n"); -dnl printf ("*** to remove the old version of Evas. You may also be able to fix the error\n"); -dnl printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); -dnl printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); -dnl printf("*** required on your system.\n"); -dnl printf("*** If evas-config was wrong, set the environment variable EVAS_CONFIG\n"); -dnl printf("*** to point to the correct copy of evas-config, and remove the file config.cache\n"); -dnl printf("*** before re-running configure\n"); -dnl } -dnl #if defined (EVAS_MAJOR_VERSION) && defined (EVAS_MINOR_VERSION) && defined (EVAS_MICRO_VERSION) -dnl else if ((evas_major_version != EVAS_MAJOR_VERSION) || -dnl (evas_minor_version != EVAS_MINOR_VERSION) || -dnl (evas_micro_version != EVAS_MICRO_VERSION)) -dnl { -dnl printf("*** Evas header files (version %d.%d.%d) do not match\n", -dnl EVAS_MAJOR_VERSION, EVAS_MINOR_VERSION, EVAS_MICRO_VERSION); -dnl printf("*** library (version %d.%d.%d)\n", -dnl evas_major_version, evas_minor_version, evas_micro_version); -dnl } -dnl #endif /* defined (EVAS_MAJOR_VERSION) ... */ -dnl else -dnl { -dnl if ((evas_major_version > major) || -dnl ((evas_major_version == major) && (evas_minor_version > minor)) || -dnl ((evas_major_version == major) && (evas_minor_version == minor) && (evas_micro_version >= micro))) -dnl { -dnl return 0; -dnl } -dnl else -dnl { -dnl printf("\n*** An old version of Evas (%d.%d.%d) was found.\n", -dnl evas_major_version, evas_minor_version, evas_micro_version); -dnl printf("*** You need a version of Evas newer than %d.%d.%d. The latest version of\n", -dnl major, minor, micro); -dnl printf("*** Evas is always available from ftp://ftp.enlightenment.org.\n"); -dnl printf("***\n"); -dnl printf("*** If you have already installed a sufficiently new version, this error\n"); -dnl printf("*** probably means that the wrong copy of the evas-config shell script is\n"); -dnl printf("*** being found. The easiest way to fix this is to remove the old version\n"); -dnl printf("*** of Evas, but you can also set the EVAS_CONFIG environment to point to the\n"); -dnl printf("*** correct copy of evas-config. (In this case, you will have to\n"); -dnl printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); -dnl printf("*** so that the correct libraries are found at run-time))\n"); -dnl } -dnl } -dnl return 1; -dnl } -dnl ],, no_evas=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) -dnl CFLAGS="$ac_save_CFLAGS" -dnl LIBS="$ac_save_LIBS" -dnl fi -dnl ********************************************************************** - - fi - if test "x$no_evas" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$EVAS_CONFIG" = "no" ; then - echo "*** The evas-config script installed by Evas could not be found" - echo "*** If Evas was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the EVAS_CONFIG environment variable to the" - echo "*** full path to evas-config." - else - if test -f conf.evastest ; then - : - else - echo "*** Could not run Evas test program, checking why..." - CFLAGS="$CFLAGS $EVAS_CFLAGS" - LIBS="$LIBS $EVAS_LIBS" - AC_TRY_LINK([ -#include -#include -], [ return ((evas_major_version) || (evas_minor_version) || (evas_micro_version)); ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding Evas or finding the wrong" - echo "*** version of Evas. If it is not finding Evas, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" - echo "***" - echo "*** If you have a RedHat 5.0 system, you should remove the Evas package that" - echo "*** came with the system with the command" - echo "***" - echo "*** rpm --erase --nodeps evas evas-devel" ], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means Evas was incorrectly installed" - echo "*** or that you have moved Evas since it was installed. In the latter case, you" - echo "*** may want to edit the evas-config script: $EVAS_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - EVAS_CFLAGS="" - EVAS_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(EVAS_CFLAGS) - AC_SUBST(EVAS_LIBS) - rm -f conf.evastest -]) diff --git a/legacy/evas/evas.spec b/legacy/evas/evas.spec deleted file mode 100644 index 16efd15cdd..0000000000 --- a/legacy/evas/evas.spec +++ /dev/null @@ -1,79 +0,0 @@ -# this is NOT relocatable, unless you alter the patch! -%define name evas -%define ver 0.6.0 -%define rel 1 -%define prefix /usr - -# NB: Raster and I talked about it, and heh says evas_test shouldn't be in -# the rpms, since it's not geared at all towards end users. I'm commenting -# out and withholding the patch to honor that.. - -Summary: Enlightened Canvas Library -Name: %{name} -Version: %{ver} -Release: %{rel} -Copyright: BSD -Group: User Interface/X -URL: http://www.enlightenment.org/ -Packager: Term -Vendor: The Enlightenment Development Team -Source: ftp://ftp.enlightenment.org/enlightenment/%{name}-%{ver}.tar.gz -BuildRoot: /var/tmp/%{name}-root -Requires: imlib2 >= 1.0.4 - -%description -Evas is an advanced canvas library, providing three backends for -rendering: X11 (without some features like alpha-blending), imlib2, or -OpenGL (hardware accelerated). Due to its simple API, evas can be -developed with rapidly, and cleanly. - -Install evas if you want to develop applications against the only -hardware-accelerated canvas library, or if you want to try out the -applications under development. - -%package devel -Summary: Enlightened Canvas Library headers and development libraries. -Group: Development/Libraries -Requires: %{name} = %{ver} - -%description devel -Evas development headers and libraries. - -%prep -%setup -q - -%build -if [ -e ./configure ] -then - ./configure --prefix=%{prefix} -else - ./autogen.sh --prefix=%{prefix} -fi -make - -%install -make prefix=$RPM_BUILD_ROOT%{prefix} install - -%post -/sbin/ldconfig - -%postun -/sbin/ldconfig - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root) -%{prefix}/lib/libevas.so.* -%{prefix}/bin/evas_* -%{prefix}/share/evas/fnt -%{prefix}/share/evas/img - -%files devel -%defattr(-,root,root) -%{prefix}/lib/libevas.so -%{prefix}/lib/libevas.*a -%{prefix}/include/Evas.h -%{prefix}/bin/evas-config -%{prefix}/share/evas/doc diff --git a/legacy/evas/src/.cvsignore b/legacy/evas/src/.cvsignore deleted file mode 100644 index 8ae4058a26..0000000000 --- a/legacy/evas/src/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -.icons -Makefile -Makefile.in -.libs -.deps -libevas.la -evas_main.lo -*.lo diff --git a/legacy/evas/src/Evas.h b/legacy/evas/src/Evas.h deleted file mode 100644 index 8cf018bd7e..0000000000 --- a/legacy/evas/src/Evas.h +++ /dev/null @@ -1,257 +0,0 @@ -#ifndef _EVAS_H -#define _EVAS_H 1 - -#include -#include - -/* types */ -#ifndef _EVAS_PRIVATE_H -typedef void * Evas; -typedef void * Evas_Gradient; -typedef void * Evas_Object; -#endif -typedef struct _Evas_List * Evas_List; -typedef struct _Evas_Point * Evas_Point; - -/* public structs */ -struct _Evas_Point -{ - double x, y; -}; - -struct _Evas_List -{ - Evas_List prev, next; - void *data; - /* private members - DONT TOUCH */ - Evas_List last; -}; - -/* enums */ -#define RENDER_METHOD_COUNT 5 -enum _Evas_Render_Method -{ - RENDER_METHOD_ALPHA_SOFTWARE, /* imlib2 rendering to any drawable */ - RENDER_METHOD_BASIC_HARDWARE, /* X11 pixmap rendering to any drawable */ - RENDER_METHOD_3D_HARDWARE, /* oepngl rendering to windows only */ - RENDER_METHOD_ALPHA_HARDWARE, /* unimplimented */ - RENDER_METHOD_IMAGE /* imlib2 rendering to imlib image target */ -}; - -enum _Evas_Callback_Type -{ - CALLBACK_MOUSE_IN, - CALLBACK_MOUSE_OUT, - CALLBACK_MOUSE_DOWN, - CALLBACK_MOUSE_UP, - CALLBACK_MOUSE_MOVE, - CALLBACK_FREE -}; - -enum _Evas_Image_Format -{ - IMAGE_FORMAT_BGRA, - IMAGE_FORMAT_ARGB, - IMAGE_FORMAT_RGB, - IMAGE_FORMAT_GRAY -}; - -/* enum types */ -typedef enum _Evas_Callback_Type Evas_Callback_Type; -typedef enum _Evas_Image_Format Evas_Image_Format; -typedef enum _Evas_Render_Method Evas_Render_Method; - -/* functions */ -#ifdef __cplusplus -extern "C" { -#endif - -/* create and destroy */ -Evas evas_new_all(Display *display, Window parent_window, - int x, int y, int w, int h, - Evas_Render_Method render_method, - int colors, int font_cache, int image_cache, - char *font_dir); -Window evas_get_window(Evas e); -Display *evas_get_display(Evas e); -Visual *evas_get_visual(Evas e); -Colormap evas_get_colormap(Evas e); -int evas_get_colors(Evas e); -Imlib_Image evas_get_image(Evas e); -Evas_Render_Method evas_get_output_method(Evas e); -Evas evas_new(void); -void evas_free(Evas e); - -/* for exposes or forced redraws (relative to output drawable) */ -void evas_update_rect(Evas e, int x, int y, int w, int h); -/* for when the evas isnt fully visible you can clip out rects that are */ -/* full obscured rects of the evas (ie windows ontop) */ -void evas_add_obscured_rect(Evas e, int x, int y, int w, int h); -void evas_clear_obscured_rects(Evas e); - -/* drawing */ -Imlib_Updates evas_render_updates(Evas e); -void evas_render(Evas e); - -/* query for settings to use */ -Visual *evas_get_optimal_visual(Evas e, Display *disp); -Colormap evas_get_optimal_colormap(Evas e, Display *disp); -void evas_get_drawable_size(Evas e, int *w, int *h); -void evas_get_viewport(Evas e, double *x, double *y, double *w, double *h); - -/* the output settings */ -void evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c); -void evas_set_output_image(Evas e, Imlib_Image image); -void evas_set_output_colors(Evas e, int colors); -void evas_set_output_size(Evas e, int w, int h); -void evas_set_output_viewport(Evas e, double x, double y, double w, double h); -void evas_set_output_method(Evas e, Evas_Render_Method method); -void evas_set_scale_smoothness(Evas e, int smooth); - -/* clipping - for now you can only use rectangles as clip objects */ -void evas_set_clip(Evas e, Evas_Object o, Evas_Object clip); -void evas_unset_clip(Evas e, Evas_Object o); -Evas_Object evas_get_clip_object(Evas e, Evas_Object o); -Evas_List evas_get_clip_list(Evas e, Evas_Object o); - -/* deleting objects */ -void evas_del_object(Evas e, Evas_Object o); - -/* adding objects */ -Evas_Object evas_add_image_from_file(Evas e, const char *file); -Evas_Object evas_add_image_from_data(Evas e, void *data, Evas_Image_Format format, int w, int h); -Evas_Object evas_add_text(Evas e, char *font, int size, char *text); -Evas_Object evas_add_rectangle(Evas e); -Evas_Object evas_add_line(Evas e); -Evas_Object evas_add_gradient_box(Evas e); -Evas_Object evas_add_poly(Evas e); - -/* set object settings */ -void evas_set_image_file(Evas e, Evas_Object o, const char *file); -void evas_set_image_data(Evas e, Evas_Object o, void *data, Evas_Image_Format format, int w, int h); -void evas_set_image_fill(Evas e, Evas_Object o, double x, double y, double w, double h); -void evas_set_image_border(Evas e, Evas_Object o, int l, int r, int t, int b); -void evas_set_color(Evas e, Evas_Object o, int r, int g, int b, int a); -void evas_set_text(Evas e, Evas_Object o, char *text); -void evas_set_font(Evas e, Evas_Object o, char *font, int size); -void evas_set_gradient(Evas e, Evas_Object o, Evas_Gradient grad); -void evas_set_angle(Evas e, Evas_Object o, double angle); -void evas_set_zoom_scale(Evas e, Evas_Object o, int scale); -void evas_set_line_xy(Evas e, Evas_Object o, double x1, double y1, double x2, double y2); -void evas_set_pass_events(Evas e, Evas_Object o, int pass_events); -void evas_add_point(Evas e, Evas_Object o, double x, double y); -void evas_clear_points(Evas e, Evas_Object o); - -/* cache settings for performance */ -void evas_set_font_cache(Evas e, int size); -int evas_get_font_cache(Evas e); -void evas_flush_font_cache(Evas e); -void evas_set_image_cache(Evas e, int size); -int evas_get_image_cache(Evas e); -void evas_flush_image_cache(Evas e); - -/* font path */ -void evas_font_add_path(Evas e, char *path); -void evas_font_del_path(Evas e, char *path); - -/* layer stacking for object */ -void evas_set_layer(Evas e, Evas_Object o, int l); -int evas_get_layer(Evas e, Evas_Object o); -/* ** ** not implimented yet ** ** */void evas_set_layer_store(Evas e, int l, int store); - -/* gradient creating / deletion / modification */ -Evas_Gradient evas_gradient_new(void); -void evas_gradient_free(Evas_Gradient grad); -void evas_gradient_add_color(Evas_Gradient grad, int r, int g, int b, int a, int dist); - -/* stacking within a layer */ -void evas_raise(Evas e, Evas_Object o); -void evas_lower(Evas e, Evas_Object o); -void evas_stack_above(Evas e, Evas_Object o, Evas_Object above); -void evas_stack_below(Evas e, Evas_Object o, Evas_Object below); - -/* object geometry */ -void evas_move(Evas e, Evas_Object o, double x, double y); -void evas_resize(Evas e, Evas_Object o, double w, double h); -void evas_get_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double *h); - -/* object query */ -Evas_List evas_objects_in_rect(Evas e, double x, double y, double w, double h); -Evas_List evas_objects_at_position(Evas e, double x, double y); -Evas_Object evas_object_in_rect(Evas e, double x, double y, double w, double h); -Evas_Object evas_object_at_position(Evas e, double x, double y); -Evas_Object evas_object_get_named(Evas e, char *name); -void evas_object_set_name(Evas e, Evas_Object o, char *name); -char *evas_object_get_name(Evas e, Evas_Object o); -Evas_List evas_get_points(Evas e, Evas_Object o); - -/* object visibility */ -void evas_show(Evas e, Evas_Object o); -void evas_hide(Evas e, Evas_Object o); - -/* image query ops */ -int evas_get_image_alpha(Evas e, Evas_Object o); -void evas_get_image_size(Evas e, Evas_Object o, int *w, int *h); -void evas_get_image_border(Evas e, Evas_Object o, int *l, int *r, int *t, int *b); -Imlib_Load_Error evas_get_image_load_error(Evas e, Evas_Object o); - -/* coordinate space transforms */ -int evas_world_x_to_screen(Evas e, double x); -int evas_world_y_to_screen(Evas e, double y); -double evas_screen_x_to_world(Evas e, int x); -double evas_screen_y_to_world(Evas e, int y); - -/* text query ops */ -char *evas_get_text_string(Evas e, Evas_Object o); -char *evas_get_text_font(Evas e, Evas_Object o); -int evas_get_text_size(Evas e, Evas_Object o); -double evas_get_text_width(Evas e, Evas_Object o); -double evas_get_text_height(Evas e, Evas_Object o); -int evas_text_at_position(Evas e, Evas_Object o, double x, double y, double *char_x, double *char_y, double *char_w, double *char_h); -void evas_text_at(Evas e, Evas_Object o, int index, double *char_x, double *char_y, double *char_w, double *char_h); -void evas_text_get_ascent_descent(Evas e, Evas_Object o, double *ascent, double *descent); -void evas_text_get_max_ascent_descent(Evas e, Evas_Object o, double *ascent, double *descent); -void evas_text_get_advance(Evas e, Evas_Object o, double *h_advance, double *v_advance); -double evas_text_get_inset(Evas e, Evas_Object o); - -/* object query ops */ -void evas_get_color(Evas e, Evas_Object o, int *r, int *g, int *b, int *a); -Evas_Object evas_get_object_under_mouse(Evas e); - -/* data attachment ops */ -void evas_put_data(Evas e, Evas_Object o, char *key, void *data); -void *evas_get_data(Evas e, Evas_Object o, char *key); -void *evas_remove_data(Evas e, Evas_Object o, char *key); - -/* events */ -void evas_event_button_down(Evas e, int x, int y, int b); -void evas_event_button_up(Evas e, int x, int y, int b); -void evas_event_move(Evas e, int x, int y); -void evas_event_enter(Evas e); -void evas_event_leave(Evas e); -int evas_pointer_in(Evas e); -void evas_pointer_pos(Evas e, int *x, int *y); -int evas_pointer_buttons(Evas e); -void evas_pointer_ungrab(Evas e); - -/* callbacks */ -void evas_callback_add(Evas e, Evas_Object o, Evas_Callback_Type callback, void (*func) (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y), void *data); -void evas_callback_del(Evas e, Evas_Object o, Evas_Callback_Type callback); - -/* list ops */ -Evas_List evas_list_append(Evas_List list, void *data); -Evas_List evas_list_prepend(Evas_List list, void *data); -Evas_List evas_list_append_relative(Evas_List list, void *data, void *relative); -Evas_List evas_list_prepend_relative(Evas_List list, void *data, void *relative); -Evas_List evas_list_remove(Evas_List list, void *data); -Evas_List evas_list_remove_list(Evas_List list, Evas_List remove_list); -void * evas_list_find(Evas_List list, void *data); -Evas_List evas_list_free(Evas_List list); - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/legacy/evas/src/Evas_private.h b/legacy/evas/src/Evas_private.h deleted file mode 100644 index 28ce377805..0000000000 --- a/legacy/evas/src/Evas_private.h +++ /dev/null @@ -1,326 +0,0 @@ -#ifndef _EVAS_PRIVATE_H -#define _EVAS_PRIVATE_H 1 - -#include -#include -#ifdef WITH_DMALLOC -#include -#endif - -typedef struct _Evas * Evas; -typedef struct _Evas_Gradient * Evas_Gradient; -typedef struct _Evas_Object_Any * Evas_Object; -typedef struct _Evas_Object_Any * Evas_Object_Any; -typedef struct _Evas_Render_Data Evas_Render_Data; -typedef struct _Evas_Data * Evas_Data; -typedef struct _Evas_Layer * Evas_Layer; -typedef struct _Evas_Color_Point * Evas_Color_Point; -typedef struct _Evas_Callback * Evas_Callback; -typedef struct _Evas_Rectangle * Evas_Rectangle; -typedef struct _Evas_Object_Image * Evas_Object_Image; -typedef struct _Evas_Object_Text * Evas_Object_Text; -typedef struct _Evas_Object_Rectangle * Evas_Object_Rectangle; -typedef struct _Evas_Object_Line * Evas_Object_Line; -typedef struct _Evas_Object_Gradient_Box * Evas_Object_Gradient_Box; -typedef struct _Evas_Object_Poly * Evas_Object_Poly; - -#define OBJECT_IMAGE 1230 -#define OBJECT_TEXT 1231 -#define OBJECT_RECTANGLE 1232 -#define OBJECT_LINE 1233 -#define OBJECT_GRADIENT_BOX 1234 -#define OBJECT_POLYGON 1235 - -#define IF_OBJ(_o, _t) if (((Evas_Object)_o)->type != _t) - -#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \ -((x < (xx + ww)) && \ -(y < (yy + hh)) && \ -((x + w) > xx) && \ -((y + h) > yy)) - -#define CLIP_TO(_x, _y, _w, _h, _cx, _cy, _cw, _ch) \ -{ \ - if (INTERSECTS(_x, _y, _w, _h, _cx, _cy, _cw, _ch)) \ - { \ - if (_x < _cx) \ - { \ - _w += _x - _cx; \ - _x = _cx; \ - if (_w < 0) _w = 0; \ - } \ - if ((_x + _w) > (_cx + _cw)) \ - _w = _cx + _cw - _x; \ - if (_y < _cy) \ - { \ - _h += _y - _cy; \ - _y = _cy; \ - if (_h < 0) _h = 0; \ - } \ - if ((_y + _h) > (_cy + _ch)) \ - _h = _cy + _ch - _y; \ - } \ - else \ - { \ - _w = 0; _h = 0; \ - } \ - } - - -#include "Evas.h" -struct _Evas_Render_Data -{ - int *method[RENDER_METHOD_COUNT]; -}; - -struct _Evas -{ - struct { - Display *display; - Drawable drawable; - Visual *visual; - Colormap colormap; - unsigned char created_window; - unsigned char screen; - unsigned short colors; - Imlib_Image image; - - unsigned short drawable_width, drawable_height; - - struct { - double x, y, w, h; - } __attribute__ ((packed)) viewport; - - struct { - double mult_x, mult_y; - } __attribute__ ((packed)) val_cache; - - Evas_Render_Method render_method; - - Evas_Render_Data renderer_data; - - } - __attribute__ ((packed)) current, - __attribute__ ((packed)) previous; - - struct { - unsigned char in; - int x, y; - int buttons; - Evas_Object object, button_object; - } __attribute__ ((packed)) mouse; - - - void (*evas_renderer_data_free) (Evas _e); - - unsigned char changed; - - Evas_List layers; - Imlib_Updates updates; - Imlib_Updates obscures; -} __attribute__ ((packed)); - -struct _Evas_Color_Point -{ - unsigned char r, g, b, a; - int distance; -} __attribute__ ((packed)); - -struct _Evas_Gradient -{ - Evas_List color_points; - int references; -} __attribute__ ((packed)); - -struct _Evas_Rectangle -{ - int x, y, w, h; -} __attribute__ ((packed)); - -struct _Evas_Data -{ - char *key; - void *data; -} __attribute__ ((packed)); - -struct _Evas_Layer -{ - int layer; - Evas_List objects; - - struct { - unsigned char store; - } __attribute__ ((packed)) current, __attribute__ ((packed)) previous; - - Evas_Render_Data renderer_data; -} __attribute__ ((packed)); - -struct _Evas_Callback -{ - Evas_Callback_Type type; - void *data; - void (*callback) (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); -} __attribute__ ((packed)); - -struct _Evas_Object_Any -{ - unsigned char marker; - unsigned char changed; - unsigned short type; - struct { - double x, y, w, h; - unsigned char zoomscale; - int layer; - unsigned char visible; - unsigned char stacking; - } - __attribute__ ((packed)) current, - __attribute__ ((packed)) previous; - - unsigned char delete_me; - - unsigned char pass_events; - - void (*object_free) (Evas_Object _o); - void (*object_renderer_data_free) (Evas _e, Evas_Object _o); - - Evas_List callbacks; - Evas_List data; - - struct { - Evas_List list; - Evas_Object object; - unsigned char changed; - } __attribute__ ((packed)) clip; - - Evas_Render_Data renderer_data; - - char *name; -} __attribute__ ((packed)); - -struct _Evas_Object_Image -{ - struct _Evas_Object_Any object; - struct { - char *file; - unsigned char new_data; - unsigned char scale; - unsigned char alpha; - struct { - unsigned short w, h; - } __attribute__ ((packed)) image; - struct { - double x, y, w, h; - } __attribute__ ((packed)) fill; - struct { - unsigned short l, r, t, b; - } __attribute__ ((packed)) border; - struct { - unsigned char r, g, b, a; - } __attribute__ ((packed)) color; - } current, previous; - Imlib_Load_Error load_error; -} __attribute__ ((packed)); - -struct _Evas_Object_Text -{ - struct _Evas_Object_Any object; - struct { - char *text; - char *font; - unsigned short size; - struct { - int w, h; - } __attribute__ ((packed)) string; - unsigned char r, g, b, a; - } - __attribute__ ((packed)) current, - __attribute__ ((packed)) previous; -} __attribute__ ((packed)); - -struct _Evas_Object_Rectangle -{ - struct _Evas_Object_Any object; - struct { - unsigned char r, g, b, a; - } - __attribute__ ((packed)) current, - __attribute__ ((packed)) previous; -} __attribute__ ((packed)); - -struct _Evas_Object_Line -{ - struct _Evas_Object_Any object; - struct { - double x1, y1, x2, y2; - unsigned char r, g, b, a; - } - __attribute__ ((packed)) current, - __attribute__ ((packed)) previous; -} __attribute__ ((packed)); - -struct _Evas_Object_Gradient_Box -{ - struct _Evas_Object_Any object; - struct { - Evas_Gradient gradient; - unsigned char new_gradient; - double angle; - } - __attribute__ ((packed)) current, - __attribute__ ((packed)) previous; -} __attribute__ ((packed)); - -struct _Evas_Object_Poly -{ - struct _Evas_Object_Any object; - struct { - unsigned char r, g, b, a; - Evas_List points; - } - __attribute__ ((packed)) current, - __attribute__ ((packed)) previous; -} __attribute__ ((packed)); - -static void -_evas_get_current_clipped_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double *h) -{ - if (!o->current.visible) - { - *x = 0.0; - *y = 0.0; - *w = 0.0; - *h = 0.0; - return; - } - if (o->clip.object) - _evas_get_current_clipped_geometry(e, o->clip.object, x, y, w, h); - CLIP_TO(*x, *y, *w, *h, - o->current.x, o->current.y, o->current.w, o->current.h); -} - -static void -_evas_get_previous_clipped_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double *h) -{ - if (!o->previous.visible) - { - *x = 0.0; - *y = 0.0; - *w = 0.0; - *h = 0.0; - return; - } - if (o->clip.object) - _evas_get_current_clipped_geometry(e, o->clip.object, x, y, w, h); - CLIP_TO(*x, *y, *w, *h, - o->previous.x, o->previous.y, o->previous.w, o->previous.h); -} - -/* If it seems to be a string, try destringing it */ -#define TO_OBJECT(e, obj) \ - ((obj) && ((char *)(obj))[0] \ - ? evas_object_get_named((e), (char *)(obj)) \ - : (obj)) -#endif - - diff --git a/legacy/evas/src/Makefile.am b/legacy/evas/src/Makefile.am deleted file mode 100644 index f542f43bbc..0000000000 --- a/legacy/evas/src/Makefile.am +++ /dev/null @@ -1,64 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = 1.4 foreign - -# A list of all the files in the current directory which can be regenerated -MAINTAINERCLEANFILES = Makefile.in - -LIBS_X = @x_ldflags@ @x_libs@ -LIBS_IMLIB2 = @imlib2_libs@ -#LIBS_DB = -ledb -LIBS_GL = @gl_ldflags@ @gl_libs@ -LIBS_TTF = @ttf_libs@ -LIBS_EXTRA = -L/usr/local/lib - -CFLAGS_X = @x_cflags@ -CFLAGS_IMLIB2 = @imlib2_includes@ -#CFLAGS_DB = -CFLAGS_GL = @gl_includes@ -CFLAGS_TTF = @ttf_includes@ -CFLAGS_EXTRA = -I$(includedir) -I$(top_srcdir) -I/usr/local/include - -LIBS_ALL = $(LIBS_X) $(LIBS_IMLIB2) $(LIBS_GL) $(LIBS_TTF) $(LIBS_EXTRA) -CFLAGS_ALL = $(CFLAGS_X) $(CFLAGS_IMLIB2) $(CFLAGS_GL) $(CFLAGS_TTF) $(CFLAGS_EXTRA) - -INCLUDES = $(CFLAGS_ALL) \ - -DLIBDIR=\"$(libdir)\" \ - -DBINDIR=\"$(bindir)\" \ - -DDATADIR=\"$(datadir)\" - -lib_LTLIBRARIES = libevas.la -include_HEADERS = \ -Evas.h - -libevas_la_SOURCES = \ -evas_callbacks.c \ -evas_events.c \ -evas_fileless_image.c \ -evas_gl_routines.c \ -evas_gradient.c \ -evas_image.c \ -evas_image_routines.c \ -evas_imlib_routines.c \ -evas_line.c \ -evas_list.c \ -evas_misc.c \ -evas_object.c \ -evas_poly.c \ -evas_rectangle.c \ -evas_render.c \ -evas_text.c \ -evas_gl_routines.h \ -evas_x11_routines.c \ -evas_fileless_image.h \ -evas_image_routines.h \ -evas_imlib_routines.h \ -evas_x11_routines.h \ -evas_render_routines.c \ -evas_render_routines.h \ -Evas.h \ -Evas_private.h - -libevas_la_LIBADD = $(LIBS_ALL) -libevas_la_DEPENDENCIES = $(top_builddir)/config.h -libevas_la_LDFLAGS = -version-info 6:0:6 diff --git a/legacy/evas/src/evas_callbacks.c b/legacy/evas/src/evas_callbacks.c deleted file mode 100644 index 04d2e36985..0000000000 --- a/legacy/evas/src/evas_callbacks.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include - -void -_evas_callback_call(Evas e, Evas_Object o, Evas_Callback_Type callback, - int b, int x, int y) -{ - Evas_List l; - static in_cb = 0; - - if(!o) return; - if (in_cb) return; - in_cb = 1; - if (o->callbacks) - { - for (l = o->callbacks; l; l = l->next) - { - Evas_Callback cb; - - cb = l->data; - if (cb->type == callback) - cb->callback(cb->data, e, o, b, x, y); - } - } - in_cb = 0; -} - -/* callbacks */ -void -evas_callback_add(Evas e, Evas_Object o, Evas_Callback_Type callback, void (*func) (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y), void *data) - -{ - Evas_Callback cb; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - cb = malloc(sizeof(struct _Evas_Callback)); - cb->type = callback; - cb->data = data; - cb->callback = func; - o->callbacks = evas_list_append(o->callbacks, cb); -} - -void -evas_callback_del(Evas e, Evas_Object o, Evas_Callback_Type callback) -{ - Evas_List l; - int have_cb; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - have_cb = 1; - while (have_cb) - { - have_cb = 0; - for (l = o->callbacks; l; l = l->next) - { - Evas_Callback cb; - - cb = l->data; - if (cb->type == callback) - { - o->callbacks = evas_list_remove(o->callbacks, cb); - free(cb); - have_cb = 1; - break; - } - } - } -} diff --git a/legacy/evas/src/evas_events.c b/legacy/evas/src/evas_events.c deleted file mode 100644 index 38b6b04315..0000000000 --- a/legacy/evas/src/evas_events.c +++ /dev/null @@ -1,178 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include - -Evas_Object -_evas_highest_object_at_point(Evas e, int x, int y) -{ - double cx, cy; - - cx = evas_screen_x_to_world(e, x); - cy = evas_screen_y_to_world(e, y); - return evas_object_at_position(e, cx, cy); -} - -Evas_List -_evas_objects_at_point(Evas e, int x, int y) -{ - double cx, cy; - - cx = evas_screen_x_to_world(e, x); - cy = evas_screen_y_to_world(e, y); - return evas_objects_at_position(e, cx, cy); -} - -/* events */ -void -evas_event_button_down(Evas e, int x, int y, int b) -{ - Evas_Object o; - - if (!e) return; - if ((b < 1) || (b > 32)) return; - if (!e->mouse.buttons) - { - o = _evas_highest_object_at_point(e, x, y); - e->mouse.button_object = o; - } - e->mouse.buttons |= (1 << (b - 1)); - e->mouse.x = x; - e->mouse.y = y; - if (e->mouse.button_object) - _evas_callback_call(e, e->mouse.button_object, CALLBACK_MOUSE_DOWN, - b, x, y); -} - -void -evas_event_button_up(Evas e, int x, int y, int b) -{ - Evas_Object o; - - if (!e) return; - if ((b < 1) || (b > 32)) return; - e->mouse.buttons &= ~(1 << (b - 1)); - e->mouse.x = x; - e->mouse.y = y; - if (e->mouse.button_object) - _evas_callback_call(e, e->mouse.button_object, CALLBACK_MOUSE_UP, - b, x, y); - else if (e->mouse.object) - _evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_UP, - b, x, y); - if (!e->mouse.buttons) - { - if ((e->mouse.button_object) && - (e->mouse.object != e->mouse.button_object)) - _evas_callback_call(e, e->mouse.button_object, CALLBACK_MOUSE_OUT, - e->mouse.buttons, x, y); - e->mouse.button_object = NULL; - } -} - -void -evas_event_move(Evas e, int x, int y) -{ - Evas_Object o; - - if (!e) return; - o = _evas_highest_object_at_point(e, x, y); - if (o != e->mouse.object) - { - if (e->mouse.object) - { - if (!e->mouse.button_object) - { - _evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_MOVE, - e->mouse.buttons, e->mouse.x, e->mouse.y); - _evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_OUT, - e->mouse.buttons, e->mouse.x, e->mouse.y); - } - else - _evas_callback_call(e, e->mouse.button_object, CALLBACK_MOUSE_MOVE, - e->mouse.buttons, e->mouse.x, e->mouse.y); - } - e->mouse.x = x; - e->mouse.y = y; - e->mouse.object = o; - if (e->mouse.object) - { - if (!e->mouse.button_object) - { - _evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_IN, - e->mouse.buttons, e->mouse.x, e->mouse.y); - _evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_MOVE, - e->mouse.buttons, e->mouse.x, e->mouse.y); - } - } - return; - } - e->mouse.x = x; - e->mouse.y = y; - if (e->mouse.button_object) - _evas_callback_call(e, e->mouse.button_object, CALLBACK_MOUSE_MOVE, - e->mouse.buttons, e->mouse.x, e->mouse.y); - else if (e->mouse.object) - _evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_MOVE, - e->mouse.buttons, e->mouse.x, e->mouse.y); -} - -void -evas_event_enter(Evas e) -{ - if (!e) return; - e->mouse.in = 1; -} - -void -evas_event_leave(Evas e) -{ - if (!e) return; - e->mouse.in = 0; - if ((e->mouse.object) && (!e->mouse.button_object)) - { - _evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_MOVE, - e->mouse.buttons, e->mouse.x, e->mouse.y); - _evas_callback_call(e, e->mouse.object, CALLBACK_MOUSE_OUT, - e->mouse.buttons, e->mouse.x, e->mouse.y); - e->mouse.object = NULL; - } -} - -Evas_Object -evas_get_object_under_mouse(Evas e) -{ - if (!e) return NULL; - return _evas_highest_object_at_point(e, e->mouse.x, e->mouse.y); -} - -int -evas_pointer_in(Evas e) -{ - if (!e) return 0; - return e->mouse.in; -} - -void -evas_pointer_pos(Evas e, int *x, int *y) -{ - if (!e) return; - if (x) *x = e->mouse.x; - if (y) *y = e->mouse.y; -} - -int -evas_pointer_buttons(Evas e) -{ - if (!e) return 0; - return e->mouse.buttons; -} - -void -evas_pointer_ungrab(Evas e) -{ - e->mouse.buttons = 0; - e->mouse.button_object = NULL; -} diff --git a/legacy/evas/src/evas_fileless_image.c b/legacy/evas/src/evas_fileless_image.c deleted file mode 100644 index 217401a7e3..0000000000 --- a/legacy/evas/src/evas_fileless_image.c +++ /dev/null @@ -1,118 +0,0 @@ -#include -#include -#include -#include -#include -#include "evas_fileless_image.h" - -//#define MYDEBUG 1 - - -Evas_List fileless_images = NULL; - -char* _evas_generate_filename(void){ - - char buf[100]; - char *p; - int i,j; - - struct timeval tv; - - gettimeofday(&tv,NULL); - srand(tv.tv_usec); - i = rand(); - srand(tv.tv_sec); - j = rand(); - sprintf(buf, "s%d%d.mem", i, j); - p = (char*)malloc(strlen(buf)+1); - strcpy(p, buf); -#ifdef MYDEBUG -fprintf(stderr,"fli: generated: %s\n", p); -#endif - return p; -} - -void _evas_add_fileless_image(Imlib_Image im, char* file){ - - Evas_Fileless_Image *fli; - Imlib_Image prev_im; - - if(!file) return; - - fli = (Evas_Fileless_Image*)malloc(sizeof(Evas_Fileless_Image)); - fli->file = (char*)malloc(strlen(file)+1); - strcpy(fli->file, file); - prev_im = imlib_context_get_image(); - imlib_context_set_image(im); - fli->im = imlib_clone_image(); - imlib_context_set_image(prev_im); - - fileless_images = evas_list_append(fileless_images,(void*)fli); -#ifdef MYDEBUG -fprintf(stderr,"fli: added: %s\n", file); -#endif - -} - -void _evas_remove_fileless_image(char*file){ - Evas_List l; - Imlib_Image prev_im; - - if(!file) return; - - for( l = fileless_images; l ; l = l -> next ){ - Evas_Fileless_Image *fli; - fli = l->data; - if(!strcmp(fli->file, file)){ - free(fli->file); - prev_im = imlib_context_get_image(); - imlib_context_set_image(fli->im); - imlib_free_image(); - imlib_context_set_image(prev_im); - fileless_images = evas_list_remove(fileless_images, fli); -#ifdef MYDEBUG -fprintf(stderr,"fli: removed: %s\n", file); -#endif - free(fli); - return; - } - } -} - - -Imlib_Image _evas_find_fileless_image(char*file){ - Evas_List l; - Imlib_Image prev_im, res_im = NULL; - - if(!file) return; - - for( l = fileless_images ; l ; l = l -> next ){ - Evas_Fileless_Image *fli; - fli = l -> data; - if(!strcmp(fli->file, file)){ - prev_im = imlib_context_get_image(); - imlib_context_set_image(fli->im); - res_im = imlib_clone_image(); -#ifdef MYDEBUG -fprintf(stderr, "fli: found: %s\n", file); -#endif - imlib_context_set_image(prev_im); - } - } - - return res_im; -} - - - - - - - - - - - - - - diff --git a/legacy/evas/src/evas_fileless_image.h b/legacy/evas/src/evas_fileless_image.h deleted file mode 100644 index 668411b3d1..0000000000 --- a/legacy/evas/src/evas_fileless_image.h +++ /dev/null @@ -1,19 +0,0 @@ -#include "Evas.h" - -typedef struct _Evas_Fileless_Image Evas_Fileless_Image; - -struct _Evas_Fileless_Image{ - char *file; - Imlib_Image im; -}; - -Imlib_Image _evas_find_fileless_image(char*file); -char* _evas_generate_filename(void); -void _evas_add_fileless_image(Imlib_Image im, char*file); -void _evas_remove_fileless_image(char*file); - - - - - - diff --git a/legacy/evas/src/evas_gl_routines.c b/legacy/evas/src/evas_gl_routines.c deleted file mode 100644 index 46eb2a1de5..0000000000 --- a/legacy/evas/src/evas_gl_routines.c +++ /dev/null @@ -1,3075 +0,0 @@ -#include "evas_gl_routines.h" -#include "evas_fileless_image.h" -#include -#include -#include -#include - -/* uncomment this is partial buffer swaps slow - problem with glcopypixels? */ -#define GLSWB 1 - -/* uncomment if your GL implimentation is CRAP at clipping */ -/* #define GLNOCLIP 1 */ - -/* uncomment this if your gl doesn thandle rendering all the update rects */ -/* well - i knwo nvidias performance blows if u render mroe than 1 rect */ -#define GLBOUNDING 1 - -#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \ - ((x < (xx + ww)) && \ - (y < (yy + hh)) && \ - ((x + w) > xx) && \ - ((y + h) > yy)) - -#define CLIP_TO(_x, _y, _w, _h, _cx, _cy, _cw, _ch) \ - { \ - if (INTERSECTS(_x, _y, _w, _h, _cx, _cy, _cw, _ch)) \ - { \ - if (_x < _cx) \ - { \ - _w += _x - _cx; \ - _x = _cx; \ - if (_w < 0) _w = 0; \ - } \ - if ((_x + _w) > (_cx + _cw)) \ - _w = _cx + _cw - _x; \ - if (_y < _cy) \ - { \ - _h += _y - _cy; \ - _y = _cy; \ - if (_h < 0) _h = 0; \ - } \ - if ((_y + _h) > (_cy + _ch)) \ - _h = _cy + _ch - _y; \ - } \ - else \ - { \ - _w = 0; _h = 0; \ - } \ - } - - -#define TT_VALID( handle ) ( ( handle ).z != NULL ) - -#ifdef HAVE_GL - -static int __evas_gl_configuration[] = -{ - GLX_DOUBLEBUFFER, - GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - None -}; - -static Evas_GL_Window *__evas_current = NULL; - -static Evas_List __evas_windows = NULL; -static Evas_List __evas_contexts = NULL; -static Evas_List __evas_images = NULL; -static Evas_List __evas_fonts = NULL; - -static int __evas_image_cache = 0; -static int __evas_image_cache_max = 512 * 1024; - -static char **__evas_fpath = NULL; -static int __evas_fpath_num = 0; -static int __evas_font_cache = 0; -static int __evas_font_cache_max = 512 * 1024; - -static int __evas_rend_lut[9] = { 0, 64, 128, 192, 255, 255, 255, 255, 255}; - -static int __evas_have_tt_engine = 0; -static TT_Engine __evas_tt_engine; - -/* smooth (linear interp / supersample/mipmap scaling or "nearest" sampling */ -static int __evas_smooth = 1; -/* the current clip region and color */ -static int __evas_clip = 0; -static int __evas_clip_x = 0; -static int __evas_clip_y = 0; -static int __evas_clip_w = 0; -static int __evas_clip_h = 0; -static int __evas_clip_r = 0; -static int __evas_clip_g = 0; -static int __evas_clip_b = 0; -static int __evas_clip_a = 0; - -static Evas_GL_Context * -__evas_gl_context_new(Display *disp, int screen) -{ - Evas_GL_Context *c; - XSetWindowAttributes att; - int eb, evb; - - if (!glXQueryExtension(disp, &eb, &evb)) return NULL; - c = malloc(sizeof(Evas_GL_Context)); - c->disp = disp; - c->screen = screen; - c->visualinfo = glXChooseVisual(c->disp, c->screen, __evas_gl_configuration); - c->visual = c->visualinfo->visual; - c->context = glXCreateContext(c->disp, c->visualinfo, NULL, GL_TRUE); - c->root = RootWindow(c->disp, c->screen); - c->colormap = XCreateColormap(c->disp, c->root, c->visual, 0); - att.colormap = c->colormap; - att.border_pixel = 0; - att.event_mask = 0; - c->win = XCreateWindow(c->disp, c->root, 0, 0, 1, 1, 0, - c->visualinfo->depth, InputOutput, - c->visual, CWColormap | CWBorderPixel | CWEventMask, - &att); - glXMakeCurrent(c->disp, c->win, c->context); - glShadeModel(GL_FLAT); - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); - glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); - glEnable(GL_LINE_SMOOTH); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - - c->texture = 0; - glDisable(GL_TEXTURE_2D); - c->dither = 0; - glDisable(GL_DITHER); - c->blend = 1; - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - c->color = 0xffffffff; - glColor4f(1.0, 1.0, 1.0, 1.0); - - c->clip.active = 0; - c->clip.x = 0; - c->clip.y = 0; - c->clip.w = 0; - c->clip.h = 0; - glDisable(GL_SCISSOR_TEST); - - c->read_buf = GL_BACK; - glReadBuffer(GL_BACK); - c->write_buf = GL_FRONT; - glDrawBuffer(GL_BACK); - - c->bound_texture = NULL; - - /* FIXME: need to determine these */ - c->max_texture_depth = 32; - c->max_texture_size = 256; - - return c; -} - -static Evas_GL_Context * -__evas_gl_context_lookup(Display *disp, int screen) -{ - Evas_List l; - Evas_GL_Context *c; - - for (l = __evas_contexts; l; l = l->next) - { - c = l->data; - if ((c->disp == disp) && (c->screen == screen)) - { - if (l != __evas_contexts) - { - __evas_contexts = evas_list_remove(__evas_contexts, c); - __evas_contexts = evas_list_prepend(__evas_contexts, c); - } - return c; - } - } - c = __evas_gl_context_new(disp, screen); - if (!c) return NULL; - __evas_contexts = evas_list_prepend(__evas_contexts, c); - return c; -} - -static Evas_GL_Window * -__evas_gl_window_new(Display *disp, Window win) -{ - Evas_GL_Context *c; - Evas_GL_Window *w; - Window root; - int screen, i; - XWindowAttributes att; - - XGetWindowAttributes(disp, win, &att); - root = att.root; - screen = 0; - for (i = 0; i < ScreenCount(disp); i++) - { - if (RootWindow(disp, i) == root) - { - screen = i; - break; - } - } - c = __evas_gl_context_lookup(disp, screen); - if (!c) return NULL; - w = malloc(sizeof(Evas_GL_Window)); - w->disp = disp; - w->win = win; - w->context = c; - w->root = root; - w->screen = screen; - w->updates = NULL; - w->w = 0; - w->h = 0; - return w; -} - -static Evas_GL_Window * -__evas_gl_window_lookup(Display *disp, Window win) -{ - Evas_List l; - Evas_GL_Window *w; - - for (l = __evas_windows; l; l = l->next) - { - w = l->data; - if ((w->win == win) && (w->disp == disp)) - { - if (l != __evas_windows) - { - __evas_windows = evas_list_remove(__evas_windows, w); - __evas_windows = evas_list_prepend(__evas_windows, w); - } - return w; - } - } - w = __evas_gl_window_new(disp, win); - if (!w) return NULL; - __evas_windows = evas_list_prepend(__evas_windows, w); - return w; -} - -static Evas_GL_Window * -__evas_gl_window_current(Display *disp, Window win, int w, int h) -{ - Evas_GL_Window *glw; - - glw = __evas_gl_window_lookup(disp, win); - if (!glw) return NULL; - if (glw != __evas_current) - { - __evas_current = glw; - glXMakeCurrent(glw->disp, glw->win, glw->context->context); - glShadeModel(GL_FLAT); - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); - glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); - glEnable(GL_LINE_SMOOTH); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - if (glw->context->dither) glEnable(GL_DITHER); - else glDisable(GL_DITHER); - if (glw->context->blend) - { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - else glDisable(GL_BLEND); - if (glw->context->texture) glEnable(GL_TEXTURE_2D); - else glDisable(GL_TEXTURE_2D); - glColor4d((double)((glw->context->color >> 24) & 0xff) / 255.0, - (double)((glw->context->color >> 16) & 0xff) / 255.0, - (double)((glw->context->color >> 8) & 0xff) / 255.0, - (double)((glw->context->color ) & 0xff) / 255.0); - if (glw->context->clip.active) - { - glEnable(GL_SCISSOR_TEST); - glScissor(glw->context->clip.x, - glw->h - glw->context->clip.y - glw->context->clip.h, - glw->context->clip.w, - glw->context->clip.h); - } - else - glDisable(GL_SCISSOR_TEST); - if (glw->context->bound_texture) - glBindTexture(GL_TEXTURE_2D, glw->context->bound_texture->texture); - } - if ((glw->w != w) || (glw->h != h)) - { - double dr, dg, db, da; - - glw->w = w; - glw->h = h; - glViewport(0, 0, glw->w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, glw->w, 0, glw->h, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glScalef(1, -1, 1); - glTranslatef(0, - glw->h, 0); - } - return glw; -} - -static void -__evas_gl_window_dither(Evas_GL_Window *w, int onoff) -{ - if (!w) return; - if (w->context->dither == onoff) return; - - w->context->dither = onoff; - if (w->context->dither) glEnable(GL_DITHER); - else glDisable(GL_DITHER); -} - -static void -__evas_gl_window_blend(Evas_GL_Window *w, int onoff) -{ - if (!w) return; - if (w->context->blend == onoff) return; - - w->context->blend = onoff; - if (w->context->blend) - { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - else glDisable(GL_BLEND); -} - -static void -__evas_gl_window_texture(Evas_GL_Window *w, int onoff) -{ - if (!w) return; - if (w->context->texture == onoff) return; - - w->context->texture = onoff; - if (w->context->texture) glEnable(GL_TEXTURE_2D); - else glDisable(GL_TEXTURE_2D); -} - -static void -__evas_gl_window_color(Evas_GL_Window *w, int r, int g, int b, int a) -{ - DATA32 col; - - if (!w) return; - col = (r << 24) | (g << 16) | (b << 8) | (a); - if (w->context->color == col) return; - - w->context->color = col; - glColor4d((double)r / 255.0, - (double)g / 255.0, - (double)b / 255.0, - (double)a / 255.0); -} - -static void -__evas_gl_window_clip(Evas_GL_Window *w, int c, int cx, int cy, int cw, int ch) -{ - if (!w) return; - if (w->context->clip.active == c) - { - if ((c) && - (w->context->clip.x == cx) && (w->context->clip.y == cy) && - (w->context->clip.w == cw) && (w->context->clip.h == ch)) - return; - } - w->context->clip.active = c; - w->context->clip.x = cx; - w->context->clip.y = cy; - w->context->clip.w = cw; - w->context->clip.h = ch; - if (w->context->clip.active) - { - glEnable(GL_SCISSOR_TEST); - glScissor(w->context->clip.x, - w->h - w->context->clip.y - w->context->clip.h, - w->context->clip.w, - w->context->clip.h); - } - else - glDisable(GL_SCISSOR_TEST); -} - -static void -__evas_gl_window_write_buf(Evas_GL_Window *w, GLenum buf) -{ - if (!w) return; - if (w->context->write_buf != buf) - { - w->context->write_buf = buf; - glDrawBuffer(buf); - } -} - -static void -__evas_gl_window_read_buf(Evas_GL_Window *w, GLenum buf) -{ - if (!w) return; - if (w->context->read_buf != buf) - { - w->context->read_buf = buf; - glReadBuffer(buf); - } -} - -static void -__evas_gl_window_swap_rect(Evas_GL_Window *w, int rx, int ry, int rw, int rh) -{ - if (!w) return; - - __evas_gl_window_read_buf(w, GL_BACK); - __evas_gl_window_write_buf(w, GL_FRONT); - __evas_gl_window_blend(w, 0); - __evas_gl_window_clip(w, 0, 0, 0, 0, 0); - __evas_gl_window_dither(w, 0); - ry = w->h - ry - rh; - glRasterPos2i(rx, w->h - ry); - glCopyPixels(rx, ry, rw, rh, GL_COLOR); -} - -static void -__evas_gl_window_use_texture(Evas_GL_Window *w, Evas_GL_Texture *tex, int smooth) -{ - if (!w) return; - if (w->context->bound_texture != tex) - { - glBindTexture(GL_TEXTURE_2D, tex->texture); - w->context->bound_texture = tex; - } - if (smooth != tex->smooth) - { -#ifdef HAVE_GLU - if (smooth) - { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - } - else -#else - if (smooth) - { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } - else -#endif - { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - } - tex->smooth = smooth; - } -} - -static Evas_GL_Texture * -__evas_gl_texture_new(Evas_GL_Window *w, Imlib_Image im, int ix, int iy, int iw, int ih) -{ - Evas_GL_Texture *tex; - int tx, ty, tw, th, im_w, im_h; - DATA32 *data, *p1, *p2, *im_data; - int shift; - Imlib_Image prev_im; - - if (!w) return NULL; - tex = malloc(sizeof(Evas_GL_Texture)); - shift = 1; while (iw > shift) shift = shift << 1; tw = shift; - shift = 1; while (ih > shift) shift = shift << 1; th = shift; - tex->w = tw; - tex->h = th; - glGenTextures(1, &(tex->texture)); - glBindTexture(GL_TEXTURE_2D, tex->texture); - w->context->bound_texture = tex; - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - tex->smooth = 0; - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - prev_im = imlib_context_get_image(); - imlib_context_set_image(im); - im_data = imlib_image_get_data_for_reading_only(); - if (!im_data) return tex; - data = malloc(tw * th * 4); - im_w = imlib_image_get_width(); - im_h = imlib_image_get_height(); - for (ty = 0; ty < ih; ty++) - { - p1 = im_data + ((iy + ty) * im_w) + ix; - p2 = data + (ty * tw); - for (tx = 0; tx < iw; tx++) - { -#ifndef WORDS_BIGENDIAN - *p2 = - ((*p1 & 0xff000000)) | - ((*p1 & 0x00ff0000) >> 16) | - ((*p1 & 0x0000ff00)) | - ((*p1 & 0x000000ff) << 16); -#else - *p2 = - ((*p1 & 0xff000000) >> 24) | - ((*p1 & 0x00ff0000) << 8) | - ((*p1 & 0x0000ff00) << 8) | - ((*p1 & 0x000000ff) << 8); -#endif - p2++; p1++; - } - if (tx < tw) - { - for (; tx < tw; tx++) *p2 = p2[-1]; - } - } - if (ty < th) - { - for (; ty < th; ty++) - { - p1 = data + ((ty - 1) * tw); - p2 = data + (ty * tw); - for (tx = 0; tx < tw; tx++) - { - *p2 = *p1; p2++; p1++; - } - } - } -#ifdef HAVE_GLU - /* FIXME: GLU mipmap generation is BLOODY SLOW */ - if (0) /* if libGLU is fucking slow piece of shit - do it ourselves */ - { - if (imlib_image_has_alpha()) - gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA8, tw, th, GL_RGBA, - GL_UNSIGNED_BYTE, data); - else - gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB8, tw, th, GL_RGBA, - GL_UNSIGNED_BYTE, data); - } -#else - if (0) - { - if (imlib_image_has_alpha()) - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, tw, th, 0, - GL_RGBA, GL_UNSIGNED_BYTE, data); - else - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, tw, th, 0, - GL_RGBA, GL_UNSIGNED_BYTE, data); - } -#endif - else - { - int mw, mh; - int level; - Imlib_Image im1 = NULL, im2 = NULL; - int alpha = 0; - - mw = tw; - mh = th; - level = 0; - alpha = imlib_image_has_alpha(); - im1 = imlib_create_image_using_data(tw, th, data); - imlib_context_set_image(im1); - imlib_image_set_has_alpha(1); - - for (;;) - { - int pw, ph; - DATA32 *idat; - - imlib_context_set_image(im1); - idat = imlib_image_get_data_for_reading_only(); - if (alpha) - glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, mw, mh, 0, - GL_RGBA, GL_UNSIGNED_BYTE, idat); - else - glTexImage2D(GL_TEXTURE_2D, level, GL_RGB8, mw, mh, 0, - GL_RGBA, GL_UNSIGNED_BYTE, idat); - imlib_image_put_back_data(idat); - if ((mw == 1) && (mh == 1)) break; - level++; - pw = mw; ph = mh; - mw >>= 1; if (mw < 1) mw = 1; - mh >>= 1; if (mh < 1) mh = 1; - im2 = imlib_create_cropped_scaled_image(0, 0, pw, ph, mw, mh); - imlib_free_image(); - im1 = im2; im2 = NULL; - imlib_context_set_image(im1); - imlib_image_set_has_alpha(1); - } - if (im1) - { - imlib_context_set_image(im1); - imlib_free_image(); - im1 = NULL; - } - } - free(data); - imlib_context_set_image(im); - imlib_image_put_back_data(im_data); - imlib_context_set_image(prev_im); - return tex; -} - -static void -__evas_gl_texture_free(Evas_GL_Window *w, Evas_GL_Texture *tex) -{ - if (!w) return; - glDeleteTextures(1, &tex->texture); - if (w->context->bound_texture == tex) w->context->bound_texture = NULL; - free(tex); -} - -static Evas_GL_Texmesh * -__evas_gl_make_image_textures(Evas_GL_Window *w, Evas_GL_Image *image) -{ - Evas_List l; - Evas_GL_Texmesh *tm; - int tx, ty, ex, ey, tw, th, ix, iy, iw, ih; - int i, shift; - Imlib_Image prev_im; - - for (l = image->textures; l; l = l->next) - { - tm = l->data; - if (tm->context == w->context) return tm; - } - tm = malloc(sizeof(Evas_GL_Texmesh)); - tm->window = w; - tm->context = w->context; - - image->textures = evas_list_prepend(image->textures, tm); - - if ((!image->im) && (image->file)) - image->im = _evas_find_fileless_image(image->file); - - if ((!image->im) && (image->file)) - { - image->im = imlib_load_image(image->file); - imlib_context_set_image(image->im); - imlib_image_set_changes_on_disk(); - } - - tx = (image->w - 2) / (w->context->max_texture_size - 2); - ex = (image->w - 1) - (tx * (w->context->max_texture_size - 2)); - if (tx == 0) ex = image->w; - tm->tiles.x_left = ex; - shift = 1; while (ex > shift) shift = shift << 1; ex = shift; - - ty = (image->h - 2) / (w->context->max_texture_size - 2); - ey = (image->h - 1) - (ty * (w->context->max_texture_size - 2)); - if (ty == 0) ey = image->h; - tm->tiles.y_left = ey; - shift = 1; while (ey > shift) shift = shift << 1; ey = shift; - - tm->tiles.x = tx; - tm->tiles.y = ty; - tm->tiles.x_edge = ex; - tm->tiles.y_edge = ey; - tm->textures = malloc(sizeof(Evas_GL_Texmesh *) * (tm->tiles.x + 1) * (tm->tiles.y + 1)); - i = 0; - for (ty = 0; ty <= tm->tiles.y; ty++) - { - /* figure out image y,h */ - /* texture is only an edge size */ - if ((ty == 0) && (tm->tiles.y == 0)) - { - iy = 0; - ih = image->h; - } - /* start edge */ - else if (ty == 0) - { - iy = 0; - ih = w->context->max_texture_size; - } - /* end edge */ - else if (ty == tm->tiles.y) - { - iy = (w->context->max_texture_size - 1) - 1 + - ((ty - 1) * (w->context->max_texture_size - 2)); - ih = image->h - iy; - } - /* middle tex */ - else - { - iy = (w->context->max_texture_size - 1) - 1 + - ((ty - 1) * (w->context->max_texture_size - 2)); - ih = w->context->max_texture_size; - } - for (tx = 0; tx <= tm->tiles.x; tx++) - { - /* figure out image x,w */ - /* texture is only an edge size */ - if ((tx == 0) && (tm->tiles.x == 0)) - { - ix = 0; - iw = image->w; - } - /* start edge */ - else if (tx == 0) - { - ix = 0; - iw = w->context->max_texture_size; - } - /* end edge */ - else if (tx == tm->tiles.x) - { - ix = (w->context->max_texture_size - 1) - 1 + - ((tx - 1) * (w->context->max_texture_size - 2)); - iw = image->w - ix; - } - /* middle tex */ - else - { - ix = (w->context->max_texture_size - 1) - 1 + - ((tx - 1) * (w->context->max_texture_size - 2)); - iw = w->context->max_texture_size; - } - if (image->im) - tm->textures[i] = __evas_gl_texture_new(w, image->im, - ix, iy, iw, ih); - i++; - } - } - if ((image->file) && (image->im)) - { - prev_im = imlib_context_get_image(); - imlib_context_set_image(image->im); - imlib_free_image_and_decache(); - image->im = NULL; - imlib_context_set_image(prev_im); - } - return tm; -} - -static void -__evas_gl_free_image_textures(Evas_GL_Image *image) -{ - Evas_List l; - - if (image->textures) - { - for (l = image->textures; l; l = l->next) - { - Evas_GL_Texmesh *tm; - Evas_GL_Window *w; - int i; - - tm = l->data; - w = __evas_gl_window_current(tm->window->disp, tm->window->win, - tm->window->w, tm->window->h); - for (i = 0; i < (tm->tiles.x + 1) * (tm->tiles.y + 1); i++) - __evas_gl_texture_free(w, tm->textures[i]); - free(tm->textures); - tm->tiles.x = 0; - tm->tiles.y = 0; - tm->tiles.x_edge = 0; - tm->tiles.y_edge = 0; - free(tm); - } - evas_list_free(image->textures); - } - image->textures = NULL; -} - -static Evas_GL_Image * -__evas_gl_image_alloc(char *file) -{ - Evas_GL_Image *image; - Imlib_Image im, prev_im; - - im = _evas_find_fileless_image(file); - if (!im) - im = imlib_load_image(file); - if (!im) return NULL; - imlib_context_set_image(im); - imlib_image_set_changes_on_disk(); - image = malloc(sizeof(Evas_GL_Image)); - image->file = malloc(strlen(file) + 1); - strcpy(image->file, file); - image->im = im; - prev_im = imlib_context_get_image(); - imlib_context_set_image(im); - image->w = imlib_image_get_width(); - image->h = imlib_image_get_height(); - image->has_alpha = imlib_image_has_alpha(); - image->border.l = 0; - image->border.r = 0; - image->border.t = 0; - image->border.b = 0; - image->references = 1; - image->textures = NULL; - imlib_context_set_image(prev_im); - return image; -} - -static void -__evas_gl_image_dealloc(Evas_GL_Image *image) -{ - Imlib_Image prev_im; - - if (image->file) free(image->file); - if (image->im) - { - prev_im = imlib_context_get_image(); - imlib_context_set_image(image->im); - imlib_free_image(); - imlib_context_set_image(prev_im); - } - if (image->textures) - __evas_gl_free_image_textures(image); - free(image); -} - -static void -__evas_gl_image_cache_flush(void) -{ - while (__evas_image_cache > __evas_image_cache_max) - { - Evas_GL_Image *im, *im_last; - Evas_List l; - - im_last = NULL; - for (l = __evas_images; l; l = l->next) - { - im = l->data; - if (im->references == 0) im_last = im; - } - if (im_last) - { - __evas_image_cache -= im_last->w * im_last->h * 4; - __evas_images = evas_list_remove(__evas_images, im_last); - __evas_gl_image_dealloc(im_last); - } - } -} - -static Evas_GL_Graident_Texture * -__evas_gl_gradient_texture_new(Evas_GL_Window *w, Evas_GL_Graident *gr) -{ - Evas_List l; - Evas_GL_Graident_Texture *tg; - - for (l = gr->textures; l; l = l->next) - { - tg = l->data; - if (tg->context == w->context) return tg; - } - tg = malloc(sizeof(Evas_GL_Graident_Texture)); - tg->window = w; - tg->context = w->context; - tg->texture = NULL; - gr->textures = evas_list_prepend(gr->textures, tg); - return tg; -} - -static void -__evas_gl_gradient_texture_free(Evas_GL_Graident_Texture *tg) -{ - if (tg->texture) - __evas_gl_texture_free(tg->window, tg->texture); - free(tg); -} - -static Evas_GL_Texture * -__evas_gl_texture_alpha_new(Evas_GL_Window *w) -{ - Evas_GL_Texture *tex; - DATA8 *data; - - if (!w) return NULL; - tex = malloc(sizeof(Evas_GL_Texture)); - tex->w = w->context->max_texture_size; - tex->h = w->context->max_texture_size; - glGenTextures(1, &(tex->texture)); - glBindTexture(GL_TEXTURE_2D, tex->texture); - w->context->bound_texture = tex; - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - tex->smooth = 0; - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - data = malloc(w->context->max_texture_size * w->context->max_texture_size); - memset(data, 0, w->context->max_texture_size * w->context->max_texture_size); - glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA4, - w->context->max_texture_size, w->context->max_texture_size, 0, - GL_ALPHA, GL_UNSIGNED_BYTE, data); - free(data); - return tex; -} - -static void -__evas_gl_texture_paste_data(Evas_GL_Window *w, Evas_GL_Texture *tex, int x, int y, DATA8 *data, int iw, int ih) -{ - __evas_gl_window_use_texture(w, tex, 0); - glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, iw, ih, - GL_ALPHA, GL_UNSIGNED_BYTE, data); -} - -static Evas_GL_Glyph * -__evas_gl_text_font_get_glyph(Evas_GL_Font *fn, int glyph) -{ - Evas_GL_Glyph *g; - Evas_List l; - int hash; - int code; - - hash = glyph & 0xff; - for (l = fn->glyphs[hash]; l; l = l->next) - { - g = l->data; - if (g->glyph_id == glyph) - { - if (l != fn->glyphs[hash]) - { - fn->glyphs[hash] = evas_list_remove(fn->glyphs[hash], g); - fn->glyphs[hash] = evas_list_prepend(fn->glyphs[hash], g); - } - return g; - } - } - g = malloc(sizeof(Evas_GL_Glyph)); - g->glyph_id = glyph; - TT_New_Glyph(fn->face, &(g->glyph)); - code = TT_Char_Index(fn->char_map, glyph); - TT_Load_Glyph(fn->instance, g->glyph, code, TTLOAD_SCALE_GLYPH | TTLOAD_HINT_GLYPH); - TT_Get_Glyph_Metrics(g->glyph, &(g->metrics)); - g->texture = NULL; - g->textures = NULL; - g->tex.x1 = 0.0; - g->tex.x2 = 0.0; - g->tex.y1 = 0.0; - g->tex.y2 = 0.0; - fn->glyphs[hash] = evas_list_prepend(fn->glyphs[hash], g); - return g; -} - -static TT_Raster_Map * -__evas_gl_text_font_raster_new(int width, int height) -{ - TT_Raster_Map *rmap; - - rmap = malloc(sizeof(TT_Raster_Map)); - if (!rmap) return NULL; - rmap->width = (width + 3) & -4; - rmap->rows = height; - rmap->flow = TT_Flow_Up; - rmap->cols = rmap->width; - rmap->size = rmap->rows * rmap->width; - if (rmap->size <= 0) - { - free(rmap); - return NULL; - } - rmap->bitmap = malloc(rmap->size); - if (!rmap->bitmap) - { - free(rmap); - return NULL; - } - memset(rmap->bitmap, 0, rmap->size); - return rmap; -} - -static void -__evas_gl_text_font_raster_free(TT_Raster_Map * rmap) -{ - if (rmap->bitmap) free(rmap->bitmap); - free(rmap); -} - -static void -__evas_gl_text_font_render_glyph(Evas_GL_Window *glw, Evas_GL_Font *fn, Evas_GL_Glyph *g) -{ - Evas_List l; - Evas_GL_Font_Texture *ft; - Evas_GL_Glyph_Texture *gt; - Evas_GL_Texture *tex; - int tx, ty, tw, th, xmin, ymin, xmax, ymax; - TT_Raster_Map *rmap; - - if ((g->texture) && (g->texture->context == glw->context)) return; - for (l = g->textures; l; l = l->next) - { - gt = l->data; - if (gt->context == glw->context) - { - g->texture = gt; - g->tex.x1 = gt->tex.x1; - g->tex.x2 = gt->tex.x2; - g->tex.y1 = gt->tex.y1; - g->tex.y2 = gt->tex.y2; - return; - } - } - - xmin = g->metrics.bbox.xMin & -64; - ymin = g->metrics.bbox.yMin & -64; - xmax = (g->metrics.bbox.xMax + 63) & -64; - ymax = (g->metrics.bbox.yMax + 63) & -64; - tw = ((xmax - xmin) / 64) + 1; - th = ((ymax - ymin) / 64) + 1; - /* could never fit glyph into max texture size tile */ - if ((tw > glw->context->max_texture_size) || - (th > glw->context->max_texture_size)) - { - g->texture = NULL; - return; - } - - /* find a new texture with space */ - ft = NULL; - tex = NULL; - tx = 0; - ty = 0; - for (l = fn->textures; l; l = l->next) - { - ft = l->data; - if (ft->context == glw->context) - { - tex = ft->texture; - - if ((tex->h - ft->cursor.y) >= th) - { - if ((tex->w - ft->cursor.x) >= tw) - { - if (ft->cursor.row_h < th) ft->cursor.row_h = th; - tx = ft->cursor.x; - ty = ft->cursor.y; - ft->cursor.x += tw; - goto done; - } - else - { - ty = ft->cursor.y + ft->cursor.row_h; - if ((tex->h - ty) >= th) - { - ft->cursor.y += ft->cursor.row_h; - ft->cursor.row_h = th; - ft->cursor.x = tw; - tx = 0; - ty = ft->cursor.y; - goto done; - } - } - } - } - ft = NULL; - } - done: - if (!ft) - { - /* make a new texture with space */ - tex = __evas_gl_texture_alpha_new(glw); - ft = malloc(sizeof(Evas_GL_Font_Texture)); - ft->cursor.x = tw; - ft->cursor.y = 0; - ft->cursor.row_h = th; - ft->window = glw; - ft->context = glw->context; - ft->texture = tex; - - fn->textures = evas_list_prepend(fn->textures, ft); - tx = 0; - ty = 0; - } - /* paste glyph in free spot in texture */ - gt = malloc(sizeof(Evas_GL_Glyph_Texture)); - - rmap = __evas_gl_text_font_raster_new(tw, th); - if (rmap) - { - int x, y; - DATA8 *data; - - TT_Get_Glyph_Pixmap(g->glyph, rmap, -xmin, -ymin); - data = malloc(tw * th * sizeof(DATA8)); - for (y = 0; y < th; y++) - { - for (x = 0; x < tw; x++) - { - int rval; - - rval = (int)(((unsigned char *)(rmap->bitmap))[((rmap->rows - y - 1) * rmap->cols) + x]); - data[(y * tw) + x] = __evas_rend_lut[rval]; - } - } - __evas_gl_texture_paste_data(glw, tex, tx, ty, data, tw, th); - free(data); - __evas_gl_text_font_raster_free(rmap); - } - gt->texture = tex; - gt->window = glw; - gt->context = glw->context; - gt->tex.x1 = (double)tx / (double)glw->context->max_texture_size; - gt->tex.x2 = (double)(tx + tw) / (double)glw->context->max_texture_size; - gt->tex.y1 = (double)ty / (double)glw->context->max_texture_size; - gt->tex.y2 = (double)(ty + th) / (double)glw->context->max_texture_size; - g->textures = evas_list_prepend(g->textures, gt); - - g->texture = gt; - g->tex.x1 = gt->tex.x1; - g->tex.x2 = gt->tex.x2; - g->tex.y1 = gt->tex.y1; - g->tex.y2 = gt->tex.y2; -} - -static int -__evas_gl_is_file(char *file) -{ - struct stat st; - - if (stat(file, &st) < 0) - return 0; - return 1; -} - -static char * -__evas_gl_font_find(char *font) -{ - char buf[4096]; - char *ext[] = {".ttf", ".TTF", ""}; - int i, j; - - for (i = 0; i < 3; i++) - { - sprintf(buf, "%s%s", font, ext[i]); - if (__evas_gl_is_file(buf)) - { - char *f; - - f = malloc(strlen(buf) + 1); - strcpy(f, buf); - return f; - } - } - for (j = 0; j < __evas_fpath_num; j++) - { - for (i = 0; i < 3; i++) - { - sprintf(buf, "%s/%s%s", __evas_fpath[j], font, ext[i]); - if (__evas_gl_is_file(buf)) - { - char *f; - - f = malloc(strlen(buf) + 1); - strcpy(f, buf); - return f; - } - } - } - return NULL; -} - -static Evas_GL_Font * -__evas_gl_font_load(char *font, int size) -{ - Evas_GL_Font *fn; - char *file; - TT_Error error; - int i, num_cmap, upm; - const int dpi = 96; - - file = __evas_gl_font_find(font); - if (!file) return NULL; - if (!__evas_have_tt_engine) - { - error = TT_Init_FreeType(&__evas_tt_engine); - if (error) return NULL; - __evas_have_tt_engine = 1; - } - fn = malloc(sizeof(Evas_GL_Font)); - fn->font = malloc(strlen(font) + 1); - strcpy(fn->font, font); - fn->size = size; - fn->engine = __evas_tt_engine; - error = TT_Open_Face(fn->engine, file, &fn->face); - if (error) - { - free(fn->font); - free(fn); - free(file); - return NULL; - } - free(file); - error = TT_Get_Face_Properties(fn->face, &fn->properties); - if (error) - { - TT_Close_Face(fn->face); - free(fn->font); - free(fn); - return NULL; - } - error = TT_New_Instance(fn->face, &fn->instance); - if (error) - { - TT_Close_Face(fn->face); - free(fn->font); - free(fn); - return NULL; - } - TT_Set_Instance_Resolutions(fn->instance, dpi, dpi); - TT_Set_Instance_CharSize(fn->instance, size * 64); - TT_Get_Instance_Metrics(fn->instance, &fn->metrics); - upm = fn->properties.header->Units_Per_EM; - fn->ascent = (fn->properties.horizontal->Ascender * fn->metrics.y_ppem) / upm; - fn->descent = (fn->properties.horizontal->Descender * fn->metrics.y_ppem) / upm; - if (fn->descent < 0) fn->descent = -fn->descent; - num_cmap = fn->properties.num_CharMaps; - for (i = 0; i < num_cmap; i++) - { - unsigned short platform, encoding; - - TT_Get_CharMap_ID(fn->face, i, &platform, &encoding); - if ((platform == 3 && encoding == 1) || - (platform == 0 && encoding == 0)) - { - TT_Get_CharMap(fn->face, i, &fn->char_map); - break; - } - } - if (i == num_cmap) - TT_Get_CharMap(fn->face, 0, &fn->char_map); - fn->max_descent = 0; - fn->max_ascent = 0; - memset(fn->glyphs, 0, sizeof(Evas_List) * 256); - fn->textures = NULL; - fn->references = 1; - - /* go thru the first 256 glyps to calculate max ascent/descent */ - { - Evas_GL_Glyph *g; - - for (i = 0; i < 256; i++) - { - g = __evas_gl_text_font_get_glyph(fn, i); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - if ((g->metrics.bbox.yMin & -64) < fn->max_descent) - fn->max_descent = (g->metrics.bbox.yMin & -64); - if (((g->metrics.bbox.yMax + 63) & -64) > fn->max_ascent) - fn->max_ascent = ((g->metrics.bbox.yMax + 63) & -64); - } - } - - if (((fn->ascent == 0) && (fn->descent == 0)) || (fn->ascent == 0)) - { - fn->ascent = fn->max_ascent / 64; - fn->descent = -fn->max_descent / 64; - } - TT_Flush_Face(fn->face); - return fn; -} - -static void -__evas_gl_text_font_cache_flush(void) -{ - Evas_List l; - Evas_GL_Font *fn_last; - Evas_GL_Font *fn; - - while (__evas_font_cache > __evas_font_cache_max) - { - fn_last = NULL; - for (l = __evas_fonts; l; l = l->next) - { - fn = l->data; - if (fn->references == 0) fn_last = fn; - } - if (fn_last) - { - int i; - - for (l = fn_last->textures; l; l = l->next) - { - Evas_GL_Font_Texture *ft; - - ft = l->data; - __evas_font_cache -= ft->texture->w * ft->texture->h; - } - TT_Done_Instance(fn_last->instance); - TT_Close_Face(fn_last->face); - if (fn_last->font) free(fn_last->font); - for (i = 0; i < 256; i++) - { - if (fn_last->glyphs[i]) - { - for (l = fn_last->glyphs[i]; l; l = l->next) - { - Evas_GL_Glyph *g; - Evas_List ll; - - g = l->data; - if (g->textures) - { - for (ll = g->textures; ll; ll = ll->next) - { - Evas_GL_Glyph_Texture *gt; - - gt = ll->data; - free(gt); - } - evas_list_free(g->textures); - } - free(g); - } - evas_list_free(fn_last->glyphs[i]); - } - } - if (fn_last->textures) - { - for (l = fn_last->textures; l; l = l->next) - { - Evas_GL_Font_Texture *ft; - - ft = l->data; - __evas_gl_texture_free(ft->window, ft->texture); - free(ft); - } - evas_list_free(fn_last->textures); - } - __evas_fonts = evas_list_remove(__evas_fonts, fn_last); - free(fn_last); - } - } -} - -void -__evas_gl_image_intern_draw(Evas_GL_Image *im, - Evas_GL_Window *glw, - int src_x, int src_y, int src_w, int src_h, - int dst_x, int dst_y, int dst_w, int dst_h, - int allow_smooth) -{ - Evas_List l; - Evas_GL_Texmesh *tm; - - double scx, scy; - double x0, y0, w0, h0; - int go; - - if (src_w < 1) src_w = 1; - if (src_h < 1) src_h = 1; - if (dst_w < 1) return; - if (dst_h < 1) return; - - tm = __evas_gl_make_image_textures(glw, im); - scx = (double)dst_w / (double)src_w; - scy = (double)dst_h / (double)src_h; - - x0 = (double)dst_x - ((double)src_x * scx); - y0 = (double)dst_y - ((double)src_y * scy); - w0 = (double)im->w * scx; - h0 = (double)im->h * scy; - -#ifndef GLNOCLIP - for (l = glw->updates; l; l = l->next) - { - Evas_GL_Rect *rect; - - go = 1; - rect = l->data; - { - int rx, ry, rw, rh; - - rx = dst_x; - ry = dst_y; - rw = dst_w; - rh = dst_h; - CLIP_TO(rx, ry, rw, rh, rect->x, rect->y, rect->w, rect->h); - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } -#else - go = 1; - { - int rx, ry, rw, rh; - - rx = dst_x; - ry = dst_y; - rw = dst_w; - rh = dst_h; - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } - else - { - if (!((src_x != 0) || (src_w != im->w) || - (src_y != 0) || (src_h != im->h))) - __evas_gl_window_clip(glw, 0, 0, 0, 0, 0); - } - } -#endif - /* render image here */ - if (go) - { - int tx, ty, t; - double ty1, ty2, tx1, tx2; - double x1, x2, y1, y2; - int smooth = 0; - - if ((__evas_smooth) && (allow_smooth)) - { - if ((dst_w == src_w) && (dst_h == src_h)) - smooth = 0; - else smooth = __evas_smooth; - } - else - smooth = 0; - t = 0; - for (ty = 0; ty <= tm->tiles.y; ty++) - { - if ((ty == 0) && (ty < tm->tiles.y)) - { - y1 = y0; - y2 = y1 + ((double)(glw->context->max_texture_size - 1) * scy); - ty1 = 0.0; - ty2 = (double)(glw->context->max_texture_size - 2) / (double)(glw->context->max_texture_size - 1); - } - else if (ty < tm->tiles.y) - { - y1 = y0 + (((double)(glw->context->max_texture_size - 1) + ((double)(ty - 1) * (double)(glw->context->max_texture_size - 2))) * scy); - y2 = y1 + ((double)(glw->context->max_texture_size - 2) * scy); - ty1 = 1.0 / (double)(glw->context->max_texture_size - 1); - ty2 = (double)(glw->context->max_texture_size - 2) / (double)(glw->context->max_texture_size - 1); - } - else - { - if (ty == 0) y1 = y0; - else - y1 = y0 + h0 - ((double)tm->tiles.y_left * scy); - y2 = y0 + h0; - if (ty == 0) - { - ty1 = 0.0; - ty2 = (double)(tm->tiles.y_left - 1) / (double)(tm->tiles.y_edge - 1); - } - else - { - ty1 = 1.0 / (double)(tm->tiles.y_edge - 1); - ty2 = (double)(1 + tm->tiles.y_left - 1) / (double)(tm->tiles.y_edge - 1); - } - } - for (tx = 0; tx <= tm->tiles.x; tx++) - { - if ((tx == 0) && (tx < tm->tiles.x)) - { - x1 = x0; - x2 = x1 + (255 * scx); - tx1 = 0.0; - tx2 = (double)(glw->context->max_texture_size - 2) / (double)(glw->context->max_texture_size - 1); - } - else if (tx < tm->tiles.x) - { - x1 = x0 + (((double)(glw->context->max_texture_size - 1) + ((double)(tx - 1) * (double)(glw->context->max_texture_size - 2))) * scx); - x2 = x1 + ((double)(glw->context->max_texture_size - 2) * scx); - tx1 = 1.0 / (double)(glw->context->max_texture_size - 1); - tx2 = (double)(glw->context->max_texture_size - 2) / (double)(glw->context->max_texture_size - 1); - } - else - { - if (tx == 0) x1 = x0; - else - x1 = x0 + w0 - ((double)tm->tiles.x_left * scx); - x2 = x0 + w0; - if (tx == 0) - { - tx1 = 0.0; - tx2 = (double)(tm->tiles.x_left - 1) / (double)(tm->tiles.x_edge - 1); - } - else - { - tx1 = 1.0 / (double)(tm->tiles.x_edge - 1); - tx2 = (double)(1 + tm->tiles.x_left - 1) / (double)(tm->tiles.x_edge - 1); - } - } - __evas_gl_window_use_texture(glw, tm->textures[t++], smooth); - glBegin(GL_QUADS); - glTexCoord2d(tx1, ty1); glVertex2d(x1, y1); - glTexCoord2d(tx2, ty1); glVertex2d(x2, y1); - glTexCoord2d(tx2, ty2); glVertex2d(x2, y2); - glTexCoord2d(tx1, ty2); glVertex2d(x1, y2); - glEnd(); - } - } - } -#ifndef GLNOCLIP - } -#endif -} - -/*****************************************************************************/ -/* image externals ***********************************************************/ -/*****************************************************************************/ - -void -__evas_gl_image_draw(Evas_GL_Image *im, - Display *disp, Imlib_Image dstim, - Window w, int win_w, int win_h, - int src_x, int src_y, int src_w, int src_h, - int dst_x, int dst_y, int dst_w, int dst_h, - int cr, int cg, int cb, int ca) -{ - Evas_GL_Window *glw; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca <= 0) return; - if (src_w < 1) src_w = 1; - if (src_h < 1) src_h = 1; - if (dst_w < 1) return; - if (dst_h < 1) return; - glw = __evas_gl_window_current(disp, w, win_w, win_h); - if (!glw) return; - __evas_gl_window_texture(glw, 1); - if (ca == 255) __evas_gl_window_blend(glw, im->has_alpha); - else __evas_gl_window_blend(glw, 1); - __evas_gl_window_write_buf(glw, GL_BACK); - __evas_gl_window_read_buf(glw, GL_BACK); - __evas_gl_window_color(glw, cr, cg, cb, ca); - __evas_gl_window_dither(glw, 1); - - if ((im->border.l == 0) && (im->border.r == 0) && - (im->border.t == 0) && (im->border.b == 0)) - __evas_gl_image_intern_draw(im, glw, src_x, src_y, src_w, src_h, - dst_x, dst_y, dst_w, dst_h, - 1); - else - { - double scx, scy; - double x0, y0, w0, h0; - int ecx, ecy, ecw, ech, ec; - int x, y, w, h, dx, dy, dw, dh; - int smooth; - - scx = (double)dst_w / (double)src_w; - scy = (double)dst_h / (double)src_h; - - x0 = (double)dst_x - ((double)src_x * scx); - y0 = (double)dst_y - ((double)src_y * scy); - w0 = (double)im->w * scx; - h0 = (double)im->h * scy; - - ec = __evas_clip; - ecx = __evas_clip_x; - ecy = __evas_clip_y; - ecw = __evas_clip_w; - ech = __evas_clip_h; - - if (__evas_clip) - { - CLIP_TO(dst_x, dst_y, dst_w, dst_h, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - - __evas_clip = 1; - __evas_clip_x = dst_x; - __evas_clip_y = dst_y; - __evas_clip_w = dst_w; - __evas_clip_h = dst_h; - - dst_x = x0; - dst_y = y0; - dst_w = w0; - dst_h = h0; - - x = 0; y = 0; - w = im->border.l; h = im->border.t; - dx = dst_x; dy = dst_y; - dw = w; dh = h; - __evas_gl_image_intern_draw(im, glw, x, y, w, h, dx, dy, dw, dh, 0); - - smooth = 0; if (scx > 1.0) smooth = 1; - x = im->border.l; y = 0; - w = im->w - (im->border.l + im->border.r); h = im->border.t; - dx = dst_x + im->border.l; dy = dst_y; - dw = dst_w - (im->border.l + im->border.r); dh = h; - __evas_gl_image_intern_draw(im, glw, x, y, w, h, dx, dy, dw, dh, smooth); - - x = im->w - im->border.r; y = 0; - w = im->border.r; h = im->border.t; - dx = dst_x + dst_w - im->border.r; - dy = dst_y; dw = w; dh = h; - __evas_gl_image_intern_draw(im, glw, x, y, w, h, dx, dy, dw, dh, 0); - - smooth = 0; if (scy > 1.0) smooth = 1; - x = 0; y = im->border.t; - w = im->border.l; h = im->h - (im->border.t + im->border.b); - dx = dst_x; dy = dst_y + im->border.t; dw = w; - dh = dst_h - (im->border.t + im->border.b); - __evas_gl_image_intern_draw(im, glw, x, y, w, h, dx, dy, dw, dh, smooth); - - smooth = 0; if ((scx > 1.0) && (scy > 1.0)) smooth = 1; - x = im->border.l; y = im->border.t; - w = im->w - (im->border.l + im->border.r); h = im->h - (im->border.t + im->border.b); - dx = dst_x + im->border.l; dy = dst_y + im->border.t; - dw = dst_w - (im->border.l + im->border.r); dh = dst_h - (im->border.t + im->border.b); - __evas_gl_image_intern_draw(im, glw, x, y, w, h, dx, dy, dw, dh, smooth); - - smooth = 0; if (scy > 1.0) smooth = 1; - x = im->w - im->border.r; y = im->border.t; - w = im->border.r; h = im->h - (im->border.t + im->border.b); - dx = dst_x + dst_w - im->border.r; dy = dst_y + im->border.t; - dw = w; dh = dst_h - (im->border.t + im->border.b); - __evas_gl_image_intern_draw(im, glw, x, y, w, h, dx, dy, dw, dh, smooth); - - x = 0; y = im->h - im->border.b; - w = im->border.l; h = im->border.b; - dx = dst_x; dy = dst_y + dst_h - im->border.b; - dw = w; dh = h; - __evas_gl_image_intern_draw(im, glw, x, y, w, h, dx, dy, dw, dh, 0); - - smooth = 0; if (scx > 1.0) smooth = 1; - x = im->border.l; y = im->h - im->border.b; - w = im->w - (im->border.l + im->border.r); h = im->border.b; - dx = dst_x + im->border.l; dy = dst_y + dst_h - im->border.b; - dw = dst_w - (im->border.l + im->border.r); dh = h; - __evas_gl_image_intern_draw(im, glw, x, y, w, h, dx, dy, dw, dh, smooth); - - x = im->w - im->border.r; y = im->h - im->border.b; - w = im->border.r; h = im->border.b; - dx = dst_x + dst_w - im->border.r; dy = dst_y + dst_h - im->border.b; - dw = w; dh = h; - __evas_gl_image_intern_draw(im, glw, x, y, w, h, dx, dy, dw, dh, 0); - - __evas_clip = ec; - __evas_clip_x = ecx; - __evas_clip_y = ecy; - __evas_clip_w = ecw; - __evas_clip_h = ech; - } -} - -Evas_GL_Image * -__evas_gl_image_new_from_file(Display *disp, char *file) -{ - Evas_List l; - Evas_GL_Image *image; - - for (l = __evas_images; l; l = l->next) - { - - image = l->data; - - if ((image->file) && (!strcmp(image->file, file))) - { - if (image->references == 0) - { - __evas_image_cache -= image->w * image->h * 4; - } - image->references++; - if (l != __evas_images) - { - __evas_images = evas_list_remove(__evas_images, image); - __evas_images = evas_list_prepend(__evas_images, image); - } - return image; - } - } - image = __evas_gl_image_alloc(file); - if (image) __evas_images = evas_list_prepend(__evas_images, image); - return image; -} - -void -__evas_gl_image_free(Evas_GL_Image *im) -{ - if (im->references > 0) - im->references--; - if (im->references == 0) - { - __evas_image_cache += im->w * im->h * 4; - __evas_gl_image_cache_flush(); - } -} - -void -__evas_gl_image_cache_empty(Display *disp) -{ - int prev_cache; - - prev_cache = __evas_image_cache_max; - __evas_image_cache_max = 0; - __evas_gl_image_cache_flush(); - __evas_image_cache_max = prev_cache; -} - -void -__evas_gl_image_cache_set_size(Display *disp, int size) -{ - __evas_image_cache_max = size; - __evas_gl_image_cache_flush(); -} - -int -__evas_gl_image_cache_get_size(Display *disp) -{ - return __evas_image_cache_max; -} - -int -__evas_gl_image_get_width(Evas_GL_Image *im) -{ - return im->w; -} - -int -__evas_gl_image_get_height(Evas_GL_Image *im) -{ - return im->h; -} - -void -__evas_gl_image_set_borders(Evas_GL_Image *im, int left, int right, - int top, int bottom) -{ - im->border.l = left; - im->border.r = right; - im->border.t = top; - im->border.b = bottom; -} - -void -__evas_gl_image_set_smooth_scaling(int on) -{ - __evas_smooth = on; -} - -/*****************************************************************************/ -/* font externals ************************************************************/ -/*****************************************************************************/ - -Evas_GL_Font * -__evas_gl_text_font_new(Display *disp, char *font, int size) -{ - Evas_List l; - Evas_GL_Font *fn; - - if (!font) return NULL; - for (l = __evas_fonts; l; l = l->next) - { - Evas_GL_Font *fn; - - fn = l->data; - if (!strcmp(fn->font, font) && (size == fn->size)) - { - if (l != __evas_fonts) - { - __evas_fonts = evas_list_remove(__evas_fonts, fn); - __evas_fonts = evas_list_prepend(__evas_fonts, fn); - } - if (fn->references == 0) - { - for (l = fn->textures; l; l = l->next) - { - Evas_GL_Font_Texture *ft; - - ft = l->data; - __evas_font_cache -= ft->texture->w * ft->texture->h; - } - } - fn->references++; - return fn; - } - } - fn = __evas_gl_font_load(font, size); - if (!fn) return NULL; - __evas_fonts = evas_list_prepend(__evas_fonts, fn); - return fn; -} - -void -__evas_gl_text_font_free(Evas_GL_Font *fn) -{ - if (!fn) return; - if (fn->references >= 0) - { - fn->references--; - if (fn->references == 0) - { - Evas_List l; - - for (l = fn->textures; l; l = l->next) - { - Evas_GL_Font_Texture *ft; - - ft = l->data; - __evas_font_cache += ft->texture->w * ft->texture->h; - } - } - } - __evas_gl_text_font_cache_flush(); -} - -int -__evas_gl_text_font_get_ascent(Evas_GL_Font *fn) -{ - if (!fn) return 0; - return fn->ascent / 64; -} - -int -__evas_gl_text_font_get_descent(Evas_GL_Font *fn) -{ - if (!fn) return 0; - return fn->descent / 64; -} - -int -__evas_gl_text_font_get_max_ascent(Evas_GL_Font *fn) -{ - if (!fn) return 0; - return fn->max_ascent / 64; -} - -int -__evas_gl_text_font_get_max_descent(Evas_GL_Font *fn) -{ - if (!fn) return 0; - return fn->max_descent / 64; -} - -void -__evas_gl_text_font_get_advances(Evas_GL_Font *fn, char *text, - int *advance_horiz, - int *advance_vert) -{ - int i, ascent, descent, pw, ph; - - if (advance_horiz) *advance_horiz = 0; - if (advance_horiz) *advance_vert = 0; - if (!fn) return; - if (!text) return; - if (text[0] == 0) return; - - ascent = fn->ascent; - descent = fn->descent; - pw = 0; - ph = ascent + descent; - - for (i = 0; text[i]; i++) - { - Evas_GL_Glyph *g; - int glyph; - - glyph = ((unsigned char *)text)[i]; - g = __evas_gl_text_font_get_glyph(fn, glyph); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - if (i == 0) - pw += ((-g->metrics.bearingX) / 64); - pw += g->metrics.advance / 64; - } - *advance_horiz = pw; - *advance_vert = ph; -} - -int -__evas_gl_text_font_get_first_inset(Evas_GL_Font *fn, char *text) -{ - int i; - - if (!fn) return 0; - if (!text) return 0; - if (text[0] == 0) return 0; - - for (i = 0; text[i]; i++) - { - Evas_GL_Glyph *g; - int glyph; - - glyph = ((unsigned char *)text)[i]; - g = __evas_gl_text_font_get_glyph(fn, glyph); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - return ((-g->metrics.bearingX) / 64); - } - return 0; -} - -void -__evas_gl_text_font_add_path(char *path) -{ - int i; - - for (i = 0; i < __evas_fpath_num; i++) - { - if (!strcmp(path, __evas_fpath[i])) return; - } - __evas_fpath_num++; - if (!__evas_fpath) __evas_fpath = malloc(sizeof(char *)); - else __evas_fpath = realloc(__evas_fpath, - (__evas_fpath_num * sizeof(char *))); - __evas_fpath[__evas_fpath_num - 1] = malloc(strlen(path) + 1); - strcpy(__evas_fpath[__evas_fpath_num - 1], path); -} - -void -__evas_gl_text_font_del_path(char *path) -{ - int i, j; - - for (i = 0; i < __evas_fpath_num; i++) - { - if (!strcmp(path, __evas_fpath[i])) - { - __evas_fpath_num--; - for (j = i; j < __evas_fpath_num; j++) - __evas_fpath[j] = __evas_fpath[j + 1]; - if (__evas_fpath_num > 0) - __evas_fpath = realloc(__evas_fpath, - __evas_fpath_num * sizeof(char *)); - else - { - free(__evas_fpath); - __evas_fpath = NULL; - } - } - } -} - -char ** -__evas_gl_text_font_list_paths(int *count) -{ - *count = __evas_fpath_num; - return __evas_fpath; -} - -void -__evas_gl_text_cache_empty(Display *disp) -{ - int prev_cache; - - prev_cache = __evas_font_cache_max; - __evas_font_cache_max = 0; - __evas_gl_text_font_cache_flush(); - __evas_font_cache_max = prev_cache; -} - -void -__evas_gl_text_cache_set_size(Display *disp, int size) -{ - __evas_font_cache_max = size; - __evas_gl_text_font_cache_flush(); -} - -int -__evas_gl_text_cache_get_size(Display *disp) -{ - return __evas_font_cache_max; -} - -void -__evas_gl_text_draw(Evas_GL_Font *fn, Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, int x, int y, char *text, - int cr, int cg, int cb, int ca) -{ - Evas_GL_Window *glw; - Evas_List l; - int go; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca <= 0) return; - glw = __evas_gl_window_current(disp, win, win_w, win_h); - if (!glw) return; - __evas_gl_window_texture(glw, 1); - __evas_gl_window_blend(glw, 1); - __evas_gl_window_write_buf(glw, GL_BACK); - __evas_gl_window_read_buf(glw, GL_BACK); - __evas_gl_window_color(glw, cr, cg, cb, ca); - __evas_gl_window_dither(glw, 1); - -#ifndef GLNOCLIP - for (l = glw->updates; l; l = l->next) - { - Evas_GL_Rect *rect; - - go = 1; - rect = l->data; - { - int rx, ry, rw, rh; - - rx = 0; - ry = 0; - rw = win_w; - rh = win_h; - CLIP_TO(rx, ry, rw, rh, rect->x, rect->y, rect->w, rect->h); - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } -#else - go = 1; - { - int rx, ry, rw, rh; - - rx = 0; - ry = 0; - rw = win_w; - rh = win_h; - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } - else - __evas_gl_window_clip(glw, 0, 0, 0, 0, 0); - } -#endif - /* render string here */ - if (go) - { - int i; - int x_offset, y_offset; - int glyph, rows; - Evas_GL_Glyph *g; - - if (text[0] == 0) return; - glyph = ((unsigned char *)text)[0]; - g = __evas_gl_text_font_get_glyph(fn, glyph); - if (!TT_VALID(g->glyph)) -#ifndef GLNOCLIP - continue; -#else - return; -#endif - x_offset = 0; - if (g) x_offset = - (g->metrics.bearingX / 64); - y_offset = -(fn->max_descent / 64); - __evas_gl_text_get_size(fn, text, NULL, &rows); - for (i = 0; text[i]; i++) - { - int xmin, ymin, xmax, ymax, off, adj; - - /* for internationalization this here wouldnt just use */ - /* the char value of the text[i] but translate form utf-8 */ - /* or whetever and incriment i appropriately and set g to */ - /* the glyph index */ - glyph = ((unsigned char *)text)[i]; - g = __evas_gl_text_font_get_glyph(fn, glyph); - __evas_gl_text_font_render_glyph(glw, fn, g); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - - xmin = g->metrics.bbox.xMin & -64; - ymin = g->metrics.bbox.yMin & -64; - xmax = (g->metrics.bbox.xMax + 63) & -64; - ymax = (g->metrics.bbox.yMax + 63) & -64; - - xmin = (xmin >> 6) + x_offset; - ymin = (ymin >> 6) + y_offset; - xmax = (xmax >> 6) + x_offset; - ymax = (ymax >> 6) + y_offset; - - if (ymin < 0) off = 0; - else off = rows - ymin - 1; - adj = (rows - ymax) - - ((fn->max_ascent - fn->max_descent) >> 6); - if ((g->texture) && (g->texture->texture)) - { - __evas_gl_window_texture(glw, 1); - __evas_gl_window_use_texture(glw, - g->texture->texture, - 0); - } - else - __evas_gl_window_texture(glw, 0); - glBegin(GL_QUADS); - glTexCoord2d(g->tex.x1, g->tex.y1); - glVertex2i(x + xmin, y + ymin + off + adj); - glTexCoord2d(g->tex.x2, g->tex.y1); - glVertex2i(x + xmax + 1, y + ymin + off + adj); - glTexCoord2d(g->tex.x2, g->tex.y2); - glVertex2i(x + xmax + 1, y + ymax + off + adj + 1); - glTexCoord2d(g->tex.x1, g->tex.y2); - glVertex2i(x + xmin, y + ymax + off + adj + 1); - glEnd(); - x_offset += g->metrics.advance / 64; - } - } -#ifndef GLNOCLIP - } -#endif -} - -void -__evas_gl_text_get_size(Evas_GL_Font *fn, char *text, int *w, int *h) -{ - int i, pw, ph; - Evas_GL_Glyph *g; - int glyph; - - if (!fn) return; - if (!text) return; - if (text[0] == 0) return; - pw = 0; - ph = (fn->max_ascent - fn->max_descent) / 64; - for (i = 0; text[i]; i++) - { - /* for internationalization this here wouldnt just use */ - /* the char value of the text[i] but translate form utf-8 */ - /* or whetever and incriment i appropriately and set g to */ - /* the glyph index */ - glyph = ((unsigned char *)text)[i]; - g = __evas_gl_text_font_get_glyph(fn, glyph); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - if (i == 0) - pw += ((-g->metrics.bearingX) / 64); - if (text[i + 1] == 0) /* last char - ineternationalization issue */ - { - if ((g->metrics.bbox.xMax / 64) == 0) - pw += (g->metrics.advance / 64); - else - pw += (g->metrics.bbox.xMax / 64); - } - else - pw += g->metrics.advance / 64; - } - if (w) *w = pw; - if (h) *h = ph; -} - -int -__evas_gl_text_get_character_at_pos(Evas_GL_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch) -{ - int i, px, ppx; - - if (cx) *cx = 0; - if (cy) *cy = 0; - if (cw) *cw = 0; - if (ch) *ch = 0; - if (!fn) return -1; - if (!text) return -1; - if (text[0] == 0) return -1; - - if ((y < 0) || (y > (fn->ascent + fn->descent))) return -1; - if (cy) *cy = 0; - if (ch) *ch = fn->ascent + fn->descent; - ppx = 0; - px = 0; - for (i = 0; text[i]; i++) - { - Evas_GL_Glyph *g; - int glyph; - - glyph = ((unsigned char *)text)[i]; - g = __evas_gl_text_font_get_glyph(fn, glyph); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - if (i == 0) - px += ((-g->metrics.bearingX) / 64); - if (text[i + 1] == 0) - px += (g->metrics.bbox.xMax / 64); - else - px += g->metrics.advance / 64; - if ((x >= ppx) && (x < px)) - { - if (cx) - *cx = ppx; - if (cw) - *cw = px - ppx; - return i; - } - } - return -1; -} - -void -__evas_gl_text_get_character_number(Evas_GL_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch) -{ - int i, px, ppx; - - if (cx) *cx = 0; - if (cy) *cy = 0; - if (cw) *cw = 0; - if (ch) *ch = 0; - if (!fn) return; - if (!text) return; - if (text[0] == 0) return; - - if (cy) *cy = 0; - if (ch) *ch = fn->ascent + fn->descent; - ppx = 0; - px = 0; - for (i = 0; text[i]; i++) - { - Evas_GL_Glyph *g; - int glyph; - - glyph = ((unsigned char *)text)[i]; - g = __evas_gl_text_font_get_glyph(fn, glyph); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - ppx = px; - if (i == 0) - px += ((-g->metrics.bearingX) / 64); - if (text[i + 1] == 0) - px += (g->metrics.bbox.xMax / 64); - else - px += g->metrics.advance / 64; - if (i == num) - { - if (cx) *cx = ppx; - if (cw) *cw = px - ppx; - return; - } - } -} - -/*****************************************************************************/ -/* rectangle externals *******************************************************/ -/*****************************************************************************/ - -void __evas_gl_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - int x, int y, int w, int h, - int cr, int cg, int cb, int ca) -{ - Evas_GL_Window *glw; - Evas_List l; - int go; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca <= 0) return; - if (w < 1) return; - if (h < 1) return; - glw = __evas_gl_window_current(disp, win, win_w, win_h); - if (!glw) return; - __evas_gl_window_texture(glw, 0); - if (ca < 255) __evas_gl_window_blend(glw, 1); - else __evas_gl_window_blend(glw, 0); - __evas_gl_window_write_buf(glw, GL_BACK); - __evas_gl_window_read_buf(glw, GL_BACK); - __evas_gl_window_color(glw, cr, cg, cb, ca); - __evas_gl_window_dither(glw, 1); - -#ifndef GLNOCLIP - for (l = glw->updates; l; l = l->next) - { - Evas_GL_Rect *rect; - - go = 1; - rect = l->data; - { - int rx, ry, rw, rh; - - rx = x; - ry = y; - rw = w; - rh = h; - CLIP_TO(rx, ry, rw, rh, rect->x, rect->y, rect->w, rect->h); - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } -#else - go = 1; - { - int rx, ry, rw, rh; - - rx = x; - ry = y; - rw = w; - rh = h; - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } - else - __evas_gl_window_clip(glw, 0, 0, 0, 0, 0); - } -#endif - /* render rect here */ - if (go) - { - double x1, x2, y1, y2; - - x1 = (double)x; - y1 = (double)y; - x2 = (double)(x + w); - y2 = (double)(y + h); - glBegin(GL_QUADS); - glVertex2d(x1, y1); - glVertex2d(x2, y1); - glVertex2d(x2, y2); - glVertex2d(x1, y2); - glEnd(); - } -#ifndef GLNOCLIP - } -#endif -} - -/*****************************************************************************/ -/* line externals ************************************************************/ -/*****************************************************************************/ - -void __evas_gl_line_draw(Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - int x1, int y1, int x2, int y2, - int cr, int cg, int cb, int ca) -{ - Evas_GL_Window *glw; - Evas_List l; - int go; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca <= 0) return; - glw = __evas_gl_window_current(disp, win, win_w, win_h); - if (!glw) return; - __evas_gl_window_texture(glw, 0); - if (ca < 255) __evas_gl_window_blend(glw, 1); - else __evas_gl_window_blend(glw, 0); - __evas_gl_window_write_buf(glw, GL_BACK); - __evas_gl_window_read_buf(glw, GL_BACK); - __evas_gl_window_color(glw, cr, cg, cb, ca); - __evas_gl_window_dither(glw, 1); - -#ifndef GLNOCLIP - for (l = glw->updates; l; l = l->next) - { - Evas_GL_Rect *rect; - - go = 1; - rect = l->data; - { - int rx, ry, rw, rh; - - rx = 0; - ry = 0; - rw = win_w; - rh = win_h; - CLIP_TO(rx, ry, rw, rh, rect->x, rect->y, rect->w, rect->h); - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } -#else - go = 1; - { - int rx, ry, rw, rh; - - rx = 0; - ry = 0; - rw = win_w; - rh = win_h; - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } - else - __evas_gl_window_clip(glw, 0, 0, 0, 0, 0); - } -#endif - /* render rect here */ - if (go) - { - glBegin(GL_LINES); - glVertex2d((double)x1 + 0.5, (double)y1 + 0.5); - glVertex2d((double)x2 + 0.5, (double)y2 + 0.5); - glEnd(); - } -#ifndef GLNOCLIP - } -#endif -} - -/*****************************************************************************/ -/* gradient externals ********************************************************/ -/*****************************************************************************/ - -Evas_GL_Graident * -__evas_gl_gradient_new(Display *disp) -{ - Evas_GL_Graident *gr; - - gr = malloc(sizeof(Evas_GL_Graident)); - gr->col_range = NULL; - gr->textures = NULL; -} - -void -__evas_gl_gradient_free(Evas_GL_Graident *gr) -{ - if (gr->col_range) - { - imlib_context_set_color_range(gr->col_range); - imlib_free_color_range(); - } - if (gr->textures); - { - Evas_List l; - - for (l = gr->textures; l; l = l->next) - { - Evas_GL_Graident_Texture *tg; - - tg = l->data; - __evas_gl_gradient_texture_free(tg); - } - evas_list_free(gr->textures); - } - free(gr); -} - -void -__evas_gl_gradient_color_add(Evas_GL_Graident *gr, int r, int g, int b, - int a, int dist) -{ - if (!gr->col_range) gr->col_range = imlib_create_color_range(); - imlib_context_set_color_range(gr->col_range); - imlib_context_set_color(r, g, b, a); - imlib_add_color_to_color_range(dist); -} - -void -__evas_gl_gradient_draw(Evas_GL_Graident *gr, - Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, - int x, int y, int w, int h, double angle) -{ - Evas_GL_Window *glw; - Evas_List l; - int go; - int cr, cg, cb, ca; - Evas_GL_Graident_Texture *tg; - - if (__evas_clip) - { - cr = __evas_clip_r; - cg = __evas_clip_g; - cb = __evas_clip_b; - ca = __evas_clip_a; - } - else - { - cr = 255; - cg = 255; - cb = 255; - ca = 255; - } - if (ca <= 0) return; - if (w < 1) return; - if (h < 1) return; - glw = __evas_gl_window_current(disp, win, win_w, win_h); - if (!glw) return; - __evas_gl_window_texture(glw, 1); - __evas_gl_window_blend(glw, 1); - __evas_gl_window_write_buf(glw, GL_BACK); - __evas_gl_window_read_buf(glw, GL_BACK); - __evas_gl_window_color(glw, cr, cg, cb, ca); - __evas_gl_window_dither(glw, 1); - -#ifndef GLNOCLIP - for (l = glw->updates; l; l = l->next) - { - Evas_GL_Rect *rect; - - go = 1; - rect = l->data; - { - int rx, ry, rw, rh; - - rx = x; - ry = y; - rw = w; - rh = h; - CLIP_TO(rx, ry, rw, rh, rect->x, rect->y, rect->w, rect->h); - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } -#else - go = 1; - { - int rx, ry, rw, rh; - - rx = x; - ry = y; - rw = w; - rh = h; - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } - else - __evas_gl_window_clip(glw, 0, 0, 0, 0, 0); - } -#endif - /* render gradient here */ - if (go) - { - double x1, x2, y1, y2; - double max, t[8]; - int i; - - tg = __evas_gl_gradient_texture_new(glw, gr); - if (!tg->texture) - { - Imlib_Image prev_im, im; - DATA32 *data; - int tw, th; - - tw = glw->context->max_texture_size; - th = 4; - im = imlib_create_image(tw, th); - prev_im = imlib_context_get_image(); - imlib_context_set_image(im); - imlib_image_set_has_alpha(1); - data = imlib_image_get_data(); - memset(data, 0, tw * th * sizeof(DATA32)); - imlib_image_put_back_data(data); - imlib_context_set_color_range(gr->col_range); - imlib_image_fill_color_range_rectangle(1, 1, tw - 2, th - 2, - 270.0); - data = imlib_image_get_data(); - memcpy(&(data[(1) + (0 * tw)]), &(data[(1) + (1 * tw)]), - (tw - 2) * sizeof(DATA32)); - memcpy(&(data[(1) + (3 * tw)]), &(data[(1) + (2 * tw)]), - (tw - 2) * sizeof(DATA32)); - data[(0) + (0 * tw)] = data[(1) + (0 * tw)]; - data[(0) + (1 * tw)] = data[(1) + (1 * tw)]; - data[(0) + (2 * tw)] = data[(1) + (2 * tw)]; - data[(0) + (3 * tw)] = data[(1) + (3 * tw)]; - data[(tw - 1) + (0 * tw)] = data[(tw - 2) + (0 * tw)]; - data[(tw - 1) + (1 * tw)] = data[(tw - 2) + (1 * tw)]; - data[(tw - 1) + (2 * tw)] = data[(tw - 2) + (2 * tw)]; - data[(tw - 1) + (3 * tw)] = data[(tw - 2) + (3 * tw)]; - imlib_image_put_back_data(data); - tg->texture = __evas_gl_texture_new(glw, im, 0, 0, tw, th); - imlib_free_image(); - } - __evas_gl_window_use_texture(glw, tg->texture, 1); - t[0] = cos(((-angle + 45 + 90) * 2 * 3.141592654) / 360); - t[1] = sin(((-angle + 45 + 90) * 2 * 3.141592654) / 360); - - t[2] = cos(((-angle + 45 + 180) * 2 * 3.141592654) / 360); - t[3] = sin(((-angle + 45 + 180) * 2 * 3.141592654) / 360); - - t[4] = cos(((-angle + 45 + 270) * 2 * 3.141592654) / 360); - t[5] = sin(((-angle + 45 + 270) * 2 * 3.141592654) / 360); - - t[6] = cos(((-angle + 45 + 0) * 2 * 3.141592654) / 360); - t[7] = sin(((-angle + 45 + 0) * 2 * 3.141592654) / 360); - max = 0; - for (i = 0; i < 8; i++) - { - if ((t[i] < 0) && (-t[i] > max)) max = -t[i]; - else if ((t[i] > max)) max = t[i]; - } - if (max > 0) - { - for (i = 0; i < 8; i++) t[i] *= 1 / max; - } - for (i = 0; i < 8; i+=2) - { - t[i] = (1.0 + - ((((0.5) + (t[i] / 2.0)) * - ((double)glw->context->max_texture_size - 2.0)))) / - (double)glw->context->max_texture_size; - t[i + 1] = (1.0 + ((((0.5) - (t[i + 1] / 2.0))) * 2.0)) / 4.0; - } - x1 = (double)x; - y1 = (double)y; - x2 = (double)(x + w); - y2 = (double)(y + h); - glBegin(GL_QUADS); - glTexCoord2d(t[0], t[1]); glVertex2d(x1, y1); - glTexCoord2d(t[2], t[3]); glVertex2d(x2, y1); - glTexCoord2d(t[4], t[5]); glVertex2d(x2, y2); - glTexCoord2d(t[6], t[7]); glVertex2d(x1, y2); - glEnd(); - } -#ifndef GLNOCLIP - } -#endif -} - -/* something is wrong here - GL experts? the polys dont get tesselated */ -/* correctly */ - -#ifdef HAVE_GLU -static void -__evas_gl_tess_begin_cb(GLenum which) -{ - glBegin(which); -} -static void -__evas_gl_tess_end_cb(void) -{ - glEnd(); -} - -static void -__evas_gl_tess_error_cb(GLenum errorcode) -{ -} - -static void -__evas_gl_tess_vertex_cb(GLvoid *vertex) -{ - GLdouble *v; - - v = vertex; - glVertex2d(v[0], v[1]); -} - -static void -__evas_gl_tess_combine_cb(GLdouble coords[3], - GLdouble *vertex_data[4], - GLfloat weight[4], GLdouble **data_out) -{ - GLdouble *vertex; - - vertex = (GLdouble *) malloc(6 * sizeof(GLdouble)); - vertex[0] = coords[0]; - vertex[1] = coords[1]; - *data_out = vertex; -} -#endif - -/************/ -/* polygons */ -/************/ -void -__evas_gl_poly_draw (Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - Evas_List points, - int cr, int cg, int cb, int ca) -{ - Evas_GL_Window *glw; - Evas_List l; - int go; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca <= 0) return; - glw = __evas_gl_window_current(disp, win, win_w, win_h); - if (!glw) return; - __evas_gl_window_texture(glw, 0); - if (ca < 255) __evas_gl_window_blend(glw, 1); - else __evas_gl_window_blend(glw, 0); - __evas_gl_window_write_buf(glw, GL_BACK); - __evas_gl_window_read_buf(glw, GL_BACK); - __evas_gl_window_color(glw, cr, cg, cb, ca); - __evas_gl_window_dither(glw, 1); - -#ifndef GLNOCLIP - for (l = glw->updates; l; l = l->next) - { - Evas_GL_Rect *rect; - - go = 1; - rect = l->data; - { - int rx, ry, rw, rh; - - rx = 0; - ry = 0; - rw = win_w; - rh = win_h; - CLIP_TO(rx, ry, rw, rh, rect->x, rect->y, rect->w, rect->h); - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } -#else - go = 1; - { - int rx, ry, rw, rh; - - rx = 0; - ry = 0; - rw = win_w; - rh = win_h; - if (__evas_clip) - { - CLIP_TO(rx, ry, rw, rh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - if ((rw > 0) && (rh > 0)) - __evas_gl_window_clip(glw, 1, rx, ry, rw, rh); - else go = 0; - } - else - __evas_gl_window_clip(glw, 0, 0, 0, 0, 0); - } -#endif - /* render poly here */ - if (go) - { - Evas_List l2; -#ifdef HAVE_GLU - { - static void *tess = NULL; - GLdouble *glp = NULL; - int i, num; - - if (!tess) - { - tess = gluNewTess(); - - gluTessCallback(tess, GLU_TESS_BEGIN, __evas_gl_tess_begin_cb); - gluTessCallback(tess, GLU_TESS_END, __evas_gl_tess_end_cb); - gluTessCallback(tess, GLU_TESS_ERROR, __evas_gl_tess_error_cb); - gluTessCallback(tess, GLU_TESS_VERTEX, __evas_gl_tess_vertex_cb); - gluTessCallback(tess, GLU_TESS_COMBINE, __evas_gl_tess_combine_cb); - } - num = 0; - for (l2 = points; l2; l2 = l2->next) num++; - i = 0; - glp = malloc(num * 6 * sizeof(GLdouble)); - gluTessNormal(tess, 0, 0, 1); - gluTessProperty(tess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD); - gluTessBeginPolygon(tess, NULL); - gluTessBeginContour(tess); - for (l2 = points; l2; l2 = l2->next) - { - Evas_Point p; - - p = l2->data; - glp[i++] = p->x; - glp[i++] = p->y; - glp[i++] = 0; - gluTessVertex(tess, &(glp[i - 3]), &(glp[i - 3])); - i += 3; - } - gluTessEndContour(tess); - gluTessEndPolygon(tess); - free(glp); - } -#else - glBegin(GL_POLYGON); - for (l2 = points; l2; l2 = l2->next) - { - Evas_Point p; - - p = l2->data; - glVertex2d(p->x, p->y); - } - glEnd(); -#endif - } -#ifndef GLNOCLIP - } -#endif -} - -/*****************************************************************************/ -/* general externals *********************************************************/ -/*****************************************************************************/ - -void -__evas_gl_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a) -{ - __evas_clip = on; - __evas_clip_x = x; - __evas_clip_y = y; - __evas_clip_w = w; - __evas_clip_h = h; - __evas_clip_r = r; - __evas_clip_g = g; - __evas_clip_b = b; - __evas_clip_a = a; -} - -void -__evas_gl_sync(Display *disp) -{ - glFlush(); - glXWaitGL(); - XSync(disp, False); -} - -void -__evas_gl_flush_draw(Display *disp, Imlib_Image dstim, Window win) -{ - Evas_GL_Window *glw; - Evas_List l; - - glw = __evas_gl_window_lookup(disp, win); - if (!glw) return; - if (glw->updates) - { - for (l = glw->updates; l; l = l->next) - { - Evas_GL_Rect *rect; - - rect = l->data; -#ifndef GLSWB - __evas_gl_window_swap_rect(glw, rect->x, rect->y, rect->w, rect->h); -#endif - free(rect); - } - evas_list_free(glw->updates); - glw->updates = NULL; - } -#ifdef GLSWB - glXSwapBuffers(disp, win); -#endif -} - -void -__evas_gl_set_vis_cmap(Visual *vis, Colormap cmap) -{ -} - -int -__evas_gl_capable(Display *disp) -{ - int eb, evb; - Evas_List l; - static Evas_List capables = NULL; - - for (l = capables; l; l = l->next) - { - if (l->data == disp) return 1; - } - if (glXQueryExtension(disp, &eb, &evb)) - { - capables = evas_list_prepend(capables, disp); - return 1; - } - return 0; -} - -static XVisualInfo *__evas_vi = NULL; - -Visual * -__evas_gl_get_visual(Display *disp, int screen) -{ - static Display *d = NULL; - - if (d != disp) - { - d = disp; - __evas_vi = glXChooseVisual(disp, screen, __evas_gl_configuration); - } - return __evas_vi->visual; -} - -XVisualInfo * -__evas_gl_get_visual_info(Display *disp, int screen) -{ - __evas_gl_get_visual(disp, screen); - return __evas_vi; -} - -Colormap -__evas_gl_get_colormap(Display *disp, int screen) -{ - static Display *d = NULL; - static Colormap cmap = 0; - - if (!__evas_vi) __evas_gl_get_visual(disp, screen); - if (d != disp) - { - d = disp; - cmap = XCreateColormap(disp, RootWindow(disp, screen), __evas_vi->visual, 0); - } - return cmap; -} - -void -__evas_gl_init(Display *disp, int screen, int colors) -{ -} - -void -__evas_gl_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, - int x, int y, int w, int h) -{ - Evas_GL_Window *glw; - Evas_GL_Rect *rect; - - glw = __evas_gl_window_lookup(disp, win); - if (!glw) return; -#ifdef GLBOUNDING - if (glw->updates) - { - rect = glw->updates->data; - if (x < rect->x) - { - rect->w += (rect->x - x); - rect->x = x; - } - if ((x + w) > (rect->x + rect->w)) - { - rect->w = (x + w) - rect->x; - } - if (y < rect->y) - { - rect->h += (rect->y - y); - rect->y = y; - } - if ((y + h) > (rect->y + rect->h)) - { - rect->h = (y + h) - rect->y; - } - return; - } -#endif - rect = malloc(sizeof(Evas_GL_Rect)); - rect->x = x; - rect->y = y; - rect->w = w; - rect->h = h; - glw->updates = evas_list_append(glw->updates, rect); -} - -#else - -/***************/ -/* image stuff */ -/***************/ -Evas_GL_Image *__evas_gl_image_new_from_file(Display *disp, char *file){return NULL;} -void __evas_gl_image_free(Evas_GL_Image *im){} -void __evas_gl_image_cache_empty(Display *disp){} -void __evas_gl_image_cache_set_size(Display *disp, int size){} -int __evas_gl_image_cache_get_size(Display *disp){return 0;} -int __evas_gl_image_get_width(Evas_GL_Image *im){return 0;} -int __evas_gl_image_get_height(Evas_GL_Image *im){return 0;} -void __evas_gl_image_set_borders(Evas_GL_Image *im, int left, int right, int top, int bottom){} -void __evas_gl_image_set_smooth_scaling(int on){} -void __evas_gl_image_draw(Evas_GL_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int cr, int cg, int cb, int ca){} - -/********/ -/* text */ -/********/ -Evas_GL_Font *__evas_gl_text_font_new(Display *disp, char *font, int size){return NULL;} -void __evas_gl_text_font_free(Evas_GL_Font *fn){} -void __evas_gl_text_font_add_path(char *path){} -int __evas_gl_text_font_get_ascent(Evas_GL_Font *fn){return 0;} -int __evas_gl_text_font_get_descent(Evas_GL_Font *fn){return 0;} -int __evas_gl_text_font_get_max_ascent(Evas_GL_Font *fn){return 0;} -int __evas_gl_text_font_get_max_descent(Evas_GL_Font *fn){return 0;} -void __evas_gl_text_font_get_advances(Evas_GL_Font *fn, char *text, int *advance_horiz, int *advance_vert){} -int __evas_gl_text_font_get_first_inset(Evas_GL_Font *fn, char *text){return 0;} -void __evas_gl_text_font_del_path(char *path){} -char **__evas_gl_text_font_list_paths(int *count){return NULL;} -void __evas_gl_text_cache_empty(Display *disp){} -void __evas_gl_text_cache_set_size(Display *disp, int size){} -int __evas_gl_text_cache_get_size(Display *disp){return 0;} -void __evas_gl_text_get_size(Evas_GL_Font *fn, char *text, int *w, int *h){} -int __evas_gl_text_get_character_at_pos(Evas_GL_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch){return 0;} -void __evas_gl_text_get_character_number(Evas_GL_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch){} -void __evas_gl_text_draw(Evas_GL_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a){} - -/**************/ -/* rectangles */ -/**************/ -void __evas_gl_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a){} - -/*********/ -/* lines */ -/*********/ -void __evas_gl_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a){} - -/*************/ -/* gradients */ -/*************/ -Evas_GL_Graident *__evas_gl_gradient_new(Display *disp){return NULL;} -void __evas_gl_gradient_free(Evas_GL_Graident *gr){} -void __evas_gl_gradient_color_add(Evas_GL_Graident *gr, int r, int g, int b, int a, int dist){} -void __evas_gl_gradient_draw(Evas_GL_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle){} - -/************/ -/* polygons */ -/************/ -void __evas_gl_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a) {} - -/***********/ -/* drawing */ -/***********/ -void __evas_gl_init(Display *disp, int screen, int colors){} -int __evas_gl_capable(Display *disp){return 0;} -void __evas_gl_flush_draw(Display *disp, Imlib_Image dstim, Window win){} -void __evas_gl_sync(Display *disp){} -Visual *__evas_gl_get_visual(Display *disp, int screen){return NULL;} -XVisualInfo *__evas_gl_get_visual_info(Display *disp, int screen){return NULL;} -Colormap __evas_gl_get_colormap(Display *disp, int screen){return 0;} -void __evas_gl_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h){} - -#endif diff --git a/legacy/evas/src/evas_gl_routines.h b/legacy/evas/src/evas_gl_routines.h deleted file mode 100644 index 269aaf1250..0000000000 --- a/legacy/evas/src/evas_gl_routines.h +++ /dev/null @@ -1,276 +0,0 @@ -#include "config.h" -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_GL -#include -#include -#ifdef HAVE_GLU -#include -#endif -#else -typedef int GLXContext; -typedef int GLuint; -#endif - -#include -#include -#include -#include - -#ifdef HAVE_FREETYPE1_FREETYPE_FREETYPE_H -#include -#else -#ifdef HAVE_FREETYPE_FREETYPE_H -#include -#else -#include -#endif -#endif - -#include "Evas_private.h" -#include "Evas.h" - -typedef struct _evas_gl_image Evas_GL_Image; -typedef struct _evas_gl_font Evas_GL_Font; -typedef struct _evas_gl_gradient Evas_GL_Graident; - -typedef struct _evas_gl_font_texture Evas_GL_Font_Texture; -typedef struct _evas_gl_glpyh_texture Evas_GL_Glyph_Texture; -typedef struct _evas_gl_glyph Evas_GL_Glyph; -typedef struct _evas_gl_gradient_texture Evas_GL_Graident_Texture; -typedef struct _evas_gl_window Evas_GL_Window; -typedef struct _evas_gl_context Evas_GL_Context; -typedef struct _evas_gl_rect Evas_GL_Rect; -typedef struct _evas_gl_texture Evas_GL_Texture; -typedef struct _evas_gl_texmesh Evas_GL_Texmesh; - -struct _evas_gl_window -{ - Display *disp; - Window win; - Window root; - int screen; - Evas_GL_Context *context; - Evas_List updates; - int w, h; -}; - -struct _evas_gl_context -{ - Display *disp; - int screen; - GLXContext context; - Window win; - Window root; - XVisualInfo *visualinfo; - Visual *visual; - Colormap colormap; - int dither; - int blend; - int texture; - DATA32 color; - struct { - int active; - int x, y, w, h; - } clip; -#ifdef HAVE_GL - GLenum read_buf; - GLenum write_buf; -#endif - Evas_GL_Texture *bound_texture; - - int max_texture_depth; - int max_texture_size; -}; - -struct _evas_gl_rect -{ - int x, y, w, h; -}; - -struct _evas_gl_texture -{ - int w, h; -#ifdef HAVE_GL - GLuint texture; -#endif - int smooth; -}; - -struct _evas_gl_texmesh -{ - struct { - int x, y; - int x_edge, y_edge; - int x_left, y_left; - } tiles; - Evas_GL_Texture **textures; - Evas_GL_Window *window; - Evas_GL_Context *context; -}; - -struct _evas_gl_image -{ - char *file; - Imlib_Image im; - int w, h; - struct { - int l, r, t, b; - } border; - int has_alpha; - Evas_List textures; - int references; -}; - -struct _evas_gl_gradient_texture -{ - Evas_GL_Window *window; - Evas_GL_Context *context; - Evas_GL_Texture *texture; -}; - -struct _evas_gl_gradient -{ - Imlib_Color_Range col_range; - Evas_List textures; -}; - -struct _evas_gl_glpyh_texture -{ - struct { - double x1, x2, y1, y2; - } tex; - Evas_GL_Window *window; - Evas_GL_Context *context; - Evas_GL_Texture *texture; -}; - -struct _evas_gl_glyph -{ - int glyph_id; - TT_Glyph glyph; - - TT_Glyph_Metrics metrics; - - Evas_GL_Glyph_Texture *texture; - - struct { - double x1, x2, y1, y2; - } tex; - - Evas_List textures; -}; - -struct _evas_gl_font_texture -{ - struct { - int x, y; - int row_h; - } cursor; - Evas_GL_Window *window; - Evas_GL_Context *context; - Evas_GL_Texture *texture; -}; - -struct _evas_gl_font -{ - char *font; - int size; - - TT_Engine engine; - TT_Face face; - TT_Instance instance; - TT_Face_Properties properties; - TT_CharMap char_map; - TT_Instance_Metrics metrics; - - Evas_List glyphs[256]; - - Evas_List textures; - - int ascent; - int descent; - int max_descent; - int max_ascent; - - int references; -}; - -/***************/ -/* image stuff */ -/***************/ -Evas_GL_Image *__evas_gl_image_new_from_file(Display *disp, char *file); -void __evas_gl_image_free(Evas_GL_Image *im); -void __evas_gl_image_cache_empty(Display *disp); -void __evas_gl_image_cache_set_size(Display *disp, int size); -int __evas_gl_image_cache_get_size(Display *disp); -int __evas_gl_image_get_width(Evas_GL_Image *im); -int __evas_gl_image_get_height(Evas_GL_Image *im); -void __evas_gl_image_set_borders(Evas_GL_Image *im, int left, int right, int top, int bottom); -void __evas_gl_image_set_smooth_scaling(int on); -void __evas_gl_image_draw(Evas_GL_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int cr, int cg, int cb, int ca); - -/********/ -/* text */ -/********/ -Evas_GL_Font *__evas_gl_text_font_new(Display *disp, char *font, int size); -void __evas_gl_text_font_free(Evas_GL_Font *fn); -int __evas_gl_text_font_get_ascent(Evas_GL_Font *fn); -int __evas_gl_text_font_get_descent(Evas_GL_Font *fn); -int __evas_gl_text_font_get_max_ascent(Evas_GL_Font *fn); -int __evas_gl_text_font_get_max_descent(Evas_GL_Font *fn); -void __evas_gl_text_font_get_advances(Evas_GL_Font *fn, char *text, int *advance_horiz, int *advance_vert); -int __evas_gl_text_font_get_first_inset(Evas_GL_Font *fn, char *text); -void __evas_gl_text_font_add_path(char *path); -void __evas_gl_text_font_del_path(char *path); -char **__evas_gl_text_font_list_paths(int *count); -void __evas_gl_text_cache_empty(Display *disp); -void __evas_gl_text_cache_set_size(Display *disp, int size); -int __evas_gl_text_cache_get_size(Display *disp); -void __evas_gl_text_get_size(Evas_GL_Font *fn, char *text, int *w, int *h); -int __evas_gl_text_get_character_at_pos(Evas_GL_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch); -void __evas_gl_text_get_character_number(Evas_GL_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch); -void __evas_gl_text_draw(Evas_GL_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a); - -/**************/ -/* rectangles */ -/**************/ -void __evas_gl_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a); - -/*********/ -/* lines */ -/*********/ -void __evas_gl_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a); - -/*************/ -/* gradients */ -/*************/ -Evas_GL_Graident *__evas_gl_gradient_new(Display *disp); -void __evas_gl_gradient_free(Evas_GL_Graident *gr); -void __evas_gl_gradient_color_add(Evas_GL_Graident *gr, int r, int g, int b, int a, int dist); -void __evas_gl_gradient_draw(Evas_GL_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle); - -/************/ -/* polygons */ -/************/ -void __evas_gl_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a); - -/***********/ -/* drawing */ -/***********/ -void __evas_gl_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a); -void __evas_gl_init(Display *disp, int screen, int colors); -void __evas_gl_set_vis_cmap(Visual *vis, Colormap cmap); -int __evas_gl_capable(Display *disp); -void __evas_gl_flush_draw(Display *disp, Imlib_Image dstim, Window win); -void __evas_gl_sync(Display *disp); -Visual *__evas_gl_get_visual(Display *disp, int screen); -XVisualInfo *__evas_gl_get_visual_info(Display *disp, int screen); -Colormap __evas_gl_get_colormap(Display *disp, int screen); -void __evas_gl_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h); diff --git a/legacy/evas/src/evas_gradient.c b/legacy/evas/src/evas_gradient.c deleted file mode 100644 index d2239071b5..0000000000 --- a/legacy/evas/src/evas_gradient.c +++ /dev/null @@ -1,292 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include -#include "evas_gl_routines.h" -#include "evas_imlib_routines.h" -#include "evas_image_routines.h" -#include "evas_x11_routines.h" -#include "evas_render_routines.h" - -static void -_evas_free_gradient_box(Evas_Object o) -{ - Evas_Object_Gradient_Box oo; - - IF_OBJ(o, OBJECT_GRADIENT_BOX) return; - oo = o; - if (oo->current.gradient) evas_gradient_free(oo->current.gradient); - free(o); -} - -static void -_evas_free_gradient_box_renderer_data(Evas e, Evas_Object o) -{ - Evas_Object_Gradient_Box oo; - - oo= o; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_imlib_gradient_free(o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_BASIC_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_x11_gradient_free(o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_3D_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_gl_gradient_free(o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_render_gradient_free(o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_IMAGE: - if (o->renderer_data.method[e->current.render_method]) - __evas_image_gradient_free(o->renderer_data.method[e->current.render_method]); - break; - default: - break; - } -} - -Evas_Object -evas_add_gradient_box(Evas e) -{ - Evas_Object_Gradient_Box oo; - Evas_Object_Any o; - Evas_List l; - Evas_Layer layer; - - if (!e) return NULL; - o = oo = malloc(sizeof(struct _Evas_Object_Gradient_Box)); - memset(o, 0, sizeof(struct _Evas_Object_Gradient_Box)); - o->type = OBJECT_GRADIENT_BOX; - o->object_free = _evas_free_gradient_box; - o->object_renderer_data_free = _evas_free_gradient_box_renderer_data; - - o->current.x = 0; - o->current.y = 0; - o->current.w = 1; - o->current.h = 1; - - oo->current.angle = 0.0; - - for (l = e->layers; l; l = l->next) - { - layer = l->data; - if (layer->layer == o->current.layer) - { - layer->objects = evas_list_append(layer->objects, o); - return o; - } - if (layer->layer > o->current.layer) - { - Evas_Layer layer_new; - - layer_new = malloc(sizeof(struct _Evas_Layer)); - memset(layer_new, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_prepend_relative(e->layers, layer_new, layer); - layer_new->objects = evas_list_append(layer_new->objects, o); - layer_new->layer = o->current.layer; - return o; - } - } - - layer = malloc(sizeof(struct _Evas_Layer)); - memset(layer, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_append(e->layers, layer); - layer->objects = evas_list_append(layer->objects, o); - - return o; -} - -void -evas_set_gradient(Evas e, Evas_Object o, Evas_Gradient grad) -{ - Evas_Object_Gradient_Box oo; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - if (!grad) return; - IF_OBJ(o, OBJECT_GRADIENT_BOX) return; - oo = o; - grad->references++; - if (oo->current.gradient) evas_gradient_free(oo->current.gradient); - oo->current.gradient = grad; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_imlib_gradient_free(o->renderer_data.method[e->current.render_method]); - { - Evas_Imlib_Graident *g; - Evas_List l; - - g = __evas_imlib_gradient_new(e->current.display); - o->renderer_data.method[e->current.render_method] = g; - for (l = grad->color_points; l; l = l->next) - { - Evas_Color_Point col; - - col= l->data; - __evas_imlib_gradient_color_add(g, col->r, col->g, col->b, - col->a, col->distance); - } - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_x11_gradient_free(o->renderer_data.method[e->current.render_method]); - { - Evas_X11_Graident *g; - Evas_List l; - - g = __evas_x11_gradient_new(e->current.display); - o->renderer_data.method[e->current.render_method] = g; - for (l = grad->color_points; l; l = l->next) - { - Evas_Color_Point col; - - col= l->data; - __evas_x11_gradient_color_add(g, col->r, col->g, col->b, - col->a, col->distance); - } - } - break; - case RENDER_METHOD_3D_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_gl_gradient_free(o->renderer_data.method[e->current.render_method]); - { - Evas_GL_Graident *g; - Evas_List l; - - g = __evas_gl_gradient_new(e->current.display); - o->renderer_data.method[e->current.render_method] = g; - for (l = grad->color_points; l; l = l->next) - { - Evas_Color_Point col; - - col= l->data; - __evas_gl_gradient_color_add(g, col->r, col->g, col->b, - col->a, col->distance); - } - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_render_gradient_free(o->renderer_data.method[e->current.render_method]); - { - Evas_Image_Graident *g; - Evas_List l; - - g = __evas_render_gradient_new(e->current.display); - o->renderer_data.method[e->current.render_method] = g; - for (l = grad->color_points; l; l = l->next) - { - Evas_Color_Point col; - - col= l->data; - __evas_render_gradient_color_add(g, col->r, col->g, col->b, - col->a, col->distance); - } - } - break; - case RENDER_METHOD_IMAGE: - if (o->renderer_data.method[e->current.render_method]) - __evas_image_gradient_free(o->renderer_data.method[e->current.render_method]); - { - Evas_Image_Graident *g; - Evas_List l; - - g = __evas_image_gradient_new(e->current.display); - o->renderer_data.method[e->current.render_method] = g; - for (l = grad->color_points; l; l = l->next) - { - Evas_Color_Point col; - - col= l->data; - __evas_image_gradient_color_add(g, col->r, col->g, col->b, - col->a, col->distance); - } - } - break; - default: - break; - } - oo->current.new_gradient = 1; - o->changed = 1; - e->changed = 1; -} - -/* gradient creating / deletion / modification */ -Evas_Gradient -evas_gradient_new(void) -{ - Evas_Gradient gr; - - gr = malloc(sizeof(struct _Evas_Gradient)); - gr->color_points = NULL; - gr->references = 1; - return gr; -} - -void -evas_gradient_free(Evas_Gradient grad) -{ - Evas_List l; - - if (!grad) return; - grad->references--; - if (grad->references > 0) return; - if (grad->color_points) - { - for (l = grad->color_points; l; l = l->next) - free(l->data); - evas_list_free(grad->color_points); - } - free(grad); -} - -void -evas_gradient_add_color(Evas_Gradient grad, int r, int g, int b, int a, int dist) -{ - Evas_Color_Point col; - - if (!grad) return; - col = malloc(sizeof(struct _Evas_Color_Point)); - col->r = r; - col->g = g; - col->b = b; - col->a = a; - col->distance = dist; - grad->color_points = evas_list_append(grad->color_points, col); -} - -void -evas_set_angle(Evas e, Evas_Object o, double angle) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - switch (o->type) - { - case OBJECT_GRADIENT_BOX: - { - Evas_Object_Gradient_Box oo; - - oo = (Evas_Object_Gradient_Box)o; - oo->current.angle = angle; - } - o->changed = 1; - e->changed = 1; - break; - default: - break; - } -} diff --git a/legacy/evas/src/evas_image.c b/legacy/evas/src/evas_image.c deleted file mode 100644 index 67de7fdb86..0000000000 --- a/legacy/evas/src/evas_image.c +++ /dev/null @@ -1,593 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include - -static void -_evas_free_image(Evas_Object o) -{ - Evas_Object_Image oo; - - IF_OBJ(o, OBJECT_IMAGE) return; - oo = o; - if (oo->current.file) _evas_remove_fileless_image(oo->current.file); - if (oo->current.file) free(oo->current.file); - free(o); -} - -static void -_evas_free_image_renderer_data(Evas e, Evas_Object o) -{ - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_imlib_image_free((void *)o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_BASIC_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_x11_image_free((void *)o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_3D_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_gl_image_free((void *)o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_render_image_free((void *)o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_IMAGE: - if (o->renderer_data.method[e->current.render_method]) - __evas_image_image_free((void *)o->renderer_data.method[e->current.render_method]); - break; - default: - break; - } - o->renderer_data.method[e->current.render_method] = NULL; -} - -/* adding objects */ -Evas_Object -evas_add_image_from_file(Evas e, const char *file) -{ - Evas_Object_Image oo; - Evas_Object_Any o; - Evas_List l; - Evas_Layer layer; - - if (!e) return NULL; - o = oo = malloc(sizeof(struct _Evas_Object_Image)); - memset(o, 0, sizeof(struct _Evas_Object_Image)); - o->type = OBJECT_IMAGE; - o->object_free = _evas_free_image; - o->object_renderer_data_free = _evas_free_image_renderer_data; - - oo->load_error = IMLIB_LOAD_ERROR_NONE; - - if (file) - { - char *tmp_name, *name, *dot; - - oo->current.file = malloc(strlen(file) + 1); - strcpy(oo->current.file, file); - - name = strrchr(oo->current.file, '/'); - if (!name) name = oo->current.file; - else name++; - - tmp_name = malloc(strlen(name) + 1); - strcpy(tmp_name, name); - dot = strchr(tmp_name, '.'); - if (dot) *dot = '\0'; - evas_object_set_name(e, o, tmp_name); - if (dot) *dot = '.'; - free(tmp_name); - - { - Imlib_Image im; - - im = imlib_load_image_with_error_return(file, &(oo->load_error)); - if (im) - { - imlib_context_set_image(im); - oo->current.image.w = imlib_image_get_width(); - oo->current.image.h = imlib_image_get_height(); - oo->current.alpha = imlib_image_has_alpha(); - imlib_free_image(); - } - else - { - oo->current.alpha = 1; - } - } - } - oo->current.fill.x = 0; - oo->current.fill.y = 0; - oo->current.fill.w = (double)oo->current.image.w; - oo->current.fill.h = (double)oo->current.image.h; - oo->current.color.r = 255; - oo->current.color.g = 255; - oo->current.color.b = 255; - oo->current.color.a = 255; - o->current.x = 0; - o->current.y = 0; - o->current.w = (double)oo->current.image.w; - o->current.h = (double)oo->current.image.h; - - for (l = e->layers; l; l = l->next) - { - layer = l->data; - if (layer->layer == o->current.layer) - { - layer->objects = evas_list_append(layer->objects, o); - return o; - } - if (layer->layer > o->current.layer) - { - Evas_Layer layer_new; - - layer_new = malloc(sizeof(struct _Evas_Layer)); - memset(layer_new, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_prepend_relative(e->layers, layer_new, layer); - layer_new->objects = evas_list_append(layer_new->objects, o); - layer_new->layer = o->current.layer; - return o; - } - } - - layer = malloc(sizeof(struct _Evas_Layer)); - memset(layer, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_append(e->layers, layer); - layer->objects = evas_list_append(layer->objects, o); - - return o; -} - -Evas_Object -evas_add_image_from_data(Evas e, void *data, Evas_Image_Format format, int w, int h) -{ - Evas_Object_Image oo; - Evas_Object_Any o; - Evas_List l; - Evas_Layer layer; - - if (!e) return NULL; - o = oo = malloc(sizeof(struct _Evas_Object_Image)); - memset(o, 0, sizeof(struct _Evas_Object_Image)); - o->type = OBJECT_IMAGE; - o->object_free = _evas_free_image; - o->object_renderer_data_free = _evas_free_image_renderer_data; - - oo->load_error = IMLIB_LOAD_ERROR_NONE; - - if (data) - { - oo->current.file = _evas_generate_filename(); - { - Imlib_Image im; - - im = imlib_create_image(w,h); - if (im) - { - DATA32 *p; - unsigned char *p1, *p2; - int i, j, k; - - imlib_context_set_image(im); - if((format==IMAGE_FORMAT_ARGB)||(format==IMAGE_FORMAT_ARGB)) - imlib_image_set_has_alpha(1); - imlib_image_clear(); - p = imlib_image_get_data(); - p2 = (unsigned char*)p; - p1 = (unsigned char*)data; - - if(format==IMAGE_FORMAT_ARGB)memcpy(p, data, w*h*4); - - for(i=0; icurrent.file); - - oo->current.image.w = imlib_image_get_width(); - oo->current.image.h = imlib_image_get_height(); - oo->current.alpha = imlib_image_has_alpha(); - imlib_free_image(); - } - else - { - oo->current.alpha = 1; - } - } - } - oo->current.fill.x = 0; - oo->current.fill.y = 0; - oo->current.fill.w = (double)oo->current.image.w; - oo->current.fill.h = (double)oo->current.image.h; - oo->current.color.r = 255; - oo->current.color.g = 255; - oo->current.color.b = 255; - oo->current.color.a = 255; - o->current.x = 0; - o->current.y = 0; - o->current.w = (double)oo->current.image.w; - o->current.h = (double)oo->current.image.h; - - for (l = e->layers; l; l = l->next) - { - layer = l->data; - if (layer->layer == o->current.layer) - { - layer->objects = evas_list_append(layer->objects, o); - return o; - } - if (layer->layer > o->current.layer) - { - Evas_Layer layer_new; - - layer_new = malloc(sizeof(struct _Evas_Layer)); - memset(layer_new, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_prepend_relative(e->layers, layer_new, layer); - layer_new->objects = evas_list_append(layer_new->objects, o); - layer_new->layer = o->current.layer; - return o; - } - } - - layer = malloc(sizeof(struct _Evas_Layer)); - memset(layer, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_append(e->layers, layer); - layer->objects = evas_list_append(layer->objects, o); - - return o; -} - -/* set object settings */ -void -evas_set_image_file(Evas e, Evas_Object o, const char *file) -{ - Evas_Object_Image oo; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - IF_OBJ(o, OBJECT_IMAGE) return; - oo = o; - if (((oo->current.file) && (file) && (strcmp(file, oo->current.file))) || - ((!oo->current.file) && (file)) || - (oo->current.image.w == 0) || - (oo->current.image.h == 0) - ) - { - char *tmp_name, *name, *dot; - - _evas_free_image_renderer_data(e, o); - if (oo->current.file) - free(oo->current.file); - oo->previous.file = NULL; - oo->current.file = malloc(strlen(file) + 1); - strcpy(oo->current.file, file); - - name = strrchr(oo->current.file, '/'); - if (!name) name = oo->current.file; - else name++; - - tmp_name = malloc(strlen(name) + 1); - strcpy(tmp_name, name); - dot = strchr(tmp_name, '.'); - if (dot) *dot = '\0'; - evas_object_set_name(e, o, tmp_name); - if (dot) *dot = '.'; - free(tmp_name); - - { - Imlib_Image im; - - im = imlib_load_image_with_error_return(file, &oo->load_error); - if (im) - { - imlib_context_set_image(im); - oo->current.image.w = imlib_image_get_width(); - oo->current.image.h = imlib_image_get_height(); - oo->current.alpha = imlib_image_has_alpha(); - imlib_free_image(); - evas_resize(e, o, - (double)oo->current.image.w, - (double)oo->current.image.h); - oo->current.fill.x = 0; - oo->current.fill.y = 0; - oo->current.fill.w = (double)oo->current.image.w; - oo->current.fill.h = (double)oo->current.image.h; - } - else - { - oo->current.image.w = 0; - oo->current.image.h = 0; - evas_resize(e, o, - (double)oo->current.image.w, - (double)oo->current.image.h); - oo->current.fill.x = 0; - oo->current.fill.y = 0; - oo->current.fill.w = (double)oo->current.image.w; - oo->current.fill.h = (double)oo->current.image.h; - oo->current.alpha = 1; - } - } - o->changed = 1; - e->changed = 1; - } - else if (!file) - { - if (oo->current.file) - free(oo->current.file); - oo->previous.file = NULL; - oo->current.file = NULL; - oo->current.image.w = 0; - oo->current.image.h = 0; - oo->current.alpha = 1; - evas_resize(e, o, - (double)oo->current.image.w, - (double)oo->current.image.h); - oo->current.fill.x = 0; - oo->current.fill.y = 0; - oo->current.fill.w = (double)oo->current.image.w; - oo->current.fill.h = (double)oo->current.image.h; - oo->load_error = IMLIB_LOAD_ERROR_NONE; - o->changed = 1; - e->changed = 1; - } - else - { - } -} - -void -evas_set_image_data(Evas e, Evas_Object o, void *data, Evas_Image_Format format, int w, int h) -{ - Evas_Object_Image oo; - - if (!e) return; - if (!o) return; - IF_OBJ(o, OBJECT_IMAGE) return; - oo = o; - if (data) - { - _evas_free_image_renderer_data(e, o); - if (oo->current.file) _evas_remove_fileless_image(oo->current.file); - if (oo->current.file) free(oo->current.file); - - oo->previous.file = NULL; - oo->current.file = _evas_generate_filename(); - { - Imlib_Image im; - - im = imlib_create_image(w,h); - if (im) - { - DATA32 *p; - unsigned char *p1, *p2; - int i, j, k; - - imlib_context_set_image(im); - - if((format==IMAGE_FORMAT_ARGB)||(format==IMAGE_FORMAT_ARGB)) - imlib_image_set_has_alpha(1); - imlib_image_clear(); - p = imlib_image_get_data(); - p2 = (unsigned char*)p; - p1 = (unsigned char*)data; - - if(format==IMAGE_FORMAT_ARGB)memcpy(p, data, w*h*4); - - for(i=0; icurrent.file); - - - oo->current.image.w = imlib_image_get_width(); - oo->current.image.h = imlib_image_get_height(); - oo->current.alpha = imlib_image_has_alpha(); - imlib_free_image(); - evas_resize(e, o, - (double)oo->current.image.w, - (double)oo->current.image.h); - oo->current.fill.x = 0; - oo->current.fill.y = 0; - oo->current.fill.w = (double)oo->current.image.w; - oo->current.fill.h = (double)oo->current.image.h; - } - else - { - oo->current.image.w = 0; - oo->current.image.h = 0; - evas_resize(e, o, - (double)oo->current.image.w, - (double)oo->current.image.h); - oo->current.fill.x = 0; - oo->current.fill.y = 0; - oo->current.fill.w = (double)oo->current.image.w; - oo->current.fill.h = (double)oo->current.image.h; - oo->current.alpha = 1; - } - } - o->changed = 1; - e->changed = 1; - } - else if (!data) - { - if (oo->current.file) - free(oo->current.file); - oo->previous.file = NULL; - oo->current.file = NULL; - oo->current.image.w = 0; - oo->current.image.h = 0; - oo->current.alpha = 1; - evas_resize(e, o, - (double)oo->current.image.w, - (double)oo->current.image.h); - oo->current.fill.x = 0; - oo->current.fill.y = 0; - oo->current.fill.w = (double)oo->current.image.w; - oo->current.fill.h = (double)oo->current.image.h; - oo->load_error = IMLIB_LOAD_ERROR_NONE; - o->changed = 1; - e->changed = 1; - } - else - { - } -} - -void -evas_set_image_fill(Evas e, Evas_Object o, double x, double y, double w, double h) -{ - Evas_Object_Image oo; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - IF_OBJ(o, OBJECT_IMAGE) return; - oo = o; - oo->current.fill.x = x; - oo->current.fill.y = y; - oo->current.fill.w = w; - oo->current.fill.h = h; - o->changed = 1; - e->changed = 1; -} - -/* image query ops */ -int -evas_get_image_alpha(Evas e, Evas_Object o) -{ - Evas_Object_Image oo; - - if (!e) return 0; - if (!o) return 0; - IF_OBJ(o, OBJECT_IMAGE) return 0; - oo = o; - return oo->current.alpha; -} - -void -evas_get_image_size(Evas e, Evas_Object o, int *w, int *h) -{ - Evas_Object_Image oo; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - IF_OBJ(o, OBJECT_IMAGE) return; - oo = o; - if (w) *w = oo->current.image.w; - if (h) *h = oo->current.image.h; -} - -void -evas_set_image_border(Evas e, Evas_Object o, int l, int r, int t, int b) -{ - Evas_Object_Image oo; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - IF_OBJ(o, OBJECT_IMAGE) return; - oo = o; - if (l < 0) l = 0; - if (r < 0) r = 0; - if (t < 0) t = 0; - if (b < 0) b = 0; - oo->current.border.l = l; - oo->current.border.r = r; - oo->current.border.t = t; - oo->current.border.b = b; - o->changed = 1; - e->changed = 1; -} - -void -evas_get_image_border(Evas e, Evas_Object o, int *l, int *r, int *t, int *b) -{ - Evas_Object_Image oo; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - IF_OBJ(o, OBJECT_IMAGE) return; - oo = o; - if (l) *l = oo->current.border.l; - if (r) *r = oo->current.border.r; - if (t) *t = oo->current.border.t; - if (b) *b = oo->current.border.b; -} - -Imlib_Load_Error -evas_get_image_load_error(Evas e, Evas_Object o) -{ - Evas_Object_Image oo; - - if (!e) return IMLIB_LOAD_ERROR_NONE; - if (!o) return IMLIB_LOAD_ERROR_NONE; - IF_OBJ(o, OBJECT_IMAGE) return IMLIB_LOAD_ERROR_NONE; - oo = o; - - return oo->load_error; -} diff --git a/legacy/evas/src/evas_image_routines.c b/legacy/evas/src/evas_image_routines.c deleted file mode 100644 index 405f4f9e72..0000000000 --- a/legacy/evas/src/evas_image_routines.c +++ /dev/null @@ -1,1088 +0,0 @@ -#include "evas_image_routines.h" -#include "evas_fileless_image.h" - -static void __evas_image_image_cache_flush(Display *disp); -static int __evas_anti_alias = 1; -static Evas_List drawable_list = NULL; - -/* the current clip region and color */ -static int __evas_clip = 0; -static int __evas_clip_x = 0; -static int __evas_clip_y = 0; -static int __evas_clip_w = 0; -static int __evas_clip_h = 0; -static int __evas_clip_r = 0; -static int __evas_clip_g = 0; -static int __evas_clip_b = 0; -static int __evas_clip_a = 0; - -/*****************************************************************************/ -/* image internals ***********************************************************/ -/*****************************************************************************/ - -static void -__evas_image_image_cache_flush(Display *disp) -{ - int size; - - size = imlib_get_cache_size(); - imlib_set_cache_size(0); - imlib_set_cache_size(size); -} - -/*****************************************************************************/ -/* image externals ***********************************************************/ -/*****************************************************************************/ - -Evas_Image_Image * -__evas_image_image_new_from_file(Display *disp, char *file) -{ - Imlib_Image im = NULL; - - im = _evas_find_fileless_image(file); - if (!im) - im = imlib_load_image(file); - if (im) - { - imlib_context_set_image(im); - imlib_image_set_changes_on_disk(); - } - return (Evas_Image_Image *)im; -} - -void -__evas_image_image_free(Evas_Image_Image *im) -{ - imlib_context_set_image((Imlib_Image)im); - imlib_free_image(); -} - -void -__evas_image_image_cache_empty(Display *disp) -{ - int size; - - size = imlib_get_cache_size(); - imlib_set_cache_size(0); - imlib_set_cache_size(size); -} - -void -__evas_image_image_cache_set_size(Display *disp, int size) -{ - imlib_set_cache_size(size); -} - -int -__evas_image_image_cache_get_size(Display *disp) -{ - return imlib_get_cache_size(); -} - -void -__evas_image_image_draw(Evas_Image_Image *im, - Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, - int src_x, int src_y, int src_w, int src_h, - int dst_x, int dst_y, int dst_w, int dst_h, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - Imlib_Color_Modifier cm = NULL; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca == 0) return; - if ((cr != 255) || (cg != 255) || (cb != 255) || (ca != 255)) - { - DATA8 r[256], g[256], b[256], a[256]; - int i; - - cm = imlib_create_color_modifier(); - imlib_context_set_color_modifier(cm); - for (i = 0; i < 256; i++) - { - r[i] = (i * cr) / 255; - g[i] = (i * cg) / 255; - b[i] = (i * cb) / 255; - a[i] = (i * ca) / 255; - } - imlib_set_color_modifier_tables(r, g, b, a); - } - else - imlib_context_set_color_modifier(NULL); - - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(__evas_anti_alias); - imlib_context_set_blend(1); - for(l = drawable_list; l; l = l->next) - { - Evas_Image_Drawable *dr; - - dr = l->data; - - if (dr->im == dstim) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Image_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - dst_x, dst_y, dst_w, dst_h)) - { - if (__evas_clip) - imlib_context_set_cliprect(__evas_clip_x - up->x, - __evas_clip_y - up->y, - __evas_clip_w, - __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - - if (!up->image) - { - DATA32 *data; - - up->image = imlib_create_image(up->w, up->h); - if (up->image) - { - imlib_context_set_image(up->image); - data = imlib_image_get_data(); - memset(data, 0, up->w * up->h * sizeof(DATA32)); - imlib_image_put_back_data(data); - imlib_image_set_has_alpha(1); - } - } - imlib_context_set_image(up->image); - imlib_blend_image_onto_image(im, 1, - src_x, src_y, src_w, src_h, - dst_x - up->x, dst_y - up->y, dst_w, dst_h); - } - } - } - } - if (cm) - { - imlib_free_color_modifier(); - imlib_context_set_color_modifier(NULL); - } -} - -int -__evas_image_image_get_width(Evas_Image_Image *im) -{ - imlib_context_set_image((Imlib_Image)im); - return imlib_image_get_width(); -} - -int -__evas_image_image_get_height(Evas_Image_Image *im) -{ - imlib_context_set_image((Imlib_Image)im); - return imlib_image_get_height(); -} - -void -__evas_image_image_set_borders(Evas_Image_Image *im, int left, int right, - int top, int bottom) -{ - Imlib_Border bd; - - imlib_context_set_image((Imlib_Image)im); - bd.left = left; - bd.right = right; - bd.top = top; - bd.bottom = bottom; - imlib_image_set_border(&bd); -} - -void -__evas_image_image_set_smooth_scaling(int on) -{ - __evas_anti_alias = on; -} - - - - - - - - - - - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* font internals ************************************************************/ -/*****************************************************************************/ - -/*****************************************************************************/ -/* font externals ************************************************************/ -/*****************************************************************************/ - -Evas_Image_Font * -__evas_image_text_font_new(Display *disp, char *font, int size) -{ - char buf[4096]; - - sprintf(buf, "%s/%i", font, size); - return (Evas_Image_Font *)imlib_load_font(buf); -} - -void -__evas_image_text_font_free(Evas_Image_Font *fn) -{ - imlib_context_set_font((Imlib_Font)fn); - imlib_free_font(); -} - -int -__evas_image_text_font_get_ascent(Evas_Image_Font *fn) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_get_font_ascent(); -} - -int -__evas_image_text_font_get_descent(Evas_Image_Font *fn) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_get_font_descent(); -} - -int -__evas_image_text_font_get_max_ascent(Evas_Image_Font *fn) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_get_maximum_font_ascent(); -} - -int -__evas_image_text_font_get_max_descent(Evas_Image_Font *fn) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_get_maximum_font_descent(); -} - -void -__evas_image_text_font_get_advances(Evas_Image_Font *fn, char *text, - int *advance_horiz, - int *advance_vert) -{ - imlib_context_set_font((Imlib_Font)fn); - imlib_get_text_advance(text, advance_horiz, advance_vert); -} - -int -__evas_image_text_font_get_first_inset(Evas_Image_Font *fn, char *text) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_get_text_inset(text); -} - -void -__evas_image_text_font_add_path(char *path) -{ - imlib_add_path_to_font_path(path); -} - -void -__evas_image_text_font_del_path(char *path) -{ - imlib_remove_path_from_font_path(path); -} - -char ** -__evas_image_text_font_list_paths(int *count) -{ - return imlib_list_font_path(count); -} - -void -__evas_image_text_cache_empty(Display *disp) -{ - int size; - - size = imlib_get_font_cache_size(); - imlib_set_font_cache_size(0); - imlib_set_font_cache_size(size); -} - -void -__evas_image_text_cache_set_size(Display *disp, int size) -{ - imlib_set_font_cache_size(size); -} - -int -__evas_image_text_cache_get_size(Display *disp) -{ - return imlib_get_font_cache_size(); -} - -void -__evas_image_text_draw(Evas_Image_Font *fn, Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, int x, int y, char *text, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - int w, h; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if ((!fn) || (!text)) return; - if (ca == 0) return; - imlib_context_set_color(cr, cg, cb, ca); - imlib_context_set_font((Imlib_Font)fn); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_color_modifier(NULL); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(1); - imlib_context_set_blend(1); - imlib_get_text_size(text, &w, &h); - for(l = drawable_list; l; l = l->next) - { - Evas_Image_Drawable *dr; - - dr = l->data; - - if (dr->im == dstim) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Image_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (__evas_clip) - imlib_context_set_cliprect(__evas_clip_x - up->x, - __evas_clip_y - up->y, - __evas_clip_w, - __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - if (!up->image) - { - DATA32 *data; - - up->image = imlib_create_image(up->w, up->h); - if (up->image) - { - imlib_context_set_image(up->image); - data = imlib_image_get_data(); - memset(data, 0, up->w * up->h * sizeof(DATA32)); - imlib_image_put_back_data(data); - imlib_image_set_has_alpha(1); - } - } - imlib_context_set_image(up->image); - imlib_text_draw(x - up->x, y - up->y, text); - } - } - } - } -} - -void -__evas_image_text_get_size(Evas_Image_Font *fn, char *text, int *w, int *h) -{ - if ((!fn) || (!text)) - { - *w = 0; *h = 0; - return; - } - imlib_context_set_font((Imlib_Font)fn); - imlib_get_text_size(text, w, h); -} - -int -__evas_image_text_get_character_at_pos(Evas_Image_Font *fn, char *text, - int x, int y, - int *cx, int *cy, int *cw, int *ch) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_text_get_index_and_location(text, x, y, cx, cy, cw, ch); -} - -void -__evas_image_text_get_character_number(Evas_Image_Font *fn, char *text, - int num, - int *cx, int *cy, int *cw, int *ch) -{ - imlib_context_set_font((Imlib_Font)fn); - imlib_text_get_location_at_index(text, num, cx, cy, cw, ch); -} - - - - - - - - - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* rectangle externals *******************************************************/ -/*****************************************************************************/ - -void __evas_image_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - int x, int y, int w, int h, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca == 0) return; - imlib_context_set_color(cr, cg, cb, ca); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_color_modifier(NULL); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(__evas_anti_alias); - imlib_context_set_blend(1); - for(l = drawable_list; l; l = l->next) - { - Evas_Image_Drawable *dr; - - dr = l->data; - - if (dr->im == dstim) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Image_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - if (!up->image) - { - DATA32 *data; - - up->image = imlib_create_image(up->w, up->h); - if (up->image) - { - imlib_context_set_image(up->image); - data = imlib_image_get_data(); - memset(data, 0, up->w * up->h * sizeof(DATA32)); - imlib_image_put_back_data(data); - imlib_image_set_has_alpha(1); - } - } - imlib_context_set_image(up->image); - imlib_image_fill_rectangle(x - up->x, y - up->y, w, h); - } - } - } - } -} - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* rectangle externals *******************************************************/ -/*****************************************************************************/ - -void __evas_image_line_draw(Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - int x1, int y1, int x2, int y2, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - int x, y, w, h; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca == 0) return; - imlib_context_set_color(cr, cg, cb, ca); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_color_modifier(NULL); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(1); - imlib_context_set_blend(1); - w = x2 - x1; - if (w < 0) w = -w; - h = y2 - y1; - if (h < 0) h = -h; - if (x1 < x2) x = x1; - else x = x2; - if (y1 < y2) y = y1; - else y = y2; - w++; h++; - for(l = drawable_list; l; l = l->next) - { - Evas_Image_Drawable *dr; - - dr = l->data; - - if (dr->im == dstim) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Image_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - if (!up->image) - { - DATA32 *data; - - up->image = imlib_create_image(up->w, up->h); - if (up->image) - { - imlib_context_set_image(up->image); - data = imlib_image_get_data(); - memset(data, 0, up->w * up->h * sizeof(DATA32)); - imlib_image_put_back_data(data); - imlib_image_set_has_alpha(1); - } - } - imlib_context_set_image(up->image); - imlib_image_draw_line(x1 - up->x, y1 - up->y, x2 - up->x, y2 - up->y, 0); - } - } - } - } -} - - - - - - - - - - - - - - - - - -/****************************************************************************/ -/* gradient externals ********************************************************/ -/*****************************************************************************/ - - -Evas_Image_Graident * -__evas_image_gradient_new(Display *disp) -{ - Evas_Image_Graident *gr; - - gr = malloc(sizeof(Evas_Image_Graident)); - gr->colors = NULL; -} - -void -__evas_image_gradient_free(Evas_Image_Graident *gr) -{ - Evas_List l; - - if (gr->colors) - { - for (l = gr->colors; l; l = l->next) - { - free(l->data); - } - evas_list_free(gr->colors); - } - free(gr); -} - -void -__evas_image_gradient_color_add(Evas_Image_Graident *gr, int r, int g, int b, int a, int dist) -{ - Evas_Image_Color *cl; - - cl = malloc(sizeof(Evas_Image_Color)); - cl->r = r; - cl->g = g; - cl->b = b; - cl->a = a; - cl->dist = dist; - gr->colors = evas_list_append(gr->colors, cl); -} - -void -__evas_image_gradient_draw(Evas_Image_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle) -{ - Evas_List l; - Imlib_Color_Range cr; - - if ((__evas_clip) && (__evas_clip_a == 0)) return; - imlib_context_set_angle(angle); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_color_modifier(NULL); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(1); - imlib_context_set_blend(1); - cr = imlib_create_color_range(); - imlib_context_set_color_range(cr); - { - Evas_List l; - - for (l = gr->colors; l; l = l->next) - { - Evas_Image_Color *cl; - - cl = l->data; - if (__evas_clip) - imlib_context_set_color((cl->r * __evas_clip_r) / 255, - (cl->g * __evas_clip_g) / 255, - (cl->b * __evas_clip_b) / 255, - (cl->a * __evas_clip_a) / 255); - else - imlib_context_set_color(cl->r, cl->g, cl->b, cl->a); - imlib_add_color_to_color_range(cl->dist); - } - } - for(l = drawable_list; l; l = l->next) - { - Evas_Image_Drawable *dr; - - dr = l->data; - - if (dr->im == dstim) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Image_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - if (!up->image) - { - DATA32 *data; - - up->image = imlib_create_image(up->w, up->h); - if (up->image) - { - imlib_context_set_image(up->image); - data = imlib_image_get_data(); - memset(data, 0, up->w * up->h * sizeof(DATA32)); - imlib_image_put_back_data(data); - imlib_image_set_has_alpha(1); - } - } - imlib_context_set_image(up->image); - imlib_image_fill_color_range_rectangle(x - up->x, y - up->y, w, h, angle); - } - } - } - } - imlib_free_color_range(); -} - - - - -/************/ -/* polygons */ -/************/ -void -__evas_image_poly_draw (Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - Evas_List points, - int cr, int cg, int cb, int ca) -{ - Evas_List l, l2; - int x, y, w, h; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca == 0) return; - imlib_context_set_color(cr, cg, cb, ca); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_color_modifier(NULL); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(1); - imlib_context_set_blend(1); - - x = y = w = h = 0; - if (points) - { - Evas_Point p; - - p = points->data; - x = p->x; - y = p->y; - w = 1; - h = 1; - } - for (l2 = points; l2; l2 = l2->next) - { - Evas_Point p; - - p = l2->data; - if (p->x < x) - { - w += x - p->x; - x = p->x; - } - if (p->x > (x + w)) - w = p->x - x; - if (p->y < y) - { - h += y - p->y; - y = p->y; - } - if (p->y > (y + h)) - h = p->y - y; - } - for(l = drawable_list; l; l = l->next) - { - Evas_Image_Drawable *dr; - - dr = l->data; - - if (dr->im == dstim) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Image_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - ImlibPolygon pol; - - if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - - if (!up->image) - { - DATA32 *data; - - up->image = imlib_create_image(up->w, up->h); - if (up->image) - { - imlib_context_set_image(up->image); - data = imlib_image_get_data(); - memset(data, 0, up->w * up->h * sizeof(DATA32)); - imlib_image_put_back_data(data); - imlib_image_set_has_alpha(1); - } - } - imlib_context_set_image(up->image); - pol = imlib_polygon_new(); - for (l2 = points; l2; l2 = l2->next) - { - Evas_Point p; - - p = l2->data; - imlib_polygon_add_point(pol, p->x - up->x, p->y - up->y); - } - imlib_image_fill_polygon(pol); - imlib_polygon_free(pol); - } - } - } - } -} - - - - - - - - - - - - - -/*****************************************************************************/ -/* general externals *********************************************************/ -/*****************************************************************************/ - -static Visual *__evas_visual = NULL; -static Colormap __evas_cmap = 0; - -void -__evas_image_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a) -{ - __evas_clip = on; - __evas_clip_x = x; - __evas_clip_y = y; - __evas_clip_w = w; - __evas_clip_h = h; - __evas_clip_r = r; - __evas_clip_g = g; - __evas_clip_b = b; - __evas_clip_a = a; -} - -void -__evas_image_sync(Display *disp) -{ -} - -void -__evas_image_flush_draw(Display *disp, Imlib_Image dstim, Window win) -{ - Evas_List l; - - imlib_context_set_blend(1); - imlib_context_set_color_modifier(NULL); - imlib_context_set_cliprect(0, 0, 0, 0); - imlib_context_set_angle(0); - - for(l = drawable_list; l; l = l->next) - { - Evas_Image_Drawable *dr; - - dr = l->data; - - if (dr->im == dstim) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Image_Update *up; - - up = ll->data; - - if (up->image) - { - int w, h; - - w = up->w; h = up->h; - imlib_context_set_image(dr->im); - imlib_blend_image_onto_image(up->image, 1, - 0, 0, w, h, - up->x, up->y, w, h); - imlib_context_set_image(up->image); - imlib_free_image(); - } - free(up); - } - if (dr->tmp_images) - dr->tmp_images = evas_list_free(dr->tmp_images); - } - free(dr); - } - if (drawable_list) - drawable_list = evas_list_free(drawable_list); - drawable_list = NULL; -} - -void -__evas_image_set_vis_cmap(Visual *vis, Colormap cmap) -{ -} - -int -__evas_image_capable(Display *disp) -{ - return 1; -} - -Visual * -__evas_image_get_visual(Display *disp, int screen) -{ - int depth; - - __evas_visual = imlib_get_best_visual(disp, screen, &depth); - return __evas_visual; -} - -XVisualInfo * -__evas_image_get_visual_info(Display *disp, int screen) -{ - static XVisualInfo *vi = NULL; - XVisualInfo vi_template; - int n; - - if (vi) return vi; - vi_template.visualid = (__evas_image_get_visual(disp, screen))->visualid; - vi_template.screen = screen; - vi = XGetVisualInfo(disp, VisualIDMask | VisualScreenMask, &vi_template ,&n); - return vi; -} - -Colormap -__evas_image_get_colormap(Display *disp, int screen) -{ - Visual *v; - - if (__evas_cmap) return __evas_cmap; - v = __evas_image_get_visual(disp, screen); - __evas_cmap = DefaultColormap(disp, screen); - return __evas_cmap; - __evas_cmap = XCreateColormap(disp, RootWindow(disp, screen), v, AllocNone); - return __evas_cmap; -} - -void -__evas_image_init(Display *disp, int screen, int colors) -{ - static int initted = 0; - - if (!initted) - { - imlib_set_font_cache_size(1024 * 1024); - imlib_set_cache_size(8 * 1024 * 1024); - initted = 1; - } -} - -void -__evas_image_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, - int x, int y, int w, int h) -{ - Evas_List l; - - for(l = drawable_list; l; l = l->next) - { - Evas_Image_Drawable *dr; - - dr = l->data; - - if (dr->im == dstim) - { - Evas_Image_Update *up; - - up = malloc(sizeof(Evas_Image_Update)); - up->x = x; - up->y = y; - up->w = w; - up->h = h; - up->image = NULL; - dr->tmp_images = evas_list_append(dr->tmp_images, up); - } - return; - } - { - Evas_Image_Drawable *dr; - Evas_Image_Update *up; - - dr = malloc(sizeof(Evas_Image_Drawable)); - dr->im = dstim; - dr->tmp_images = NULL; - up = malloc(sizeof(Evas_Image_Update)); - up->x = x; - up->y = y; - up->w = w; - up->h = h; - up->image = NULL; - drawable_list = evas_list_append(drawable_list, dr); - dr->tmp_images = evas_list_append(dr->tmp_images, up); - } -} diff --git a/legacy/evas/src/evas_image_routines.h b/legacy/evas/src/evas_image_routines.h deleted file mode 100644 index c6624eee78..0000000000 --- a/legacy/evas/src/evas_image_routines.h +++ /dev/null @@ -1,132 +0,0 @@ -#include "config.h" -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "Evas_private.h" -#include "Evas.h" - -#include - -#ifndef SPANS_COMMON -# define SPANS_COMMON(x1, w1, x2, w2) \ -(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1))))) -#define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \ -((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh)))) -#endif - -typedef void Evas_Image_Image; -typedef void Evas_Image_Font; - -typedef struct _evas_image_drawable Evas_Image_Drawable; -typedef struct _evas_image_update Evas_Image_Update; -typedef struct _evas_image_color Evas_Image_Color; -typedef struct _evas_image_gradient Evas_Image_Graident; - -struct _evas_image_drawable -{ - Imlib_Image im; - Evas_List tmp_images; -}; - -struct _evas_image_update -{ - Imlib_Image image; - int x, y, w, h; -}; - -struct _evas_image_color -{ - int r, g, b, a; - int dist; -}; - -struct _evas_image_gradient -{ - Evas_List colors; -}; - -/***************/ -/* image stuff */ -/***************/ -Evas_Image_Image *__evas_image_image_new_from_file(Display *disp, char *file); -void __evas_image_image_free(Evas_Image_Image *im); -void __evas_image_image_cache_empty(Display *disp); -void __evas_image_image_cache_set_size(Display *disp, int size); -int __evas_image_image_cache_get_size(Display *disp); -int __evas_image_image_get_width(Evas_Image_Image *im); -int __evas_image_image_get_height(Evas_Image_Image *im); -void __evas_image_image_set_borders(Evas_Image_Image *im, int left, int right, int top, int bottom); -void __evas_image_image_set_smooth_scaling(int on); -void __evas_image_image_draw(Evas_Image_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int cr, int cg, int cb, int ca); - -/********/ -/* text */ -/********/ -Evas_Image_Font *__evas_image_text_font_new(Display *disp, char *font, int size); -void __evas_image_text_font_free(Evas_Image_Font *fn); -int __evas_image_text_font_get_ascent(Evas_Image_Font *fn); -int __evas_image_text_font_get_descent(Evas_Image_Font *fn); -int __evas_image_text_font_get_max_ascent(Evas_Image_Font *fn); -int __evas_image_text_font_get_max_descent(Evas_Image_Font *fn); -void __evas_image_text_font_get_advances(Evas_Image_Font *fn, char *text, int *advance_horiz, int *advance_vert); -int __evas_image_text_font_get_first_inset(Evas_Image_Font *fn, char *text); -void __evas_image_text_font_add_path(char *path); -void __evas_image_text_font_del_path(char *path); -char **__evas_image_text_font_list_paths(int *count); -void __evas_image_text_cache_empty(Display *disp); -void __evas_image_text_cache_set_size(Display *disp, int size); -int __evas_image_text_cache_get_size(Display *disp); -void __evas_image_text_get_size(Evas_Image_Font *fn, char *text, int *w, int *h); -int __evas_image_text_get_character_at_pos(Evas_Image_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch); -void __evas_image_text_get_character_number(Evas_Image_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch); -void __evas_image_text_draw(Evas_Image_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a); - -/**************/ -/* rectangles */ -/**************/ - -void __evas_image_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a); - -/*********/ -/* lines */ -/*********/ - -void __evas_image_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a); - -/*************/ -/* gradients */ -/*************/ -Evas_Image_Graident *__evas_image_gradient_new(Display *disp); -void __evas_image_gradient_free(Evas_Image_Graident *gr); -void __evas_image_gradient_color_add(Evas_Image_Graident *gr, int r, int g, int b, int a, int dist); -void __evas_image_gradient_draw(Evas_Image_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle); - -/************/ -/* polygons */ -/************/ -void __evas_image_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a); - -/***********/ -/* drawing */ -/***********/ -void __evas_image_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a); -void __evas_image_init(Display *disp, int screen, int colors); -void __evas_image_set_vis_cmap(Visual *vis, Colormap cmap); -int __evas_image_capable(Display *disp); -void __evas_image_flush_draw(Display *disp, Imlib_Image dstim, Window win); -void __evas_image_sync(Display *disp); -Visual *__evas_image_get_visual(Display *disp, int screen); -XVisualInfo *__evas_image_get_visual_info(Display *disp, int screen); -Colormap __evas_image_get_colormap(Display *disp, int screen); -void __evas_image_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h); - diff --git a/legacy/evas/src/evas_imlib_routines.c b/legacy/evas/src/evas_imlib_routines.c deleted file mode 100644 index 22396a80e3..0000000000 --- a/legacy/evas/src/evas_imlib_routines.c +++ /dev/null @@ -1,1194 +0,0 @@ -#include "evas_imlib_routines.h" -#include "evas_fileless_image.h" - -static void __evas_imlib_image_cache_flush(Display *disp); -static Evas_Imlib_Image *__evas_imlib_image_cache_find(char *file); -static int __evas_anti_alias = 1; -static Evas_List drawable_list = NULL; - -static Evas_List images = NULL; - -/* the current clip region and color */ -static int __evas_clip = 0; -static int __evas_clip_x = 0; -static int __evas_clip_y = 0; -static int __evas_clip_w = 0; -static int __evas_clip_h = 0; -static int __evas_clip_r = 0; -static int __evas_clip_g = 0; -static int __evas_clip_b = 0; -static int __evas_clip_a = 0; - -/*****************************************************************************/ -/* image internals ***********************************************************/ -/*****************************************************************************/ - -static void -__evas_imlib_image_cache_flush(Display *disp) -{ - int size; - - size = imlib_get_cache_size(); - imlib_set_cache_size(0); - imlib_set_cache_size(size); -} - -/*****************************************************************************/ -/* image externals ***********************************************************/ -/*****************************************************************************/ - -Evas_Imlib_Image * -__evas_imlib_image_new_from_file(Display *disp, char *file) -{ - Evas_Imlib_Image *im; - Imlib_Image image; - - image = _evas_find_fileless_image(file); - if (!image) - image = imlib_load_image(file); - if (!image) return NULL; - imlib_context_set_image(image); - imlib_image_set_changes_on_disk(); - im = malloc(sizeof(Evas_Imlib_Image)); - im->file = malloc(strlen(file) + 1); - strcpy(im->file, file); - im->image = image; - im->scaled.aa = 0; - im->scaled.w = 0; - im->scaled.h = 0; - im->scaled.image = NULL; - im->scaled.usage = 0; - im->references = 1; -/* images = evas_list_prepend(images, im); */ - return im; -} - -void -__evas_imlib_image_free(Evas_Imlib_Image *im) -{ - im->references--; - if (im->references == 0) - { -/* images = evas_list_remove(images, im);*/ - imlib_context_set_image(im->image); - imlib_free_image(); - if (im->scaled.image) - { - imlib_context_set_image(im->scaled.image); - imlib_free_image_and_decache(); - } - free(im->file); - free(im); - } -} - -void -__evas_imlib_image_cache_empty(Display *disp) -{ - int size; - - size = imlib_get_cache_size(); - imlib_set_cache_size(0); - imlib_set_cache_size(size); -} - -void -__evas_imlib_image_cache_set_size(Display *disp, int size) -{ - imlib_set_cache_size(size); -} - -int -__evas_imlib_image_cache_get_size(Display *disp) -{ - return imlib_get_cache_size(); -} - -void -__evas_imlib_image_draw(Evas_Imlib_Image *im, - Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, - int src_x, int src_y, int src_w, int src_h, - int dst_x, int dst_y, int dst_w, int dst_h, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - Imlib_Color_Modifier cm = NULL; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca == 0) return; - if ((cr != 255) || (cg != 255) || (cb != 255) || (ca != 255)) - { - DATA8 r[256], g[256], b[256], a[256]; - int i; - - cm = imlib_create_color_modifier(); - imlib_context_set_color_modifier(cm); - for (i = 0; i < 256; i++) - { - r[i] = (i * cr) / 255; - g[i] = (i * cg) / 255; - b[i] = (i * cb) / 255; - a[i] = (i * ca) / 255; - } - imlib_set_color_modifier_tables(r, g, b, a); - } - else - imlib_context_set_color_modifier(NULL); - - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(__evas_anti_alias); - imlib_context_set_blend(1); - for(l = drawable_list; l; l = l->next) - { - Evas_Imlib_Drawable *dr; - - dr = l->data; - - if ((dr->win == w) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Imlib_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - dst_x, dst_y, dst_w, dst_h)) - { - if (__evas_clip) - imlib_context_set_cliprect(__evas_clip_x - up->x, - __evas_clip_y - up->y, - __evas_clip_w, - __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - - if (!up->image) - up->image = imlib_create_image(up->w, up->h); - /* if our src and dest are 1:1 scaling.. use original */ - if ((dst_w == src_w) && (dst_h == src_h)) - { - imlib_context_set_image(up->image); - imlib_blend_image_onto_image(im->image, 0, - src_x, src_y, src_w, src_h, - dst_x - up->x, dst_y - up->y, dst_w, dst_h); - if (im->scaled.image) - { - im->scaled.usage = 0; - imlib_context_set_image(im->scaled.image); - imlib_free_image(); - im->scaled.image = NULL; - } - } - /* if we have a scaled image stored... */ - else if ((im->scaled.image) && (im->scaled.aa == __evas_anti_alias)) - { - Imlib_Border bd; - - /* if the image has any border scaling... dont do it */ - imlib_context_set_image(im->image); - imlib_image_get_border(&bd); - if ((bd.left != 0) || - (bd.right != 0) || - (bd.top != 0) || - (bd.bottom != 0)) - { - imlib_context_set_image(up->image); - imlib_blend_image_onto_image(im->image, 0, - src_x, src_y, src_w, src_h, - dst_x - up->x, dst_y - up->y, dst_w, dst_h); - } - else - { - int scw, sch, iw, ih; - - imlib_context_set_image(im->image); - iw = imlib_image_get_width(); - ih = imlib_image_get_height(); - imlib_context_set_image(im->scaled.image); - scw = imlib_image_get_width(); - sch = imlib_image_get_height(); - /* if the scaled image is the same scaled output as needed here use it */ - /* if we are using the WHOLE src image */ - if ((src_x == 0) && (src_y == 0) && - (src_w == iw) && (src_h == ih) && - /* if our destination lies withint the output viewport and clip */ - ((dst_x >= 0) && (dst_y >= 0) && - (dst_w + dst_x <= win_w) && (dst_h + dst_y <= win_h) && - ((!__evas_clip) || - ((dst_x >= __evas_clip_x) && (dst_y >= __evas_clip_y) && - (dst_w + dst_x <= __evas_clip_w) && (dst_h + dst_y <= __evas_clip_h))))) - { - if ((scw == dst_w) && (sch == dst_h)) - { - imlib_context_set_image(up->image); - imlib_blend_image_onto_image(im->scaled.image, 0, - 0, 0, dst_w, dst_h, - dst_x - up->x, dst_y - up->y, dst_w, dst_h); - } - else - { - imlib_context_set_image(im->scaled.image); - imlib_free_image(); - im->scaled.image = NULL; - imlib_context_set_image(im->image); - im->scaled.image = imlib_create_cropped_scaled_image(0, 0, iw, ih, - dst_w, dst_h); - im->scaled.aa = __evas_anti_alias; - imlib_context_set_image(up->image); - imlib_blend_image_onto_image(im->scaled.image, 0, - 0, 0, dst_w, dst_h, - dst_x - up->x, dst_y - up->y, dst_w, dst_h); - } - } - /* just draw normally */ - else - { - imlib_context_set_image(up->image); - imlib_blend_image_onto_image(im->image, 0, - src_x, src_y, src_w, src_h, - dst_x - up->x, dst_y - up->y, dst_w, dst_h); - } - } - } - /* if we dont and the image isnt clipped and its not original size */ - else - { - int iw, ih; - - if (im->scaled.image) - { - int scw, sch; - - imlib_context_set_image(im->scaled.image); - scw = imlib_image_get_width(); - sch = imlib_image_get_height(); - imlib_context_set_image(im->scaled.image); - imlib_free_image(); - im->scaled.image = NULL; - } - imlib_context_set_image(im->image); - iw = imlib_image_get_width(); - ih = imlib_image_get_height(); - - if ((dst_w == im->scaled.w) && - (dst_h == im->scaled.h) && - (__evas_anti_alias == im->scaled.aa)) - { - Imlib_Border bd; - - imlib_context_set_image(im->image); - imlib_image_get_border(&bd); - if ((bd.left != 0) || - (bd.right != 0) || - (bd.top != 0) || - (bd.bottom != 0)) - im->scaled.usage = 0; - else - im->scaled.usage++; - } - else - { - im->scaled.usage = 0; - im->scaled.w = dst_w; - im->scaled.h = dst_h; - im->scaled.aa = __evas_anti_alias; - } - /* if we are using the WHOLE src image */ - if ((src_x == 0) && (src_y == 0) && - (src_w == iw) && (src_h == ih) && - /* if our destination lies withint the output viewport and clip */ - ((dst_x >= 0) && (dst_y >= 0) && - (dst_w + dst_x <= win_w) && (dst_h + dst_y <= win_h) && - ((!__evas_clip) || - ((dst_x >= __evas_clip_x) && (dst_y >= __evas_clip_y) && - (dst_w + dst_x <= __evas_clip_w) && (dst_h + dst_y <= __evas_clip_h)))) && - (im->scaled.usage > 15)) - { - imlib_context_set_image(im->image); - im->scaled.image = imlib_create_cropped_scaled_image(0, 0, iw, ih, - dst_w, dst_h); - im->scaled.aa = __evas_anti_alias; - imlib_context_set_image(up->image); - imlib_blend_image_onto_image(im->scaled.image, 0, - 0, 0, dst_w, dst_h, - dst_x - up->x, dst_y - up->y, dst_w, dst_h); - } - else - { - imlib_context_set_image(up->image); - imlib_blend_image_onto_image(im->image, 0, - src_x, src_y, src_w, src_h, - dst_x - up->x, dst_y - up->y, dst_w, dst_h); - } - } - } - } - } - } - if (cm) - { - imlib_free_color_modifier(); - imlib_context_set_color_modifier(NULL); - } -} - -int -__evas_imlib_image_get_width(Evas_Imlib_Image *im) -{ - imlib_context_set_image(im->image); - return imlib_image_get_width(); -} - -int -__evas_imlib_image_get_height(Evas_Imlib_Image *im) -{ - imlib_context_set_image(im->image); - return imlib_image_get_height(); -} - -void -__evas_imlib_image_set_borders(Evas_Imlib_Image *im, int left, int right, - int top, int bottom) -{ - Imlib_Border bd; - - imlib_context_set_image(im->image); - bd.left = left; - bd.right = right; - bd.top = top; - bd.bottom = bottom; - imlib_image_set_border(&bd); -} - -void -__evas_imlib_image_set_smooth_scaling(int on) -{ - __evas_anti_alias = on; -} - - - - - - - - - - - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* font internals ************************************************************/ -/*****************************************************************************/ - -/*****************************************************************************/ -/* font externals ************************************************************/ -/*****************************************************************************/ - -Evas_Imlib_Font * -__evas_imlib_text_font_new(Display *disp, char *font, int size) -{ - char buf[4096]; - - sprintf(buf, "%s/%i", font, size); - return (Evas_Imlib_Font *)imlib_load_font(buf); -} - -void -__evas_imlib_text_font_free(Evas_Imlib_Font *fn) -{ - imlib_context_set_font((Imlib_Font)fn); - imlib_free_font(); -} - -int -__evas_imlib_text_font_get_ascent(Evas_Imlib_Font *fn) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_get_font_ascent(); -} - -int -__evas_imlib_text_font_get_descent(Evas_Imlib_Font *fn) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_get_font_descent(); -} - -int -__evas_imlib_text_font_get_max_ascent(Evas_Imlib_Font *fn) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_get_maximum_font_ascent(); -} - -int -__evas_imlib_text_font_get_max_descent(Evas_Imlib_Font *fn) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_get_maximum_font_descent(); -} - -void -__evas_imlib_text_font_get_advances(Evas_Imlib_Font *fn, char *text, - int *advance_horiz, - int *advance_vert) -{ - imlib_context_set_font((Imlib_Font)fn); - imlib_get_text_advance(text, advance_horiz, advance_vert); -} - -int -__evas_imlib_text_font_get_first_inset(Evas_Imlib_Font *fn, char *text) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_get_text_inset(text); -} - -void -__evas_imlib_text_font_add_path(char *path) -{ - imlib_add_path_to_font_path(path); -} - -void -__evas_imlib_text_font_del_path(char *path) -{ - imlib_remove_path_from_font_path(path); -} - -char ** -__evas_imlib_text_font_list_paths(int *count) -{ - return imlib_list_font_path(count); -} - -void -__evas_imlib_text_cache_empty(Display *disp) -{ - int size; - - size = imlib_get_font_cache_size(); - imlib_set_font_cache_size(0); - imlib_set_font_cache_size(size); -} - -void -__evas_imlib_text_cache_set_size(Display *disp, int size) -{ - imlib_set_font_cache_size(size); -} - -int -__evas_imlib_text_cache_get_size(Display *disp) -{ - return imlib_get_font_cache_size(); -} - -void -__evas_imlib_text_draw(Evas_Imlib_Font *fn, Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, int x, int y, char *text, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - int w, h; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if ((!fn) || (!text)) return; - if (ca == 0) return; - imlib_context_set_color(cr, cg, cb, ca); - imlib_context_set_font((Imlib_Font)fn); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_color_modifier(NULL); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(1); - imlib_context_set_blend(1); - imlib_get_text_size(text, &w, &h); - for(l = drawable_list; l; l = l->next) - { - Evas_Imlib_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Imlib_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (__evas_clip) - imlib_context_set_cliprect(__evas_clip_x - up->x, - __evas_clip_y - up->y, - __evas_clip_w, - __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - if (!up->image) - up->image = imlib_create_image(up->w, up->h); - imlib_context_set_image(up->image); - imlib_text_draw(x - up->x, y - up->y, text); - } - } - } - } -} - -void -__evas_imlib_text_get_size(Evas_Imlib_Font *fn, char *text, int *w, int *h) -{ - if ((!fn) || (!text)) - { - *w = 0; *h = 0; - return; - } - imlib_context_set_font((Imlib_Font)fn); - imlib_get_text_size(text, w, h); -} - -int -__evas_imlib_text_get_character_at_pos(Evas_Imlib_Font *fn, char *text, - int x, int y, - int *cx, int *cy, int *cw, int *ch) -{ - imlib_context_set_font((Imlib_Font)fn); - return imlib_text_get_index_and_location(text, x, y, cx, cy, cw, ch); -} - -void -__evas_imlib_text_get_character_number(Evas_Imlib_Font *fn, char *text, - int num, - int *cx, int *cy, int *cw, int *ch) -{ - imlib_context_set_font((Imlib_Font)fn); - imlib_text_get_location_at_index(text, num, cx, cy, cw, ch); -} - - - - - - - - - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* rectangle externals *******************************************************/ -/*****************************************************************************/ - -void __evas_imlib_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - int x, int y, int w, int h, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca == 0) return; - imlib_context_set_color(cr, cg, cb, ca); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_color_modifier(NULL); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(__evas_anti_alias); - imlib_context_set_blend(1); - for(l = drawable_list; l; l = l->next) - { - Evas_Imlib_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Imlib_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - if (!up->image) - up->image = imlib_create_image(up->w, up->h); - imlib_context_set_image(up->image); - imlib_image_fill_rectangle(x - up->x, y - up->y, w, h); - } - } - } - } -} - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* rectangle externals *******************************************************/ -/*****************************************************************************/ - -void __evas_imlib_line_draw(Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - int x1, int y1, int x2, int y2, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - int x, y, w, h; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca == 0) return; - imlib_context_set_color(cr, cg, cb, ca); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_color_modifier(NULL); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(1); - imlib_context_set_blend(1); - w = x2 - x1; - if (w < 0) w = -w; - h = y2 - y1; - if (h < 0) h = -h; - if (x1 < x2) x = x1; - else x = x2; - if (y1 < y2) y = y1; - else y = y2; - w++; h++; - for(l = drawable_list; l; l = l->next) - { - Evas_Imlib_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Imlib_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - if (!up->image) - up->image = imlib_create_image(up->w, up->h); - imlib_context_set_image(up->image); - imlib_image_draw_line(x1 - up->x, y1 - up->y, x2 - up->x, y2 - up->y, 0); - } - } - } - } -} - - - - - - - - - - - - - - - - - -/****************************************************************************/ -/* gradient externals ********************************************************/ -/*****************************************************************************/ - - -Evas_Imlib_Graident * -__evas_imlib_gradient_new(Display *disp) -{ - Evas_Imlib_Graident *gr; - - gr = malloc(sizeof(Evas_Imlib_Graident)); - gr->colors = NULL; -} - -void -__evas_imlib_gradient_free(Evas_Imlib_Graident *gr) -{ - Evas_List l; - - if (gr->colors) - { - for (l = gr->colors; l; l = l->next) - { - free(l->data); - } - evas_list_free(gr->colors); - } - free(gr); -} - -void -__evas_imlib_gradient_color_add(Evas_Imlib_Graident *gr, int r, int g, int b, int a, int dist) -{ - Evas_Imlib_Color *cl; - - cl = malloc(sizeof(Evas_Imlib_Color)); - cl->r = r; - cl->g = g; - cl->b = b; - cl->a = a; - cl->dist = dist; - gr->colors = evas_list_append(gr->colors, cl); -} - -void -__evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle) -{ - Evas_List l; - Imlib_Color_Range cr; - - if ((__evas_clip) && (__evas_clip_a == 0)) return; - imlib_context_set_angle(angle); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_color_modifier(NULL); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(1); - imlib_context_set_blend(1); - cr = imlib_create_color_range(); - imlib_context_set_color_range(cr); - { - Evas_List l; - - for (l = gr->colors; l; l = l->next) - { - Evas_Imlib_Color *cl; - - cl = l->data; - if (__evas_clip) - imlib_context_set_color((cl->r * __evas_clip_r) / 255, - (cl->g * __evas_clip_g) / 255, - (cl->b * __evas_clip_b) / 255, - (cl->a * __evas_clip_a) / 255); - else - imlib_context_set_color(cl->r, cl->g, cl->b, cl->a); - imlib_add_color_to_color_range(cl->dist); - } - } - for(l = drawable_list; l; l = l->next) - { - Evas_Imlib_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Imlib_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - if (!up->image) - up->image = imlib_create_image(up->w, up->h); - imlib_context_set_image(up->image); - imlib_image_fill_color_range_rectangle(x - up->x, y - up->y, w, h, angle); - } - } - } - } - imlib_free_color_range(); -} - - - - -/************/ -/* polygons */ -/************/ -void -__evas_imlib_poly_draw (Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - Evas_List points, - int cr, int cg, int cb, int ca) -{ - Evas_List l, l2; - int x, y, w, h; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca == 0) return; - imlib_context_set_color(cr, cg, cb, ca); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_color_modifier(NULL); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_anti_alias(1); - imlib_context_set_blend(1); - - x = y = w = h = 0; - if (points) - { - Evas_Point p; - - p = points->data; - x = p->x; - y = p->y; - w = 1; - h = 1; - } - for (l2 = points; l2; l2 = l2->next) - { - Evas_Point p; - - p = l2->data; - if (p->x < x) - { - w += x - p->x; - x = p->x; - } - if (p->x > (x + w)) - w = p->x - x; - if (p->y < y) - { - h += y - p->y; - y = p->y; - } - if (p->y > (y + h)) - h = p->y - y; - } - for(l = drawable_list; l; l = l->next) - { - Evas_Imlib_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Imlib_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - ImlibPolygon pol; - - if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h); - else imlib_context_set_cliprect(0, 0, 0, 0); - - if (!up->image) - up->image = imlib_create_image(up->w, up->h); - imlib_context_set_image(up->image); - pol = imlib_polygon_new(); - for (l2 = points; l2; l2 = l2->next) - { - Evas_Point p; - - p = l2->data; - imlib_polygon_add_point(pol, p->x - up->x, p->y - up->y); - } - imlib_image_fill_polygon(pol); - imlib_polygon_free(pol); - } - } - } - } -} - - - - - - - - - - - - - -/*****************************************************************************/ -/* general externals *********************************************************/ -/*****************************************************************************/ - -static Visual *__evas_visual = NULL; -static Colormap __evas_cmap = 0; - -void -__evas_imlib_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a) -{ - __evas_clip = on; - __evas_clip_x = x; - __evas_clip_y = y; - __evas_clip_w = w; - __evas_clip_h = h; - __evas_clip_r = r; - __evas_clip_g = g; - __evas_clip_b = b; - __evas_clip_a = a; -} - -void -__evas_imlib_sync(Display *disp) -{ - XSync(disp, False); -} - -void -__evas_imlib_flush_draw(Display *disp, Imlib_Image dstim, Window win) -{ - Evas_List l; - - imlib_context_set_display(disp); - imlib_context_set_visual(__evas_visual); - imlib_context_set_colormap(__evas_cmap); - imlib_context_set_drawable(win); - imlib_context_set_dither(1); - imlib_context_set_blend(0); - - for(l = drawable_list; l; l = l->next) - { - Evas_Imlib_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Imlib_Update *up; - - up = ll->data; - - if (up->image) - { - imlib_context_set_image(up->image); - imlib_render_image_on_drawable(up->x, up->y); - imlib_free_image(); - } - free(up); - } - if (dr->tmp_images) - dr->tmp_images = evas_list_free(dr->tmp_images); - } - free(dr); - } - if (drawable_list) - drawable_list = evas_list_free(drawable_list); - drawable_list = NULL; -} - -void -__evas_imlib_set_vis_cmap(Visual *vis, Colormap cmap) -{ - __evas_visual = vis; - __evas_cmap = cmap; -} - -int -__evas_imlib_capable(Display *disp) -{ - return 1; -} - -Visual * -__evas_imlib_get_visual(Display *disp, int screen) -{ - int depth; - - __evas_visual = imlib_get_best_visual(disp, screen, &depth); - return __evas_visual; -} - -XVisualInfo * -__evas_imlib_get_visual_info(Display *disp, int screen) -{ - static XVisualInfo *vi = NULL; - XVisualInfo vi_template; - int n; - - if (vi) return vi; - vi_template.visualid = (__evas_imlib_get_visual(disp, screen))->visualid; - vi_template.screen = screen; - vi = XGetVisualInfo(disp, VisualIDMask | VisualScreenMask, &vi_template ,&n); - return vi; -} - -Colormap -__evas_imlib_get_colormap(Display *disp, int screen) -{ - Visual *v; - - if (__evas_cmap) return __evas_cmap; - v = __evas_imlib_get_visual(disp, screen); - __evas_cmap = DefaultColormap(disp, screen); - return __evas_cmap; - __evas_cmap = XCreateColormap(disp, RootWindow(disp, screen), v, AllocNone); - return __evas_cmap; -} - -void -__evas_imlib_init(Display *disp, int screen, int colors) -{ - static int initted = 0; - - if (!initted) - { - imlib_set_color_usage(colors); - initted = 1; - } - imlib_set_color_usage(colors); -} - -void -__evas_imlib_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, - int x, int y, int w, int h) -{ - Evas_List l; - - for(l = drawable_list; l; l = l->next) - { - Evas_Imlib_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_Imlib_Update *up; - - up = malloc(sizeof(Evas_Imlib_Update)); - up->x = x; - up->y = y; - up->w = w; - up->h = h; - up->image = NULL; - dr->tmp_images = evas_list_append(dr->tmp_images, up); - } - return; - } - { - Evas_Imlib_Drawable *dr; - Evas_Imlib_Update *up; - - dr = malloc(sizeof(Evas_Imlib_Drawable)); - dr->win = win; - dr->disp = disp; - dr->tmp_images = NULL; - up = malloc(sizeof(Evas_Imlib_Update)); - up->x = x; - up->y = y; - up->w = w; - up->h = h; - up->image = NULL; - drawable_list = evas_list_append(drawable_list, dr); - dr->tmp_images = evas_list_append(dr->tmp_images, up); - } -} diff --git a/legacy/evas/src/evas_imlib_routines.h b/legacy/evas/src/evas_imlib_routines.h deleted file mode 100644 index 807501258b..0000000000 --- a/legacy/evas/src/evas_imlib_routines.h +++ /dev/null @@ -1,146 +0,0 @@ -#include "config.h" -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "Evas_private.h" -#include "Evas.h" - -#include - -#ifndef SPANS_COMMON -# define SPANS_COMMON(x1, w1, x2, w2) \ -(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1))))) -#define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \ -((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh)))) -#endif - -typedef void Evas_Imlib_Font; - -typedef struct _evas_imlib_image Evas_Imlib_Image; -typedef struct _evas_imlib_drawable Evas_Imlib_Drawable; -typedef struct _evas_imlib_update Evas_Imlib_Update; -typedef struct _evas_imlib_color Evas_Imlib_Color; -typedef struct _evas_imlib_gradient Evas_Imlib_Graident; - -struct _evas_imlib_image -{ - char *file; - Imlib_Image image; - struct { - int aa; - int w, h; - Imlib_Image image; - int usage; - } scaled; - int references; -}; - -struct _evas_imlib_drawable -{ - Display *disp; - Window win; - Evas_List tmp_images; -}; - -struct _evas_imlib_update -{ - Imlib_Image image; - int x, y, w, h; -}; - -struct _evas_imlib_color -{ - int r, g, b, a; - int dist; -}; - -struct _evas_imlib_gradient -{ - Evas_List colors; -}; - -/***************/ -/* image stuff */ -/***************/ -Evas_Imlib_Image *__evas_imlib_image_new_from_file(Display *disp, char *file); -void __evas_imlib_image_free(Evas_Imlib_Image *im); -void __evas_imlib_image_cache_empty(Display *disp); -void __evas_imlib_image_cache_set_size(Display *disp, int size); -int __evas_imlib_image_cache_get_size(Display *disp); -int __evas_imlib_image_get_width(Evas_Imlib_Image *im); -int __evas_imlib_image_get_height(Evas_Imlib_Image *im); -void __evas_imlib_image_set_borders(Evas_Imlib_Image *im, int left, int right, int top, int bottom); -void __evas_imlib_image_set_smooth_scaling(int on); -void __evas_imlib_image_draw(Evas_Imlib_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int cr, int cg, int cb, int ca); - -/********/ -/* text */ -/********/ -Evas_Imlib_Font *__evas_imlib_text_font_new(Display *disp, char *font, int size); -void __evas_imlib_text_font_free(Evas_Imlib_Font *fn); -int __evas_imlib_text_font_get_ascent(Evas_Imlib_Font *fn); -int __evas_imlib_text_font_get_descent(Evas_Imlib_Font *fn); -int __evas_imlib_text_font_get_max_ascent(Evas_Imlib_Font *fn); -int __evas_imlib_text_font_get_max_descent(Evas_Imlib_Font *fn); -void __evas_imlib_text_font_get_advances(Evas_Imlib_Font *fn, char *text, int *advance_horiz, int *advance_vert); -int __evas_imlib_text_font_get_first_inset(Evas_Imlib_Font *fn, char *text); -void __evas_imlib_text_font_add_path(char *path); -void __evas_imlib_text_font_del_path(char *path); -char **__evas_imlib_text_font_list_paths(int *count); -void __evas_imlib_text_cache_empty(Display *disp); -void __evas_imlib_text_cache_set_size(Display *disp, int size); -int __evas_imlib_text_cache_get_size(Display *disp); -void __evas_imlib_text_get_size(Evas_Imlib_Font *fn, char *text, int *w, int *h); -int __evas_imlib_text_get_character_at_pos(Evas_Imlib_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch); -void __evas_imlib_text_get_character_number(Evas_Imlib_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch); -void __evas_imlib_text_draw(Evas_Imlib_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a); - -/**************/ -/* rectangles */ -/**************/ - -void __evas_imlib_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a); - -/*********/ -/* lines */ -/*********/ - -void __evas_imlib_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a); - -/*************/ -/* gradients */ -/*************/ -Evas_Imlib_Graident *__evas_imlib_gradient_new(Display *disp); -void __evas_imlib_gradient_free(Evas_Imlib_Graident *gr); -void __evas_imlib_gradient_color_add(Evas_Imlib_Graident *gr, int r, int g, int b, int a, int dist); -void __evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle); - -/************/ -/* polygons */ -/************/ -void __evas_imlib_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a); - -/***********/ -/* drawing */ -/***********/ -void __evas_imlib_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a); -void __evas_imlib_init(Display *disp, int screen, int colors); -void __evas_imlib_set_vis_cmap(Visual *vis, Colormap cmap); -int __evas_imlib_capable(Display *disp); -void __evas_imlib_flush_draw(Display *disp, Imlib_Image dstim, Window win); -void __evas_imlib_sync(Display *disp); -Visual *__evas_imlib_get_visual(Display *disp, int screen); -XVisualInfo *__evas_imlib_get_visual_info(Display *disp, int screen); -Colormap __evas_imlib_get_colormap(Display *disp, int screen); -void __evas_imlib_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h); - diff --git a/legacy/evas/src/evas_line.c b/legacy/evas/src/evas_line.c deleted file mode 100644 index df601786e2..0000000000 --- a/legacy/evas/src/evas_line.c +++ /dev/null @@ -1,136 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include - -static void -_evas_free_line(Evas_Object o) -{ - Evas_Object_Line oo; - - IF_OBJ(o, OBJECT_LINE) return; - oo = o; - free(o); -} - -static void -_evas_free_line_renderer_data(Evas e, Evas_Object o) -{ - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - break; - case RENDER_METHOD_BASIC_HARDWARE: - break; - case RENDER_METHOD_3D_HARDWARE: - break; - case RENDER_METHOD_ALPHA_HARDWARE: - break; - case RENDER_METHOD_IMAGE: - break; - default: - break; - } -} - -Evas_Object -evas_add_line(Evas e) -{ - Evas_Object_Line oo; - Evas_Object_Any o; - Evas_List l; - Evas_Layer layer; - - if (!e) return NULL; - o = oo = malloc(sizeof(struct _Evas_Object_Line)); - memset(o, 0, sizeof(struct _Evas_Object_Line)); - o->type = OBJECT_LINE; - o->object_free = _evas_free_line; - o->object_renderer_data_free = _evas_free_line_renderer_data; - - oo->current.x1 = 0; - oo->current.y1 = 0; - oo->current.x2 = 0; - oo->current.y2 = 0; - - o->current.x = 0; - o->current.y = 0; - o->current.w = 1; - o->current.h = 1; - - for (l = e->layers; l; l = l->next) - { - layer = l->data; - if (layer->layer == o->current.layer) - { - layer->objects = evas_list_append(layer->objects, o); - return o; - } - if (layer->layer > o->current.layer) - { - Evas_Layer layer_new; - - layer_new = malloc(sizeof(struct _Evas_Layer)); - memset(layer_new, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_prepend_relative(e->layers, layer_new, layer); - layer_new->objects = evas_list_append(layer_new->objects, o); - layer_new->layer = o->current.layer; - return o; - } - } - - layer = malloc(sizeof(struct _Evas_Layer)); - memset(layer, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_append(e->layers, layer); - layer->objects = evas_list_append(layer->objects, o); - - return o; -} - -void -evas_set_line_xy(Evas e, Evas_Object o, double x1, double y1, double x2, double y2) -{ - Evas_Object_Line oo; - int event_update = 0; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - IF_OBJ(o, OBJECT_LINE) return; - oo = (Evas_Object_Line)o; - if ((o->current.visible) && - (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) - event_update = 1; - oo->current.x1 = x1; - oo->current.y1 = y1; - oo->current.x2 = x2; - oo->current.y2 = y2; - if (x1 < x2) - { - o->current.x = x1; - o->current.w = (x2 - x1) + 1; - } - else - { - o->current.x = x2; - o->current.w = (x1 - x2) + 1; - } - if (y1 < y2) - { - o->current.y = y1; - o->current.h = (y2 - y1) + 1; - } - else - { - o->current.y = y2; - o->current.h = (y1 - y2) + 1; - } - if ((o->current.visible) && - ((_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)) || - (event_update))) - evas_event_move(e, e->mouse.x, e->mouse.y); - o->changed = 1; - e->changed = 1; -} diff --git a/legacy/evas/src/evas_list.c b/legacy/evas/src/evas_list.c deleted file mode 100644 index d1103ff1c2..0000000000 --- a/legacy/evas/src/evas_list.c +++ /dev/null @@ -1,222 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include - -/* list ops */ -Evas_List -evas_list_append(Evas_List list, void *data) -{ - Evas_List l, new_l; - - new_l = malloc(sizeof(struct _Evas_List)); - new_l->next = NULL; - new_l->prev = NULL; - new_l->data = data; - if (!list) - { - new_l->last = new_l; - return new_l; - } - if (list->last) - { - l = list->last; - l->next = new_l; - new_l->prev = l; - list->last = new_l; - return list; - } - else - - { - for (l = list; l; l = l->next) - { - if (!l->next) - { - l->next = new_l; - new_l->prev = l; - list->last = new_l; - return list; - } - } - } - return list; -} - -Evas_List -evas_list_prepend(Evas_List list, void *data) -{ - Evas_List new_l; - - new_l = malloc(sizeof(struct _Evas_List)); - new_l->next = NULL; - new_l->prev = NULL; - new_l->data = data; - if (!list) - { - new_l->last = new_l; - return new_l; - } - new_l->next = list; - list->prev = new_l; - new_l->last = list->last; - list->last = NULL; - return new_l; -} - -Evas_List -evas_list_append_relative(Evas_List list, void *data, void *relative) -{ - Evas_List l; - - for (l = list; l; l = l->next) - { - if (l->data == relative) - { - Evas_List new_l; - - new_l = malloc(sizeof(struct _Evas_List)); - new_l->next = NULL; - new_l->prev = NULL; - new_l->data = data; - if (l->next) - { - new_l->next = l->next; - l->next->prev = new_l; - } - l->next = new_l; - new_l->prev = l; - if (!new_l->next) - list->last = new_l; - return list; - } - } - return evas_list_append(list, data); -} - -Evas_List -evas_list_prepend_relative(Evas_List list, void *data, void *relative) -{ - Evas_List l; - - for (l = list; l; l = l->next) - { - if (l->data == relative) - { - Evas_List new_l; - - new_l = malloc(sizeof(struct _Evas_List)); - new_l->next = NULL; - new_l->prev = NULL; - new_l->data = data; - new_l->prev = l->prev; - new_l->next = l; - if (l->prev) - l->prev->next = new_l; - l->prev = new_l; - if (new_l->prev) - { - if (!new_l->next) - list->last = new_l; - return list; - } - else - { - if (!new_l->next) - new_l->last = new_l; - else - { - new_l->last = list->last; - list->last = NULL; - } - return new_l; - } - } - } - return evas_list_prepend(list, data); -} - -Evas_List -evas_list_remove(Evas_List list, void *data) -{ - Evas_List l, return_l; - - for (l = list; l; l = l->next) - { - if (l->data == data) - { - if (l->next) - l->next->prev = l->prev; - if (l->prev) - { - l->prev->next = l->next; - return_l = list; - } - else - { - return_l = l->next; - if (return_l) - return_l->last = list->last; - } - if (l == list->last) - list->last = l->prev; - free(l); - return return_l; - } - } - return list; -} - -Evas_List -evas_list_remove_list(Evas_List list, Evas_List remove_list) -{ - Evas_List return_l; - - if (!remove_list) return list; - if (remove_list->next) - remove_list->next->prev = remove_list->prev; - if (remove_list->prev) - { - remove_list->prev->next = remove_list->next; - return_l = list; - } - else - { - return_l = remove_list->next; - if (return_l) - return_l->last = list->last; - } - if (remove_list == list->last) - list->last = remove_list->prev; - free(remove_list); - return return_l; -} - -void * -evas_list_find(Evas_List list, void *data) -{ - Evas_List l; - - for (l = list; l; l = l->next) - { - if (l->data == data) return data; - } - return NULL; -} - -Evas_List -evas_list_free(Evas_List list) -{ - Evas_List l, free_l; - - for (l = list; l;) - { - free_l = l; - l = l->next; - free(free_l); - } - return NULL; -} - diff --git a/legacy/evas/src/evas_misc.c b/legacy/evas/src/evas_misc.c deleted file mode 100644 index 59afd691f2..0000000000 --- a/legacy/evas/src/evas_misc.c +++ /dev/null @@ -1,654 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include -#include "evas_gl_routines.h" -#include "evas_imlib_routines.h" -#include "evas_image_routines.h" -#include "evas_x11_routines.h" -#include "evas_render_routines.h" - -void _evas_layer_free(Evas e, Evas_Layer layer); - -Evas -evas_new_all(Display *display, Window parent_window, - int x, int y, int w, int h, - Evas_Render_Method render_method, - int colors, int font_cache, int image_cache, - char *font_dir) -{ - Evas e; - Window window; - XSetWindowAttributes att; - Visual *visual; - Colormap colormap; - - e = evas_new(); - evas_set_output_method(e, render_method); - evas_set_output_colors(e, colors); - visual = evas_get_optimal_visual(e, display); - colormap = evas_get_optimal_colormap(e, display); - att.background_pixmap = None; - att.colormap = colormap; - att.border_pixel = 0; - att.event_mask = 0; - window = XCreateWindow(display, - parent_window, - x, y, w, h, 0, - imlib_get_visual_depth(display, visual), - InputOutput, - visual, - CWColormap | CWBorderPixel | CWEventMask | CWBackPixmap, - &att); - e->current.created_window = window; - if (font_dir) evas_font_add_path(e, font_dir); - evas_set_output(e, display, window, visual, colormap); - evas_set_output_size(e, w, h); - evas_set_output_viewport(e, 0, 0, w, h); - evas_set_font_cache(e, font_cache); - evas_set_image_cache(e, image_cache); - evas_event_leave(e); - return e; -} - -Window -evas_get_window(Evas e) -{ - if (!e) return 0; - return e->current.drawable; -} - -Display * -evas_get_display(Evas e) -{ - if (!e) return NULL; - return e->current.display; -} - -Visual * -evas_get_visual(Evas e) -{ - if (!e) return NULL; - return e->current.visual; -} - -Colormap -evas_get_colormap(Evas e) -{ - if (!e) return 0; - return e->current.colormap; -} - -int -evas_get_colors(Evas e) -{ - if (!e) return 0; - return e->current.colors; -} - -Imlib_Image -evas_get_image(Evas e) -{ - if (!e) return NULL; - return e->current.image; -} - -Evas_Render_Method -evas_get_output_method(Evas e) -{ - if (!e) return RENDER_METHOD_ALPHA_SOFTWARE; - return e->current.render_method; -} - -Evas -evas_new(void) -{ - Evas e; - - e = malloc(sizeof(struct _Evas)); - memset(e, 0, sizeof(struct _Evas)); - e->current.viewport.x = 0.0; - e->current.viewport.y = 0.0; - e->current.viewport.w = 1.0; - e->current.viewport.h = 1.0; - e->previous.viewport.x = 0.0; - e->previous.viewport.y = 0.0; - e->previous.viewport.w = 1.0; - e->previous.viewport.h = 1.0; - e->current.drawable_width = 1; - e->current.drawable_height = 1; - e->previous.drawable_width = 1; - e->previous.drawable_height = 1; - e->current.render_method = RENDER_METHOD_ALPHA_SOFTWARE; - e->current.colors = 216; - e->current.val_cache.mult_x = (double)e->current.drawable_width / e->current.viewport.w; - e->current.val_cache.mult_y = (double)e->current.drawable_height / e->current.viewport.h; - return e; -} - -static void -_evas_x_err(Display *display, XErrorEvent *ev) -{ - display = NULL; - ev = NULL; -} - -void -evas_free(Evas e) -{ - Evas_List l; - - if (!e) return; - if ((e->current.display) && - (e->current.created_window)) - { - XErrorHandler prev_handler; - - prev_handler = XSetErrorHandler((XErrorHandler)_evas_x_err); - XDestroyWindow(e->current.display, e->current.created_window); - XSync(e->current.display, False); - XSetErrorHandler(prev_handler); - } - for (l = e->layers; l; l = l->next) - { - Evas_Layer layer; - - layer = l->data; - _evas_layer_free(e, layer); - } - if (e->layers) evas_list_free(e->layers); - if (e->updates) imlib_updates_free(e->updates); - if (e->obscures) imlib_updates_free(e->obscures); - free(e); -} - -void -evas_set_color(Evas e, Evas_Object o, int r, int g, int b, int a) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - if (r < 0) r = 0; - else if (r > 255) r = 255; - if (g < 0) g = 0; - else if (g > 255) g = 255; - if (b < 0) b = 0; - else if (b > 255) b = 255; - if (a < 0) a = 0; - else if (a > 255) a = 255; - switch (o->type) - { - case OBJECT_IMAGE: - { - Evas_Object_Image oo; - - oo = (Evas_Object_Image)o; - oo->current.color.r = r; - oo->current.color.g = g; - oo->current.color.b = b; - oo->current.color.a = a; - } - o->changed = 1; - e->changed = 1; - break; - case OBJECT_TEXT: - { - Evas_Object_Text oo; - - oo = (Evas_Object_Text)o; - oo->current.r = r; - oo->current.g = g; - oo->current.b = b; - oo->current.a = a; - } - o->changed = 1; - e->changed = 1; - break; - case OBJECT_RECTANGLE: - { - Evas_Object_Rectangle oo; - - oo = (Evas_Object_Rectangle)o; - oo->current.r = r; - oo->current.g = g; - oo->current.b = b; - oo->current.a = a; - } - o->changed = 1; - e->changed = 1; - break; - case OBJECT_LINE: - { - Evas_Object_Line oo; - - oo = (Evas_Object_Line)o; - oo->current.r = r; - oo->current.g = g; - oo->current.b = b; - oo->current.a = a; - } - o->changed = 1; - e->changed = 1; - break; - case OBJECT_POLYGON: - { - Evas_Object_Poly oo; - - oo = (Evas_Object_Poly)o; - oo->current.r = r; - oo->current.g = g; - oo->current.b = b; - oo->current.a = a; - } - o->changed = 1; - e->changed = 1; - break; - default: - break; - } -} - -void -evas_get_color(Evas e, Evas_Object o, int *r, int *g, int *b, int *a) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - switch (o->type) - { - case OBJECT_IMAGE: - { - Evas_Object_Image oo; - - oo = (Evas_Object_Image)o; - if (r) *r = oo->current.color.r; - if (g) *g = oo->current.color.g; - if (b) *b = oo->current.color.b; - if (a) *a = oo->current.color.a; - } - break; - case OBJECT_TEXT: - { - Evas_Object_Text oo; - - oo = (Evas_Object_Text)o; - if (r) *r = oo->current.r; - if (g) *g = oo->current.g; - if (b) *b = oo->current.b; - if (a) *a = oo->current.a; - } - break; - case OBJECT_RECTANGLE: - { - Evas_Object_Rectangle oo; - - oo = (Evas_Object_Rectangle)o; - if (r) *r = oo->current.r; - if (g) *g = oo->current.g; - if (b) *b = oo->current.b; - if (a) *a = oo->current.a; - } - break; - case OBJECT_LINE: - { - Evas_Object_Line oo; - - oo = (Evas_Object_Line)o; - if (r) *r = oo->current.r; - if (g) *g = oo->current.g; - if (b) *b = oo->current.b; - if (a) *a = oo->current.a; - } - break; - default: - break; - } -} - -void -evas_set_zoom_scale(Evas e, Evas_Object o, int scale) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - o->current.zoomscale = scale; - o->changed = 1; - e->changed = 1; -} - -void -evas_set_pass_events(Evas e, Evas_Object o, int pass_events) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - o->pass_events = 1; -} - -void -evas_set_font_cache(Evas e, int size) -{ - if (!e) return; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - __evas_imlib_text_cache_set_size(e->current.display, size); - break; - case RENDER_METHOD_BASIC_HARDWARE: - __evas_x11_text_cache_set_size(e->current.display, size); - break; - case RENDER_METHOD_3D_HARDWARE: - __evas_gl_text_cache_set_size(e->current.display, size); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - __evas_render_text_cache_set_size(e->current.display, size); - break; - case RENDER_METHOD_IMAGE: - __evas_image_text_cache_set_size(e->current.display, size); - break; - default: - return; - break; - } -} - -int -evas_get_font_cache(Evas e) -{ - if (!e) return 0; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - return __evas_imlib_text_cache_get_size(e->current.display); - break; - case RENDER_METHOD_BASIC_HARDWARE: - return __evas_x11_text_cache_get_size(e->current.display); - break; - case RENDER_METHOD_3D_HARDWARE: - return __evas_gl_text_cache_get_size(e->current.display); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - return __evas_render_text_cache_get_size(e->current.display); - break; - case RENDER_METHOD_IMAGE: - return __evas_image_text_cache_get_size(e->current.display); - break; - default: - return 0; - break; - } - return 0; -} - -void -evas_flush_font_cache(Evas e) -{ - if (!e) return; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - __evas_imlib_text_cache_empty(e->current.display); - break; - case RENDER_METHOD_BASIC_HARDWARE: - __evas_x11_text_cache_empty(e->current.display); - break; - case RENDER_METHOD_3D_HARDWARE: - __evas_gl_text_cache_empty(e->current.display); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - __evas_render_text_cache_empty(e->current.display); - break; - case RENDER_METHOD_IMAGE: - __evas_image_text_cache_empty(e->current.display); - break; - default: - return; - break; - } -} - -void -evas_set_image_cache(Evas e, int size) -{ - if (!e) return; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - __evas_imlib_image_cache_set_size(e->current.display, size); - break; - case RENDER_METHOD_BASIC_HARDWARE: - __evas_x11_image_cache_set_size(e->current.display, size); - break; - case RENDER_METHOD_3D_HARDWARE: - __evas_gl_image_cache_set_size(e->current.display, size); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - __evas_render_image_cache_set_size(e->current.display, size); - break; - case RENDER_METHOD_IMAGE: - __evas_image_image_cache_set_size(e->current.display, size); - break; - default: - return; - break; - } -} - -int -evas_get_image_cache(Evas e) -{ - if (!e) return 0; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - return __evas_imlib_image_cache_get_size(e->current.display); - break; - case RENDER_METHOD_BASIC_HARDWARE: - return __evas_x11_image_cache_get_size(e->current.display); - break; - case RENDER_METHOD_3D_HARDWARE: - return __evas_gl_image_cache_get_size(e->current.display); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - return __evas_render_image_cache_get_size(e->current.display); - break; - case RENDER_METHOD_IMAGE: - return __evas_image_image_cache_get_size(e->current.display); - break; - default: - return 0; - break; - } - return 0; -} - -void -evas_flush_image_cache(Evas e) -{ - if (!e) return; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - __evas_imlib_image_cache_empty(e->current.display); - break; - case RENDER_METHOD_BASIC_HARDWARE: - __evas_x11_image_cache_empty(e->current.display); - break; - case RENDER_METHOD_3D_HARDWARE: - __evas_gl_image_cache_empty(e->current.display); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - __evas_render_image_cache_empty(e->current.display); - break; - case RENDER_METHOD_IMAGE: - __evas_image_image_cache_empty(e->current.display); - break; - default: - return; - break; - } -} - -void -evas_font_add_path(Evas e, char *path) -{ - if (!e) return; - if (!path) return; - evas_font_del_path(e, path); - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - __evas_imlib_text_font_add_path(path); - break; - case RENDER_METHOD_BASIC_HARDWARE: - __evas_x11_text_font_add_path(path); - break; - case RENDER_METHOD_3D_HARDWARE: - __evas_gl_text_font_add_path(path); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - __evas_render_text_font_add_path(path); - break; - case RENDER_METHOD_IMAGE: - __evas_image_text_font_add_path(path); - break; - default: - return; - break; - } -} - -void -evas_font_del_path(Evas e, char *path) -{ - if (!e) return; - if (!path) return; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - __evas_imlib_text_font_del_path(path); - break; - case RENDER_METHOD_BASIC_HARDWARE: - __evas_x11_text_font_del_path(path); - break; - case RENDER_METHOD_3D_HARDWARE: - __evas_gl_text_font_del_path(path); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - __evas_render_text_font_del_path(path); - break; - case RENDER_METHOD_IMAGE: - __evas_image_text_font_del_path(path); - break; - default: - return; - break; - } -} - -void -evas_put_data(Evas e, Evas_Object o, char *key, void *data) -{ - Evas_Data d; - Evas_List l; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - if (!key) return; - for (l = o->data; l; l = l->next) - { - Evas_Data d; - - d = l->data; - if (!strcmp(d->key, key)) - { - d->data = data; - return; - } - } - d = malloc(sizeof(struct _Evas_Data)); - d->key = malloc(strlen(key) + 1); - strcpy(d->key, key); - d->data = data; - o->data = evas_list_prepend(o->data, d); -} - -void * -evas_get_data(Evas e, Evas_Object o, char *key) -{ - Evas_List l; - - if (!e) return NULL; - o = TO_OBJECT(e, o); - if (!o) return NULL; - if (!key) return NULL; - for (l = o->data; l; l = l->next) - { - Evas_Data d; - - d = l->data; - if (!strcmp(d->key, key)) return d->data; - } - return NULL; -} - -void * -evas_remove_data(Evas e, Evas_Object o, char *key) -{ - Evas_List l; - - if (!e) return NULL; - o = TO_OBJECT(e, o); - if (!o) return NULL; - if (!key) return NULL; - for (l = o->data; l; l = l->next) - { - Evas_Data d; - - d = l->data; - if (!strcmp(d->key, key)) - { - void *data; - - o->data = evas_list_remove(o->data, l->data); - data = d->data; - free(d->key); - free(d); - return data; - } - } - return NULL; -} - -int -evas_world_x_to_screen(Evas e, double x) -{ - if (!e) return 0; - return (int)((x - e->current.viewport.x) * e->current.val_cache.mult_x); -} - -int -evas_world_y_to_screen(Evas e, double y) -{ - if (!e) return 0; - return (int)((y - e->current.viewport.y) * e->current.val_cache.mult_y); -} - -double -evas_screen_x_to_world(Evas e, int x) -{ - if (!e) return 0; - return (double)((double)x / e->current.val_cache.mult_x) - + e->current.viewport.x; -} - -double -evas_screen_y_to_world(Evas e, int y) -{ - if (!e) return 0; - return (double)((double)y / e->current.val_cache.mult_y) - + e->current.viewport.y; -} diff --git a/legacy/evas/src/evas_object.c b/legacy/evas/src/evas_object.c deleted file mode 100644 index 9bcf50df13..0000000000 --- a/legacy/evas/src/evas_object.c +++ /dev/null @@ -1,699 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include - -#define SPANS_COMMON(x1, w1, x2, w2) \ -(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1))))) -#define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \ -((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh)))) - -Evas_Layer -_evas_get_object_layer(Evas e, Evas_Object o) -{ - Evas_List l; - - for (l = e->layers; l; l = l->next) - { - Evas_Layer layer; - - layer = l->data; - if (layer->layer == o->current.layer) return layer; - } - return NULL; -} - -void -_evas_remove_data(Evas e, Evas_Object o) -{ - Evas_List l; - - if (o->data) - { - for (l = o->data; l; l = l->next) - { - Evas_Data d; - - d = l->data; - if (d->key) - free(d->key); - free(d); - } - evas_list_free(o->data); - } -} - -void -_evas_remove_callbacks(Evas e, Evas_Object o) -{ - Evas_List l; - - if (o->callbacks) - { - for (l = o->callbacks; l; l = l->next) - { - Evas_Callback cb; - - cb = l->data; - free(cb); - } - evas_list_free(o->callbacks); - } -} - -void -_evas_real_del_object(Evas e, Evas_Object o) -{ - Evas_List l; - - for (l = e->layers; l; l = l->next) - { - Evas_Layer layer; - - layer = l->data; - if (layer->layer == o->current.layer) - { - layer->objects = evas_list_remove(layer->objects, o); - _evas_callback_call(e, o, CALLBACK_FREE, 0, 0, 0); - if (e->mouse.object == o) e->mouse.object = NULL; - if (e->mouse.button_object == o) e->mouse.button_object = NULL; - _evas_remove_callbacks(e, o); - _evas_remove_data(e, o); - if (o->name) free(o->name); - o->object_renderer_data_free(e, o); - o->object_free(o); - return; - } - } -} - -void -_evas_layer_free(Evas e, Evas_Layer layer) -{ - if (layer->objects) - { - Evas_List l; - - for (l = layer->objects; l; l = l->next) - { - Evas_Object o; - - o = l->data; - _evas_callback_call(e, o, CALLBACK_FREE, 0, 0, 0); - _evas_cleanup_clip(e, o); - if (e->mouse.object == o) e->mouse.object = NULL; - if (e->mouse.button_object == o) e->mouse.button_object = NULL; - _evas_remove_callbacks(e, o); - _evas_remove_data(e, o); - o->object_renderer_data_free(e, o); - o->object_free(o); - } - evas_list_free(layer->objects); - } - free(layer); -} - -void -_evas_cleanup_clip(Evas e, Evas_Object o) -{ - if (o->clip.list) - { - Evas_List l; - - for (l = o->clip.list; l; l = l->next) - { - Evas_Object o2; - - o2 = l->data; - o2->clip.object = NULL; - o2->clip.changed = 1; - o2->changed = 1; - e->changed = 1; - } - evas_list_free(o->clip.list); - o->clip.list = NULL; - } - if (o->clip.object) - o->clip.object->clip.list = evas_list_remove(o->clip.object->clip.list, o); -} - -int -_evas_point_in_object(Evas e, Evas_Object o, int x, int y) -{ - double cx, cy; - double ox, oy, ow, oh; - - if (o->delete_me) return 0; - cx = evas_screen_x_to_world(e, x); - cy = evas_screen_x_to_world(e, y); - ox = o->current.x; oy = o->current.y; - ow = o->current.w; oh = o->current.h; - _evas_get_current_clipped_geometry(e, o, &ox, &oy, &ow, &oh); - if ((cx >= ox) && (cx < (ox + ow)) && (cy >= oy) && (cy < (oy + oh))) - return 1; - return 0; -} - -void -evas_set_clip(Evas e, Evas_Object o, Evas_Object clip) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - if (!clip) return; - - if (o->clip.object == clip) return; - e->changed = 1; - o->changed = 1; - o->clip.changed = 1; - if (o->clip.object) - o->clip.object->clip.list = evas_list_remove(o->clip.object->clip.list, o); - o->clip.object = clip; - clip->clip.list = evas_list_prepend(clip->clip.list, o); -} - -void -evas_unset_clip(Evas e, Evas_Object o) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - - if (o->clip.object) - { - e->changed = 1; - o->changed = 1; - o->clip.changed = 1; - o->clip.object->clip.list = evas_list_remove(o->clip.object->clip.list, o); - o->clip.object = NULL; - } -} - -Evas_Object -evas_get_clip_object(Evas e, Evas_Object o) -{ - if (!e) return NULL; - o = TO_OBJECT(e, o); - if (!o) return NULL; - - return o->clip.object; -} - -Evas_List -evas_get_clip_list(Evas e, Evas_Object o) -{ - if (!e) return NULL; - o = TO_OBJECT(e, o); - if (!o) return NULL; - - return o->clip.list; -} - -/* deleting objects */ -void -evas_del_object(Evas e, Evas_Object o) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - _evas_cleanup_clip(e, o); - e->changed = 1; - evas_hide(e, o); - o->delete_me = 1; -} - -/* layer stacking for object */ -void -evas_set_layer(Evas e, Evas_Object o, int layer_num) -{ - Evas_Layer layer; - Evas_List l; - int removed; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - if (layer_num == o->current.layer) return; - removed = 0; - for (l = e->layers; l; l = l->next) - { - layer = l->data; - if (layer->layer == o->current.layer) - { - layer->objects = evas_list_remove(layer->objects, o); - removed = 1; - if (!layer->objects) - { - e->layers = evas_list_remove(e->layers, layer); - _evas_layer_free(e, layer); - } - break; - } - } - if (!removed) return; - o->changed = 1; - e->changed = 1; - o->current.layer = layer_num; - - for (l = e->layers; l; l = l->next) - { - layer = l->data; - if (layer->layer == o->current.layer) - { - layer->objects = evas_list_append(layer->objects, o); - if ((o->current.visible) && - (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) - evas_event_move(e, e->mouse.x, e->mouse.y); - return; - } - if (layer->layer > o->current.layer) - { - Evas_Layer layer_new; - - layer_new = malloc(sizeof(struct _Evas_Layer)); - memset(layer_new, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_prepend_relative(e->layers, layer_new, layer); - layer_new->objects = evas_list_append(layer_new->objects, o); - layer_new->layer = o->current.layer; - if ((o->current.visible) && - (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) - evas_event_move(e, e->mouse.x, e->mouse.y); - return; - } - } - layer = malloc(sizeof(struct _Evas_Layer)); - memset(layer, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_append(e->layers, layer); - layer->objects = evas_list_append(layer->objects, o); - layer->layer = o->current.layer; - if ((o->current.visible) && - (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) - evas_event_move(e, e->mouse.x, e->mouse.y); -} - -int -evas_get_layer(Evas e, Evas_Object o) -{ - Evas_Layer layer; - Evas_List l; - int removed; - - if (!e) return 0; - o = TO_OBJECT(e, o); - if (!o) return 0; - return o->current.layer; -} - -void -evas_set_layer_store(Evas e, int l, int store) -{ - if (!e) return; -/* FIXME: find layer and set store flag */ -/* e->changed = 1; */ -} - -Evas_List -evas_objects_in_rect(Evas e, double x, double y, double w, double h) -{ - Evas_List l, ll, objs; - Evas_Layer layer; - - if (!e) return NULL; - if (w < 0) w = 0; - if (h < 0) h = 0; - objs = NULL; - for (l = e->layers; l ; l = l->next) - { - layer = l->data; - - for (ll = layer->objects; ll; ll = ll->next) - { - Evas_Object ob; - - ob = ll->data; - if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me) && (!ob->clip.list)) - { - double ox, oy, ow, oh; - - ox = ob->current.x; oy = ob->current.y; - ow = ob->current.w; oh = ob->current.h; - _evas_get_current_clipped_geometry(e, ob, &ox, &oy, &ow, &oh); - if (RECTS_INTERSECT(x, y, w, h, ox, oy, ow, oh)) - objs = evas_list_prepend(objs, ll->data); - } - } - } - return objs; -} - -Evas_List -evas_objects_at_position(Evas e, double x, double y) -{ - Evas_List l, ll, objs; - Evas_Layer layer; - - if (!e) return NULL; - objs = NULL; - for (l = e->layers; l ; l = l->next) - { - layer = l->data; - - for (ll = layer->objects; ll; ll = ll->next) - { - Evas_Object ob; - - ob = ll->data; - if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me) && (!ob->clip.list)) - { - double ox, oy, ow, oh; - - ox = ob->current.x; oy = ob->current.y; - ow = ob->current.w; oh = ob->current.h; - _evas_get_current_clipped_geometry(e, ob, &ox, &oy, &ow, &oh); - if (RECTS_INTERSECT(x, y, 1, 1, ox, oy, ow, oh)) - objs = evas_list_prepend(objs, ll->data); - } - } - } - return objs; -} - -Evas_Object -evas_object_in_rect(Evas e, double x, double y, double w, double h) -{ - Evas_List l, ll; - Evas_Layer layer; - Evas_Object o; - - if (!e) return NULL; - o = NULL; - for (l = e->layers; l ; l = l->next) - { - layer = l->data; - - for (ll = layer->objects; ll; ll = ll->next) - { - Evas_Object ob; - - ob = ll->data; - if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me) && (!ob->clip.list)) - { - double ox, oy, ow, oh; - - ox = ob->current.x; oy = ob->current.y; - ow = ob->current.w; oh = ob->current.h; - _evas_get_current_clipped_geometry(e, ob, &ox, &oy, &ow, &oh); - if (RECTS_INTERSECT(x, y, w, h, ox, oy, ow, oh)) - o = ob; - } - } - } - return o; -} - -Evas_Object -evas_object_at_position(Evas e, double x, double y) -{ - Evas_List l, ll; - Evas_Layer layer; - Evas_Object o; - - if (!e) return NULL; - o = NULL; - for (l = e->layers; l ; l = l->next) - { - layer = l->data; - - for (ll = layer->objects; ll; ll = ll->next) - { - Evas_Object ob; - - ob = ll->data; - if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me) && (!ob->clip.list)) - { - double ox, oy, ow, oh; - - ox = ob->current.x; oy = ob->current.y; - ow = ob->current.w; oh = ob->current.h; - _evas_get_current_clipped_geometry(e, ob, &ox, &oy, &ow, &oh); - if (RECTS_INTERSECT(x, y, 1.0, 1.0, ox, oy, ow, oh)) - o = ob; - } - } - } - return o; -} - -/* stacking within a layer */ -void -evas_raise(Evas e, Evas_Object o) -{ - Evas_Layer layer; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - layer = _evas_get_object_layer(e, o); - if (layer) - { - o->current.stacking = 1; - layer->objects = evas_list_remove(layer->objects, o); - layer->objects = evas_list_append(layer->objects, o); - o->changed = 1; - e->changed = 1; - if ((o->current.visible) && - (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) - evas_event_move(e, e->mouse.x, e->mouse.y); - } -} - -void -evas_lower(Evas e, Evas_Object o) -{ - Evas_Layer layer; - - if (!e) return; - if (!o) return; - layer = _evas_get_object_layer(e, o); - if (layer) - { - o->current.stacking = 1; - layer->objects = evas_list_remove(layer->objects, o); - layer->objects = evas_list_prepend(layer->objects, o); - o->changed = 1; - e->changed = 1; - if ((o->current.visible) && - (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) - evas_event_move(e, e->mouse.x, e->mouse.y); - } -} - -void -evas_stack_above(Evas e, Evas_Object o, Evas_Object above) -{ - Evas_Layer layer; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - layer = _evas_get_object_layer(e, o); - if (layer) - { - o->current.stacking = 1; - layer->objects = evas_list_remove(layer->objects, o); - layer->objects = evas_list_append_relative(layer->objects, o, above); - o->changed = 1; - e->changed = 1; - if ((o->current.visible) && - (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) - evas_event_move(e, e->mouse.x, e->mouse.y); - } -} - -void -evas_stack_below(Evas e, Evas_Object o, Evas_Object below) -{ - Evas_Layer layer; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - layer = _evas_get_object_layer(e, o); - if (layer) - { - o->current.stacking = 1; - layer->objects = evas_list_remove(layer->objects, o); - layer->objects = evas_list_prepend_relative(layer->objects, o, below); - o->changed = 1; - e->changed = 1; - if ((o->current.visible) && - (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) - evas_event_move(e, e->mouse.x, e->mouse.y); - } -} - -/* object geoemtry */ -void -evas_move(Evas e, Evas_Object o, double x, double y) -{ - int event_update = 0; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - if ((o->type == OBJECT_LINE)) return; - if ((x == o->current.x) && (y == o->current.y)) return; - if ((o->current.visible) && - (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) - event_update = 1; - if ((o->type == OBJECT_POLYGON)) - { - Evas_Object_Poly oo; - Evas_List l; - Evas_Point p; - double dx, dy; - - dx = x - o->current.x; - dy = y - o->current.y; - o->current.x = x; - o->current.y = y; - oo = o; - for (l = oo->current.points; l; l = l->next) - { - p = l->data; - p->x += dx; - p->y += dy; - } - } - else - { - o->current.x = x; - o->current.y = y; - } - o->changed = 1; - e->changed = 1; - if ((o->current.visible) && - ((_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)) || - (event_update))) - evas_event_move(e, e->mouse.x, e->mouse.y); -} - -void -evas_resize(Evas e, Evas_Object o, double w, double h) -{ - int event_update = 0; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - if ((o->type == OBJECT_LINE)) return; - if ((o->type == OBJECT_TEXT)) return; - if ((o->type == OBJECT_POLYGON)) return; - if (w < 0) w = 0; - if (h < 0) h = 0; - if ((w == o->current.w) && (h == o->current.h)) return; - if ((o->current.visible) && - (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) - event_update = 1; - o->current.w = w; - o->current.h = h; - o->changed = 1; - e->changed = 1; - if ((o->current.visible) && - ((_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)) || - (event_update))) - evas_event_move(e, e->mouse.x, e->mouse.y); -} - -void -evas_get_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double *h) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - if (x) *x = o->current.x; - if (y) *y = o->current.y; - if (w) *w = o->current.w; - if (h) *h = o->current.h; - e->changed = 1; -} - -/* object visibility */ -void -evas_show(Evas e, Evas_Object o) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - o->current.visible = 1; - o->changed = 1; - e->changed = 1; - if (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)) - evas_event_move(e, e->mouse.x, e->mouse.y); -} - -void -evas_hide(Evas e, Evas_Object o) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - o->current.visible = 0; - o->changed = 1; - e->changed = 1; - if (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y)) - evas_event_move(e, e->mouse.x, e->mouse.y); - if (e->mouse.object == o) e->mouse.object = NULL; - if (e->mouse.button_object == o) e->mouse.button_object = NULL; -} - -Evas_Object -evas_object_get_named(Evas e, char *name) -{ - Evas_List l, ll; - Evas_Layer layer; - Evas_Object o; - - if (!e) return NULL; - if (!name) return NULL; - for (l = e->layers; l ; l = l->next) - { - layer = l->data; - - for (ll = layer->objects; ll; ll = ll->next) - { - o = ll->data; - if (!o->delete_me) - { - if ((o->name) && (!strcmp(name, o->name))) return o; - } - } - } - return NULL; -} - -void -evas_object_set_name(Evas e, Evas_Object o, char *name) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - if (o->name) free(o->name); - o->name = NULL; - if (name) - { - o->name = malloc(strlen(name) + 1); - strcpy(o->name, name); - } -} - -char * -evas_object_get_name(Evas e, Evas_Object o) -{ - if (!e) return NULL; - o = TO_OBJECT(e, o); - if (!o) return NULL; - return o->name; -} diff --git a/legacy/evas/src/evas_poly.c b/legacy/evas/src/evas_poly.c deleted file mode 100644 index b6beac3de7..0000000000 --- a/legacy/evas/src/evas_poly.c +++ /dev/null @@ -1,171 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include - -static void -_evas_free_poly(Evas_Object o) -{ - Evas_Object_Poly oo; - Evas_List l; - Evas_Point p; - - IF_OBJ(o, OBJECT_POLYGON) return; - oo = o; - for (l = oo->current.points; l; l = l->next) - { - p = l->data; - free(p); - } - evas_list_free(oo->current.points); - free(o); -} - -static void -_evas_free_poly_renderer_data(Evas e, Evas_Object o) -{ - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - break; - case RENDER_METHOD_BASIC_HARDWARE: - break; - case RENDER_METHOD_3D_HARDWARE: - break; - case RENDER_METHOD_ALPHA_HARDWARE: - break; - case RENDER_METHOD_IMAGE: - break; - default: - break; - } -} - -/* adding objects */ -Evas_Object -evas_add_poly(Evas e) -{ - Evas_Object_Poly oo; - Evas_Object_Any o; - Evas_List l; - Evas_Layer layer; - - if (!e) return NULL; - o = oo = malloc(sizeof(struct _Evas_Object_Poly)); - memset(o, 0, sizeof(struct _Evas_Object_Poly)); - o->type = OBJECT_POLYGON; - o->object_free = _evas_free_poly; - o->object_renderer_data_free = _evas_free_poly_renderer_data; - - o->current.x = 0; - o->current.y = 0; - o->current.w = 0; - o->current.h = 0; - - for (l = e->layers; l; l = l->next) - { - layer = l->data; - if (layer->layer == o->current.layer) - { - layer->objects = evas_list_append(layer->objects, o); - return o; - } - if (layer->layer > o->current.layer) - { - Evas_Layer layer_new; - - layer_new = malloc(sizeof(struct _Evas_Layer)); - memset(layer_new, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_prepend_relative(e->layers, layer_new, layer); - layer_new->objects = evas_list_append(layer_new->objects, o); - layer_new->layer = o->current.layer; - return o; - } - } - - layer = malloc(sizeof(struct _Evas_Layer)); - memset(layer, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_append(e->layers, layer); - layer->objects = evas_list_append(layer->objects, o); - - return o; -} - -/* modifying object */ -void -evas_clear_points(Evas e, Evas_Object o) -{ - Evas_Point p; - Evas_Object_Poly oo; - Evas_List l; - - IF_OBJ(o, OBJECT_POLYGON) return; - oo = o; - if (oo->current.points) - { - for (l = oo->current.points; l; l = l->next) - { - p = l->data; - free(p); - } - evas_list_free(oo->current.points); - oo->current.points = NULL; - o->current.w = 0; - o->current.h = 0; - o->changed = 1; - e->changed = 1; - } -} - -Evas_List -evas_get_points(Evas e, Evas_Object o) -{ - Evas_Object_Poly oo; - - IF_OBJ(o, OBJECT_POLYGON) return NULL; - oo = o; - return oo->current.points; -} - -void -evas_add_point(Evas e, Evas_Object o, double x, double y) -{ - Evas_Point p; - Evas_Object_Poly oo; - - o = TO_OBJECT(e, o); - IF_OBJ(o, OBJECT_POLYGON) return; - oo = o; - p = malloc(sizeof(struct _Evas_Point)); - p->x = x; - p->y = y; - oo->previous.points = NULL; - if (!oo->current.points) - { - oo->current.points = evas_list_append(oo->current.points, p); - o->current.x = x; - o->current.y = y; - o->current.w = 1; - o->current.h = 1; - } - else - { - oo->current.points = evas_list_append(oo->current.points, p); - if (x > (o->current.x + o->current.w)) o->current.w = x - o->current.x + 1; - else if (x < o->current.x) - { - o->current.w += o->current.x - x; - o->current.x = x; - } - if (y > (o->current.y + o->current.h)) o->current.h = y - o->current.y + 1; - else if (y < o->current.y) - { - o->current.h += o->current.y - y; - o->current.y = y; - } - } - o->changed = 1; - e->changed = 1; -} diff --git a/legacy/evas/src/evas_rectangle.c b/legacy/evas/src/evas_rectangle.c deleted file mode 100644 index 32839e3ff0..0000000000 --- a/legacy/evas/src/evas_rectangle.c +++ /dev/null @@ -1,85 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include - -static void -_evas_free_rectangle(Evas_Object o) -{ - Evas_Object_Rectangle oo; - - IF_OBJ(o, OBJECT_RECTANGLE) return; - oo = o; - free(o); -} - -static void -_evas_free_rectangle_renderer_data(Evas e, Evas_Object o) -{ - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - break; - case RENDER_METHOD_BASIC_HARDWARE: - break; - case RENDER_METHOD_3D_HARDWARE: - break; - case RENDER_METHOD_ALPHA_HARDWARE: - break; - case RENDER_METHOD_IMAGE: - break; - default: - break; - } -} - -Evas_Object -evas_add_rectangle(Evas e) -{ - Evas_Object_Rectangle oo; - Evas_Object_Any o; - Evas_List l; - Evas_Layer layer; - - if (!e) return NULL; - o = oo = malloc(sizeof(struct _Evas_Object_Rectangle)); - memset(o, 0, sizeof(struct _Evas_Object_Rectangle)); - o->type = OBJECT_RECTANGLE; - o->object_free = _evas_free_rectangle; - o->object_renderer_data_free = _evas_free_rectangle_renderer_data; - - o->current.x = 0; - o->current.y = 0; - o->current.w = 1; - o->current.h = 1; - - for (l = e->layers; l; l = l->next) - { - layer = l->data; - if (layer->layer == o->current.layer) - { - layer->objects = evas_list_append(layer->objects, o); - return o; - } - if (layer->layer > o->current.layer) - { - Evas_Layer layer_new; - - layer_new = malloc(sizeof(struct _Evas_Layer)); - memset(layer_new, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_prepend_relative(e->layers, layer_new, layer); - layer_new->objects = evas_list_append(layer_new->objects, o); - layer_new->layer = o->current.layer; - return o; - } - } - - layer = malloc(sizeof(struct _Evas_Layer)); - memset(layer, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_append(e->layers, layer); - layer->objects = evas_list_append(layer->objects, o); - - return o; -} diff --git a/legacy/evas/src/evas_render.c b/legacy/evas/src/evas_render.c deleted file mode 100644 index b30694a6d0..0000000000 --- a/legacy/evas/src/evas_render.c +++ /dev/null @@ -1,1486 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include -#include "evas_gl_routines.h" -#include "evas_imlib_routines.h" -#include "evas_image_routines.h" -#include "evas_x11_routines.h" -#include "evas_render_routines.h" - -#ifndef SPANS_COMMON -#define SPANS_COMMON(x1, w1, x2, w2) \ -(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1))))) -#define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \ -((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh)))) -#endif - -void -_evas_object_get_current_translated_coords(Evas e, Evas_Object o, - int *x, int *y, int *w, int *h, int clip) -{ - double ox, oy, ow, oh, mx, my; - - ox = o->current.x; oy = o->current.y; - ow = o->current.w; oh = o->current.h; - if (clip) _evas_get_current_clipped_geometry(e, o, &ox, &oy, &ow, &oh); - mx = e->current.val_cache.mult_x; - my = e->current.val_cache.mult_y; - *x = (int)((ox - e->current.viewport.x) * mx); - *y = (int)((oy - e->current.viewport.y) * my); - *w = (int)(ow * mx); - *h = (int)(oh * my); -} - -void -_evas_object_get_previous_translated_coords(Evas e, Evas_Object o, - int *x, int *y, int *w, int *h, int clip) -{ - double ox, oy, ow, oh, mx, my; - - ox = o->previous.x; oy = o->previous.y; - ow = o->previous.w; oh = o->previous.h; - if (clip) _evas_get_previous_clipped_geometry(e, o, &ox, &oy, &ow, &oh); - mx = e->current.val_cache.mult_x; - my = e->current.val_cache.mult_y; - *x = (int)((ox - e->previous.viewport.x) * mx); - *y = (int)((oy - e->previous.viewport.y) * my); - *w = (int)(ow * mx); - *h = (int)(oh * my); -} - -void -_evas_clip_obscures(Evas e) -{ - Imlib_Updates up, old_up, ob; - - up = e->updates; - if (!up) return; - for (ob = e->obscures; ob; ob = imlib_updates_get_next(ob)) - { - int ox, oy, ow, oh; - - imlib_updates_get_coordinates(ob, &ox, &oy, &ow, &oh); - e->updates = NULL; - old_up = up; - while (up) - { - int x, y, w, h; - - imlib_updates_get_coordinates(up, &x, &y, &w, &h); - if (RECTS_INTERSECT(x, y, w, h, ox, oy, ow, oh)) - { - int rx, ry, rw, rh; - - /* left */ - rx = x; ry = y; - rw = ox - x; rh = h; - if ((rw > 0) && (rh > 0)) - e->updates = imlib_update_append_rect(e->updates, rx, ry, rw, rh); - /* right */ - rx = ox + ow; ry = y; - rw = x + w - (ox + ow); rh = h; - if ((rw > 0) && (rh > 0)) - e->updates = imlib_update_append_rect(e->updates, rx, ry, rw, rh); - /* top */ - rx = ox; ry = y; - if (ox < x) rx = x; - rw = ow; rh = oy - y; - if ((rx + rw) > (x + w)) rw = (x + w) - rx; - if ((rw > 0) && (rh > 0)) - e->updates = imlib_update_append_rect(e->updates, rx, ry, rw, rh); - /* bottom */ - rx = ox; ry = oy + oh; - if (ox < x) rx = x; - rw = ow; rh = (y + h) - ry; - if ((rx + rw) > (x + w)) rw = (x + w) - rx; - if ((rw > 0) && (rh > 0)) - e->updates = imlib_update_append_rect(e->updates, rx, ry, rw, rh); - } - else - e->updates = imlib_update_append_rect(e->updates, x, y, w, h); - up = imlib_updates_get_next(up); - } - if (old_up) imlib_updates_free(old_up); - up = e->updates; - } -} - -/* for parts of an evas that are obscured for output */ -void -evas_add_obscured_rect(Evas e, int x, int y, int w, int h) -{ - if (!e) return; - if (w <= 0) return; - if (h <= 0) return; - e->obscures = imlib_update_append_rect(e->obscures, x, y, w, h); -} - -void -evas_clear_obscured_rects(Evas e) -{ - if (!e) return; - if (e->obscures) - { - imlib_updates_free(e->obscures); - e->obscures = NULL; - } -} - -/* for exposes or forced redraws (relative to output drawable) */ -void -evas_update_rect(Evas e, int x, int y, int w, int h) -{ - if (!e) return; - if (w <= 0) return; - if (h <= 0) return; - e->updates = imlib_update_append_rect(e->updates, x, y, w, h); - e->changed = 1; -} - -/* drawing */ -void -evas_render(Evas e) -{ - Imlib_Updates u; - - u = evas_render_updates(e); - if (u) imlib_updates_free(u); -} - -Imlib_Updates -evas_render_updates(Evas e) -{ - Imlib_Updates up = NULL; - Evas_List delete_objects; - Evas_List l, ll; - int output_size_change = 0; - int zoom_changed = 1; - void (*func_draw_add_rect) (Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h); - void * (*func_image_new_from_file) (Display *disp, char *file); - void (*func_image_set_borders) (void *im, int left, int right, int top, int bottom); - void (*func_image_draw) (void *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int cr, int cg, int cb, int ca); - void (*func_image_free) (void *im); - void (*func_flush_draw) (Display *disp, Imlib_Image dstim, Window w); - void (*func_init) (Display *disp, int screen, int colors); - int (*func_image_get_width) (void *im); - int (*func_image_get_height) (void *im); - void * (*func_text_font_new) (Display *disp, char *font, int size); - void (*func_text_font_free) (void *fn); - void (*func_text_draw) (void *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a); - void (*func_rectangle_draw) (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a); - void (*func_line_draw) (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a); - void (*func_gradient_draw) (void *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle); - void (*func_poly_draw) (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a); - void (*func_set_clip_rect) (int on, int x, int y, int w, int h, int r, int g, int b, int a); - void (*func_set_vis_cmap) (Visual *vis, Colormap cmap); - - if (!e) return NULL; - if ((e->current.render_method == RENDER_METHOD_IMAGE) && - (!e->current.image)) - return NULL; - if ((e->current.render_method != RENDER_METHOD_IMAGE) && - ((!e->current.display) || - (!e->current.visual) || - (!e->current.colormap) || - (!e->current.drawable))) - return NULL; - if ((!e->changed) || - (e->current.drawable_width <= 0) || - (e->current.drawable_height <= 0) || - (e->current.viewport.w <= 0) || - (e->current.viewport.h <= 0)) - return NULL; - - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - func_draw_add_rect = __evas_imlib_draw_add_rect; - func_image_new_from_file = __evas_imlib_image_new_from_file; - func_image_set_borders = __evas_imlib_image_set_borders; - func_image_draw = __evas_imlib_image_draw; - func_image_free = __evas_imlib_image_free; - func_flush_draw = __evas_imlib_flush_draw; - func_init = __evas_imlib_init; - func_image_get_width = __evas_imlib_image_get_width; - func_image_get_height = __evas_imlib_image_get_height; - func_text_font_new = __evas_imlib_text_font_new; - func_text_font_free = __evas_imlib_text_font_free; - func_text_draw = __evas_imlib_text_draw; - func_rectangle_draw = __evas_imlib_rectangle_draw; - func_line_draw = __evas_imlib_line_draw; - func_gradient_draw = __evas_imlib_gradient_draw; - func_poly_draw = __evas_imlib_poly_draw; - func_set_clip_rect = __evas_imlib_set_clip_rect; - func_set_vis_cmap = __evas_imlib_set_vis_cmap; - break; - case RENDER_METHOD_BASIC_HARDWARE: - func_draw_add_rect = __evas_x11_draw_add_rect; - func_image_new_from_file = __evas_x11_image_new_from_file; - func_image_set_borders = __evas_x11_image_set_borders; - func_image_draw = __evas_x11_image_draw; - func_image_free = __evas_x11_image_free; - func_flush_draw = __evas_x11_flush_draw; - func_init = __evas_x11_init; - func_image_get_width = __evas_x11_image_get_width; - func_image_get_height = __evas_x11_image_get_height; - func_text_font_new = __evas_x11_text_font_new; - func_text_font_free = __evas_x11_text_font_free; - func_text_draw = __evas_x11_text_draw; - func_rectangle_draw = __evas_x11_rectangle_draw; - func_line_draw = __evas_x11_line_draw; - func_gradient_draw = __evas_x11_gradient_draw; - func_poly_draw = __evas_x11_poly_draw; - func_set_clip_rect = __evas_x11_set_clip_rect; - func_set_vis_cmap = __evas_x11_set_vis_cmap; - break; -#ifdef HAVE_GL - case RENDER_METHOD_3D_HARDWARE: - func_draw_add_rect = __evas_gl_draw_add_rect; - func_image_new_from_file = __evas_gl_image_new_from_file; - func_image_set_borders = __evas_gl_image_set_borders; - func_image_draw = __evas_gl_image_draw; - func_image_free = __evas_gl_image_free; - func_flush_draw = __evas_gl_flush_draw; - func_init = __evas_gl_init; - func_image_get_width = __evas_gl_image_get_width; - func_image_get_height = __evas_gl_image_get_height; - func_text_font_new = __evas_gl_text_font_new; - func_text_font_free = __evas_gl_text_font_free; - func_text_draw = __evas_gl_text_draw; - func_rectangle_draw = __evas_gl_rectangle_draw; - func_line_draw = __evas_gl_line_draw; - func_gradient_draw = __evas_gl_gradient_draw; - func_poly_draw = __evas_gl_poly_draw; - func_set_clip_rect = __evas_gl_set_clip_rect; - func_set_vis_cmap = __evas_gl_set_vis_cmap; - break; -#endif -#ifdef HAVE_RENDER - case RENDER_METHOD_ALPHA_HARDWARE: - func_draw_add_rect = __evas_render_draw_add_rect; - func_image_new_from_file = __evas_render_image_new_from_file; - func_image_set_borders = __evas_render_image_set_borders; - func_image_draw = __evas_render_image_draw; - func_image_free = __evas_render_image_free; - func_flush_draw = __evas_render_flush_draw; - func_init = __evas_render_init; - func_image_get_width = __evas_render_image_get_width; - func_image_get_height = __evas_render_image_get_height; - func_text_font_new = __evas_render_text_font_new; - func_text_font_free = __evas_render_text_font_free; - func_text_draw = __evas_render_text_draw; - func_rectangle_draw = __evas_render_rectangle_draw; - func_line_draw = __evas_render_line_draw; - func_gradient_draw = __evas_render_gradient_draw; - func_poly_draw = __evas_render_poly_draw; - func_set_clip_rect = __evas_render_set_clip_rect; - func_set_vis_cmap = __evas_render_set_vis_cmap; - break; -#endif - case RENDER_METHOD_IMAGE: - func_draw_add_rect = __evas_image_draw_add_rect; - func_image_new_from_file = __evas_image_image_new_from_file; - func_image_set_borders = __evas_image_image_set_borders; - func_image_draw = __evas_image_image_draw; - func_image_free = __evas_image_image_free; - func_flush_draw = __evas_image_flush_draw; - func_init = __evas_image_init; - func_image_get_width = __evas_image_image_get_width; - func_image_get_height = __evas_image_image_get_height; - func_text_font_new = __evas_image_text_font_new; - func_text_font_free = __evas_image_text_font_free; - func_text_draw = __evas_image_text_draw; - func_rectangle_draw = __evas_image_rectangle_draw; - func_line_draw = __evas_image_line_draw; - func_gradient_draw = __evas_image_gradient_draw; - func_poly_draw = __evas_image_poly_draw; - func_set_clip_rect = __evas_image_set_clip_rect; - func_set_vis_cmap = __evas_image_set_vis_cmap; - break; - default: - return; - break; - } - if ((e->current.viewport.x != e->previous.viewport.x) || - (e->current.viewport.y != e->previous.viewport.y)) - evas_update_rect(e, - 0, 0, - e->current.drawable_width, - e->current.drawable_height); - else if ((e->current.viewport.w != e->previous.viewport.w) || - (e->current.viewport.h != e->previous.viewport.h)) - { - if (((double)(e->current.viewport.w - e->previous.viewport.w) == - (double)(e->current.drawable_width - e->previous.drawable_width)) && - ((double)(e->current.viewport.h - e->previous.viewport.h) == - (double)(e->current.drawable_height - e->previous.drawable_height))) - { - if ((e->current.drawable_width > e->previous.drawable_width)) - evas_update_rect(e, - e->current.drawable_width, - 0, - e->current.drawable_width - e->previous.drawable_width, - e->current.drawable_height); - if ((e->current.drawable_width > e->previous.drawable_width) && - (e->current.drawable_height > e->previous.drawable_height)) - evas_update_rect(e, - e->current.drawable_width, - e->current.drawable_height, - e->current.drawable_width - e->previous.drawable_width, - e->current.drawable_height - e->previous.drawable_height); - if ((e->current.drawable_height > e->previous.drawable_height)) - evas_update_rect(e, - 0, - e->current.drawable_height, - e->current.drawable_width, - e->current.drawable_height - e->previous.drawable_height); - } - else - { - zoom_changed = 1; - evas_update_rect(e, - 0, 0, - e->current.drawable_width, - e->current.drawable_height); - } - } - else if ((e->current.drawable_width != e->previous.drawable_width) || - (e->current.drawable_height != e->previous.drawable_height)) - { - evas_update_rect(e, - 0, 0, - e->current.drawable_width, - e->current.drawable_height); - if (!(((((double)e->current.drawable_width / (double)e->current.viewport.w) - == - ((double)e->previous.drawable_width / (double)e->previous.viewport.w)) && - (((double)e->current.drawable_height / (double)e->current.viewport.h) - == - ((double)e->previous.drawable_height / (double)e->previous.viewport.h))))) - output_size_change = 1; - } - - e->changed = 0; - delete_objects = 0; - /* go thru layers & objects and add updates */ - for (l = e->layers; l; l = l->next) - { - Evas_Layer layer; - - layer = l->data; - - for (ll = layer->objects; ll; ll = ll->next) - { - Evas_Object_Any o; - int real_change, prop_change, clip_change, fill_change; - - real_change = 0; - prop_change = 0; - clip_change = 0; - fill_change = 0; - o = ll->data; - - if (o->delete_me) - delete_objects = evas_list_append(delete_objects, o); - if ((o->type == OBJECT_IMAGE) || - (o->type == OBJECT_TEXT)) - { - if ((!(RECTS_INTERSECT(o->current.x, o->current.y, - o->current.w, o->current.h, - e->current.viewport.x, e->current.viewport.y, - e->current.viewport.w, e->current.viewport.h))) - || (!o->current.visible)) - { - if (o->type == OBJECT_IMAGE) - { - if (o->renderer_data.method[e->current.render_method]) - { - func_image_free((void *)o->renderer_data.method[e->current.render_method]); - o->renderer_data.method[e->current.render_method] = NULL; - } - } - else if (o->type == OBJECT_TEXT) - { - if (o->renderer_data.method[e->current.render_method]) - { - func_text_font_free((void *)o->renderer_data.method[e->current.render_method]); - o->renderer_data.method[e->current.render_method] = NULL; - } - } - } - if ((o->type == OBJECT_TEXT) && (output_size_change)) - { - if (o->renderer_data.method[e->current.render_method]) - { - func_text_font_free((void *)o->renderer_data.method[e->current.render_method]); - o->renderer_data.method[e->current.render_method] = NULL; - } - } - if ((zoom_changed) && - (o->type == OBJECT_TEXT)) - { - if (o->renderer_data.method[e->current.render_method]) - { - func_text_font_free((void *)o->renderer_data.method[e->current.render_method]); - o->renderer_data.method[e->current.render_method] = NULL; - } - } - } - if (o->changed) - { - o->changed = 0; - if ((o->current.visible != o->previous.visible) || - ((o->current.visible) && - ((o->current.x != o->previous.x) || - (o->current.y != o->previous.y) || - (o->current.w != o->previous.w) || - (o->current.h != o->previous.h) || - (o->current.zoomscale != o->previous.zoomscale) || - (o->current.layer != o->previous.layer) || - (o->current.stacking) || - (o->clip.changed))) - ) - { - Evas_Object_Rectangle oo; - - oo = o; - if (((o->current.visible != o->previous.visible) || - ((o->current.visible) && - (o->current.zoomscale != o->previous.zoomscale) || - (o->current.layer != o->previous.layer) || - (o->current.stacking)))) - { - prop_change = 1; - } - if ((!prop_change) && - (o->type == OBJECT_RECTANGLE)) - { - if ((oo->current.r != oo->previous.r) || - (oo->current.g != oo->previous.g) || - (oo->current.b != oo->previous.b) || - (oo->current.a != oo->previous.a) - ) - { - prop_change = 1; - oo->previous = oo->current; - } - } - if ((o->type == OBJECT_RECTANGLE) && - (oo->current.a == oo->previous.a) && - (oo->current.a == 0) - ) - { - real_change = 0; - prop_change = 0; - } - else - { - real_change = 1; - clip_change = o->clip.changed; - } - } - - o->current.stacking = 0; - if ((!real_change) && (o->current.visible)) - { - switch (o->type) - { - case OBJECT_IMAGE: - { - Evas_Object_Image oo; - - oo = o; - if (((oo->current.file) && (!oo->previous.file)) || - ((!oo->current.file) && (oo->previous.file)) || - (oo->current.new_data) || - (oo->current.scale != oo->previous.scale) || - (oo->current.border.l != oo->previous.border.l) || - (oo->current.border.r != oo->previous.border.r) || - (oo->current.border.t != oo->previous.border.t) || - (oo->current.border.b != oo->previous.border.b) || - (oo->current.color.r != oo->previous.color.r) || - (oo->current.color.g != oo->previous.color.g) || - (oo->current.color.b != oo->previous.color.b) || - (oo->current.color.a != oo->previous.color.a) - ) - { - if ((oo->current.color.a == oo->previous.color.a) && - (oo->current.color.a == 0) - ) - { - real_change = 0; - prop_change = 0; - } - else - { - prop_change = 1; - } - } - if ((oo->current.fill.x != oo->previous.fill.x) || - (oo->current.fill.y != oo->previous.fill.y) || - (oo->current.fill.w != oo->previous.fill.w) || - (oo->current.fill.h != oo->previous.fill.h)) - { - if (!((oo->current.color.a == oo->previous.color.a) && - (oo->current.color.a == 0))) - fill_change = 1; - } - oo->current.new_data = 0; - /*oo->previous = oo->current;*/ - } - break; - case OBJECT_TEXT: - { - Evas_Object_Text oo; - - oo = o; - if (((oo->current.text) && (!oo->previous.text)) || - ((oo->current.font) && (!oo->previous.font)) || - (oo->current.size != oo->previous.size) || - (oo->current.r != oo->previous.r) || - (oo->current.g != oo->previous.g) || - (oo->current.b != oo->previous.b) || - (oo->current.a != oo->previous.a) - ) - { - if ((oo->current.a == oo->previous.a) && - (oo->current.a == 0) - ) - { - real_change = 0; - prop_change = 0; - } - else - prop_change = 1; - } - oo->previous = oo->current; - } - break; - case OBJECT_RECTANGLE: - { - Evas_Object_Rectangle oo; - - oo = o; - if ((oo->current.r != oo->previous.r) || - (oo->current.g != oo->previous.g) || - (oo->current.b != oo->previous.b) || - (oo->current.a != oo->previous.a) - ) - { - if ((oo->current.a == oo->previous.a) && - (oo->current.a == 0) - ) - { - real_change = 0; - prop_change = 0; - } - else - { - real_change = 0; - prop_change = 1; - } - } - oo->previous = oo->current; - } - break; - case OBJECT_LINE: - { - Evas_Object_Line oo; - - oo = o; - if ((oo->current.x1 != oo->previous.x1) || - (oo->current.y1 != oo->previous.y1) || - (oo->current.x2 != oo->previous.x2) || - (oo->current.y2 != oo->previous.y2) || - (oo->current.r != oo->previous.r) || - (oo->current.g != oo->previous.g) || - (oo->current.b != oo->previous.b) || - (oo->current.a != oo->previous.a) - ) - { - if ((oo->current.a == oo->previous.a) && - (oo->current.a == 0) - ) - { - real_change = 0; - prop_change = 0; - } - else - real_change = 1; - } - oo->previous = oo->current; - } - break; - case OBJECT_GRADIENT_BOX: - { - Evas_Object_Gradient_Box oo; - - oo = o; - if ((oo->current.new_gradient) || - (oo->current.angle != oo->previous.angle)) - prop_change = 1; - oo->current.new_gradient = 0; - oo->previous = oo->current; - } - break; - case OBJECT_POLYGON: - { - Evas_Object_Poly oo; - - oo = o; - if ((oo->previous.points != oo->current.points) || - (oo->current.r != oo->previous.r) || - (oo->current.g != oo->previous.g) || - (oo->current.b != oo->previous.b) || - (oo->current.a != oo->previous.a)) - { - if ((oo->current.a == oo->previous.a) && - (oo->current.a == 0) - ) - { - real_change = 0; - prop_change = 0; - } - else - real_change = 1; - } - oo->previous = oo->current; - } - break; - default: - break; - } - } - } - if ((real_change) || (prop_change) || (fill_change)) - { - int x, y, w, h; - int img_tile_ch; - - img_tile_ch = 1; - if ((o->type == OBJECT_IMAGE) && (!prop_change)) - { - Evas_Object_Image oo; - double fx, fy, fxx, fyy; - - oo = o; - fx = oo->current.fill.x + o->current.x; - fy = oo->current.fill.y + o->current.y; - fxx = oo->previous.fill.x + o->previous.x; - fyy = oo->previous.fill.y + o->previous.y; - if ((oo->current.fill.w == oo->previous.fill.w) && - (oo->current.fill.h == oo->previous.fill.h) && - (fx == fxx) && (fy == fyy)) - img_tile_ch = 0; - } - - if (o->type == OBJECT_IMAGE) - { - Evas_Object_Image oo; - oo = o; - oo->previous = oo->current; - } - /* special case for rectangle since its all one color */ - if (((o->type == OBJECT_RECTANGLE) || (!img_tile_ch)) && - (!prop_change) && - (RECTS_INTERSECT(o->current.x, o->current.y, - o->current.w, o->current.h, - o->previous.x, o->previous.y, - o->previous.w, o->previous.h))) - { - int xx, yy, ww, hh; - int x1[4], y1[4], i, j; - Evas_List rl, rll; - Evas_Rectangle r; - - _evas_object_get_previous_translated_coords(e, o, - &x, &y, - &w, &h, - 1 - clip_change); - _evas_object_get_current_translated_coords(e, o, - &xx, &yy, - &ww, &hh, - 1 - clip_change); - rl = NULL; - if (x < xx) - { - x1[0] = x; - x1[1] = xx; - } - else - { - x1[0] = xx; - x1[1] = x; - } - if ((x + w) < (xx + ww)) - { - x1[2] = x + w; - x1[3] = xx + ww; - } - else - { - x1[2] = xx + ww; - x1[3] = x + w; - } - if (y < yy) - { - y1[0] = y; - y1[1] = yy; - } - else - { - y1[0] = yy; - y1[1] = y; - } - if ((y + h) < (yy + hh)) - { - y1[2] = y + h; - y1[3] = yy + hh; - } - else - { - y1[2] = yy + hh; - y1[3] = y + h; - } - for (j = 0; j < 3; j++) - { - for (i = 0; i < 3; i++) - { - r = malloc(sizeof(struct _Evas_Rectangle)); - rl = evas_list_append(rl, r); - r->x = x1[i]; - r->y = y1[j]; - r->w = x1[i + 1] - x1[i]; - r->h = y1[j + 1] - y1[j]; - } - } - if (rl) - { - for (rll = rl; rll; rll = rll->next) - { - r = rll->data; - if ((r->w > 0) && (r->h > 0)) - { - int intsec1, intsec2; - - intsec1 = 0; - intsec2 = 0; - if (RECTS_INTERSECT(r->x, r->y, r->w, r->h, - x, y, w, h)) - intsec1 = 1; - if (RECTS_INTERSECT(r->x, r->y, r->w, r->h, - xx, yy, ww, hh)) - intsec2 = 1; - if ((intsec1 ^ intsec2)) - evas_update_rect(e, r->x, r->y, r->w, r->h); - } - free(r); - } - evas_list_free(rl); - } - } - else - { - _evas_object_get_previous_translated_coords(e, o, - &x, &y, - &w, &h, - 1 - clip_change); - evas_update_rect(e, x, y, w, h); - _evas_object_get_current_translated_coords(e, o, - &x, &y, - &w, &h, - 1 - clip_change); - evas_update_rect(e, x, y, w, h); - } - } - o->previous = o->current; - } - } - - if (delete_objects) - { - for (l = delete_objects; l; l = l->next) - _evas_real_del_object(e, l->data); - evas_list_free(delete_objects); - } - - func_init(e->current.display, e->current.screen, e->current.colors); - up = NULL; - if (e->updates) - { - _evas_clip_obscures(e); - up = imlib_updates_merge_for_rendering(e->updates, - e->current.drawable_width, - e->current.drawable_height); - e->updates = NULL; - if (up) - { - Imlib_Updates u; - - u = up; - while (u) - { - int x, y, w, h; - - imlib_updates_get_coordinates(u, &x, &y, &w, &h); - func_draw_add_rect(e->current.display, - e->current.image, - e->current.drawable, - x, y, w, h); - u = imlib_updates_get_next(u); - } - /* draw all objects now */ - func_set_vis_cmap(e->current.visual, e->current.colormap); - for (l = e->layers; l; l = l->next) - { - Evas_Layer layer; - - layer = l->data; - for (ll = layer->objects; ll; ll = ll->next) - { - Evas_Object_Any o; - - o = ll->data; - if (o->current.visible) - { - int x, y, w, h; - - _evas_object_get_current_translated_coords(e, o, - &x, &y, - &w, &h, - 1 - o->clip.changed); - o->clip.changed = 0; - if (RECTS_INTERSECT(0, 0, - e->current.drawable_width, - e->current.drawable_height, - x, y, w, h) && - (!o->clip.list)) - { - if (!o->clip.changed) - _evas_object_get_current_translated_coords(e, o, - &x, &y, - &w, &h, - 0); - if (o->clip.object) - { - Evas_Object_Rectangle oo; - int clr, clg, clb, cla; - int clx, cly, clw, clh; - - clr = 255; - clg = 255; - clb = 255; - cla = 255; - if (o->clip.object->type == OBJECT_RECTANGLE) - { - oo = o->clip.object; - - clr = oo->current.r; - clg = oo->current.g; - clb = oo->current.b; - cla = oo->current.a; - } - _evas_object_get_current_translated_coords(e, o, - &clx, &cly, - &clw, &clh, - 1); - if ((clw > 1) && (clh > 1)) - func_set_clip_rect(1, clx, cly, clw, clh, clr, clg, clb, cla); - else - func_set_clip_rect(1, e->current.drawable_width + 1, e->current.drawable_height + 1, 1, 1, 255, 255, 255, 255); - } - else - func_set_clip_rect(0, 0, 0, 0, 0, 255, 255, 255, 255); - switch (o->type) - { - case OBJECT_IMAGE: - { - Evas_Object_Image oo; - void *im; - - oo = o; - im = NULL; - if (oo->current.file) - { - if (o->renderer_data.method[e->current.render_method]) - im = (void *)o->renderer_data.method[e->current.render_method]; - else - o->renderer_data.method[e->current.render_method] = - im = - func_image_new_from_file(e->current.display, oo->current.file); - } - if (im) - { - int visx, visy, visw, vish; - int tilex, tiley, tilew, tileh; - struct _points - { - int out1, out2; - int in1, in2; - } *pointsx, *pointsy; - int xx, yy, ww, hh; - - visx = x; - visw = w; - if (x < 0) - { - visx = 0; - visw += x; - } - if ((visx + visw) > e->current.drawable_width) - visw = e->current.drawable_width - visx; - tilex = ((-oo->current.fill.x * (double)e->current.drawable_width) / - e->current.viewport.w); - tilew = ((oo->current.fill.w * (double)e->current.drawable_width) / - e->current.viewport.w); - if (tilew < 1) tilew = 1; - tilex = (((tilex - (x - visx)) % tilew) + tilew) % tilew; - if (tilex == 0) ww = 1 + (visw - 1) / tilew; - else ww = 1 + ((visw + tilex) / tilew); - - pointsx = malloc(ww * sizeof(struct _points)); - for (xx = 0; xx < ww; xx++) - { - if (xx == 0) - { - if (xx == (ww - 1)) /* | * | */ - { - pointsx[xx].out1 = visx + 0; - pointsx[xx].out2 = visw; - pointsx[xx].in1 = (int)(((double)tilex * - (double)oo->current.image.w) / - (double)tilew); - pointsx[xx].in2 = (int)(((double)func_image_get_width(im) * - (double)visw) / - (double)tilew); - } - else /* | * | | | */ - { - pointsx[xx].out1 = visx + 0; - pointsx[xx].out2 = tilew - tilex; - pointsx[xx].in1 = (int)(((double)tilex * - (double)oo->current.image.w) / - (double)tilew); - pointsx[xx].in2 = func_image_get_width(im) - pointsx[xx].in1; - } - } - else - { - if (xx == (ww - 1)) /* | | | * | */ - { - pointsx[xx].out1 = visx + (xx * tilew) - tilex; - pointsx[xx].out2 = visw - (pointsx[xx].out1 - visx); - pointsx[xx].in1 = 0; - pointsx[xx].in2 = (int)(((double)pointsx[xx].out2 * - (double)oo->current.image.w) / - (double)tilew); - } - else /* | | * | | */ - { - pointsx[xx].out1 = visx + (xx * tilew) - tilex; - pointsx[xx].out2 = tilew; - pointsx[xx].in1 = 0; - pointsx[xx].in2 = func_image_get_width(im); - } - } - } - - visy = y; - vish = h; - if (y < 0) - { - visy = 0; - vish += y; - } - if ((visy + vish) > e->current.drawable_height) vish = e->current.drawable_height - visy; - tiley = (-oo->current.fill.y * (double)e->current.drawable_height) / e->current.viewport.h; - tileh = (oo->current.fill.h * (double)e->current.drawable_height) / e->current.viewport.h; - if (tileh < 1) tileh = 1; - tiley = (((tiley - (y - visy)) % tileh) + tileh) % tileh; - if (tiley == 0) hh = 1 + (vish - 1) / tileh; - else hh = 1 + ((vish + tiley) / tileh); - - pointsy = malloc(hh * sizeof(struct _points)); - for (yy = 0; yy < hh; yy++) - { - if (yy == 0) - { - if (yy == (hh - 1)) /* | * | */ - { - pointsy[yy].out1 = visy + 0; - pointsy[yy].out2 = vish; - pointsy[yy].in1 = (int)(((double)tiley * - (double)oo->current.image.h) / - (double)tileh); - pointsy[yy].in2 = (int)(((double)func_image_get_height(im) * - (double)vish) / - (double)tileh); - } - else /* | * | | | */ - { - pointsy[yy].out1 = visy + 0; - pointsy[yy].out2 = tileh - tiley; - pointsy[yy].in1 = (int)(((double)tiley * - (double)oo->current.image.h) / - (double)tileh); - pointsy[yy].in2 = func_image_get_height(im) - pointsy[yy].in1; - } - } - else - { - if (yy == (hh - 1)) /* | | | * | */ - { - pointsy[yy].out1 = visy + (yy * tileh) - tiley; - pointsy[yy].out2 = vish - (pointsy[yy].out1 - visy); - pointsy[yy].in1 = 0; - pointsy[yy].in2 = (int)(((double)pointsy[yy].out2 * - (double)oo->current.image.h) / - (double)tileh); - } - else /* | | * | | */ - { - pointsy[yy].out1 = visy + (yy * tileh) - tiley; - pointsy[yy].out2 = tileh; - pointsy[yy].in1 = 0; - pointsy[yy].in2 = func_image_get_height(im); - } - } - } - func_image_set_borders(im, - oo->current.border.l, - oo->current.border.r, - oo->current.border.t, - oo->current.border.b); - for (yy = 0; yy < hh; yy++) - { - for (xx = 0; xx < ww; xx++) - { - func_image_draw(im, - e->current.display, - e->current.image, - e->current.drawable, - e->current.drawable_width, - e->current.drawable_height, - pointsx[xx].in1, pointsy[yy].in1, - pointsx[xx].in2, pointsy[yy].in2, - pointsx[xx].out1, pointsy[yy].out1, - pointsx[xx].out2, pointsy[yy].out2, - oo->current.color.r, - oo->current.color.g, - oo->current.color.b, - oo->current.color.a); - } - } - free(pointsx); - free(pointsy); -/* func_image_free(im);*/ - } - } - break; - case OBJECT_TEXT: - { - Evas_Object_Text oo; - void *fn; - - oo = o; - if (o->renderer_data.method[e->current.render_method]) - fn = (void *)o->renderer_data.method[e->current.render_method]; - else - o->renderer_data.method[e->current.render_method] = fn = func_text_font_new(e->current.display, oo->current.font, - (oo->current.size * (double)e->current.drawable_width) / e->current.viewport.w); - if (fn) - { - func_text_draw(fn, - e->current.display, - e->current.image, - e->current.drawable, - e->current.drawable_width, - e->current.drawable_height, - ((o->current.x - e->current.viewport.x) * - (double)e->current.drawable_width) / - e->current.viewport.w, - ((o->current.y - e->current.viewport.y) * - (double)e->current.drawable_height) / - e->current.viewport.h, - oo->current.text, - oo->current.r, - oo->current.g, - oo->current.b, - oo->current.a); -/* func_text_font_free(fn);*/ - } - } - break; - case OBJECT_RECTANGLE: - { - Evas_Object_Rectangle oo; - - oo = o; - if (oo->current.a != 0) - func_rectangle_draw(e->current.display, - e->current.image, - e->current.drawable, - e->current.drawable_width, - e->current.drawable_height, - ((o->current.x - e->current.viewport.x) * - (double)e->current.drawable_width) / - e->current.viewport.w, - ((o->current.y - e->current.viewport.y) * - (double)e->current.drawable_height) / - e->current.viewport.h, - (o->current.w * - (double)e->current.drawable_width) / - e->current.viewport.w, - (o->current.h * - (double)e->current.drawable_height) / - e->current.viewport.h, - oo->current.r, - oo->current.g, - oo->current.b, - oo->current.a); - } - break; - case OBJECT_LINE: - { - Evas_Object_Line oo; - - oo = o; - func_line_draw(e->current.display, - e->current.image, - e->current.drawable, - e->current.drawable_width, - e->current.drawable_height, - (oo->current.x1 * - (double)e->current.drawable_width) / - e->current.viewport.w, - (oo->current.y1 * - (double)e->current.drawable_height) / - e->current.viewport.h, - (oo->current.x2 * - (double)e->current.drawable_width) / - e->current.viewport.w, - (oo->current.y2 * - (double)e->current.drawable_height) / - e->current.viewport.h, - oo->current.r, - oo->current.g, - oo->current.b, - oo->current.a); - } - break; - case OBJECT_GRADIENT_BOX: - { - Evas_Object_Gradient_Box oo; - - oo = o; - if (o->renderer_data.method[e->current.render_method]) - func_gradient_draw(o->renderer_data.method[e->current.render_method], - e->current.display, - e->current.image, - e->current.drawable, - e->current.drawable_width, - e->current.drawable_height, - ((o->current.x - e->current.viewport.x) * - (double)e->current.drawable_width) / - e->current.viewport.w, - ((o->current.y - e->current.viewport.y) * - (double)e->current.drawable_height) / - e->current.viewport.h, - (o->current.w * - (double)e->current.drawable_width) / - e->current.viewport.w, - (o->current.h * - (double)e->current.drawable_height) / - e->current.viewport.h, - oo->current.angle); - } - break; - case OBJECT_POLYGON: - { - Evas_Object_Poly oo; - - oo = o; - - if (oo->current.points) - { - Evas_List points = NULL, pl; - - for (pl = oo->current.points; pl; pl = pl->next) - { - Evas_Point p1, p2; - - p1 = pl->data; - p2 = malloc(sizeof(struct _Evas_Point)); - - p2->x = ((p1->x - e->current.viewport.x) * - (double)e->current.drawable_width) / - e->current.viewport.w, - p2->y = ((p1->y - e->current.viewport.y) * - (double)e->current.drawable_height) / - e->current.viewport.h, - points = evas_list_append(points, p2); - } - func_poly_draw(e->current.display, - e->current.image, - e->current.drawable, - e->current.drawable_width, - e->current.drawable_height, - points, - oo->current.r, - oo->current.g, - oo->current.b, - oo->current.a); - for (pl = points; pl; pl = pl->next) - free(pl->data); - evas_list_free(points); - } - } - break; - default: - break; - } - } - } - } - } - func_flush_draw(e->current.display, e->current.image, e->current.drawable); - } - } - e->previous = e->current; - return up; -} - -/* query for settings to use */ -Visual * -evas_get_optimal_visual(Evas e, Display *disp) -{ - if (!e) return NULL; - if (!disp) return NULL; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - if (__evas_imlib_capable(disp)) - return __evas_imlib_get_visual(disp, e->current.screen); - else - { - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - if (__evas_x11_capable(disp)) - return __evas_x11_get_visual(disp, e->current.screen); - else - { - } - break; - case RENDER_METHOD_3D_HARDWARE: - if (__evas_gl_capable(disp)) - return __evas_gl_get_visual(disp, e->current.screen); - else - { - e->current.render_method = RENDER_METHOD_ALPHA_SOFTWARE; - return evas_get_optimal_visual(e, disp); - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - if (__evas_render_capable(disp)) - return __evas_render_get_visual(disp, e->current.screen); - else - { - e->current.render_method = RENDER_METHOD_ALPHA_SOFTWARE; - return evas_get_optimal_visual(e, disp); - } - break; - case RENDER_METHOD_IMAGE: - if (__evas_image_capable(disp)) - return __evas_image_get_visual(disp, e->current.screen); - else - { - } - break; - default: - return NULL; - break; - } - return NULL; -} - -Colormap -evas_get_optimal_colormap(Evas e, Display *disp) -{ - if (!e) return 0; - if (!disp) return 0; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - if (__evas_imlib_capable(disp)) - return __evas_imlib_get_colormap(disp, e->current.screen); - else - { - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - if (__evas_x11_capable(disp)) - return __evas_x11_get_colormap(disp, e->current.screen); - else - { - } - break; - case RENDER_METHOD_3D_HARDWARE: - if (__evas_gl_capable(disp)) - return __evas_gl_get_colormap(disp, e->current.screen); - else - { - e->current.render_method = RENDER_METHOD_ALPHA_SOFTWARE; - return evas_get_optimal_colormap(e, disp); - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - if (__evas_render_capable(disp)) - return __evas_render_get_colormap(disp, e->current.screen); - else - { - e->current.render_method = RENDER_METHOD_ALPHA_SOFTWARE; - return evas_get_optimal_colormap(e, disp); - } - break; - case RENDER_METHOD_IMAGE: - if (__evas_image_capable(disp)) - return __evas_image_get_colormap(disp, e->current.screen); - else - { - } - break; - default: - return 0; - break; - } - return 0; -} - -void -evas_get_drawable_size(Evas e, int *w, int *h) -{ - if (!e) return; - if (w) *w = e->current.drawable_width; - if (h) *h = e->current.drawable_height; -} - -void -evas_get_viewport(Evas e, double *x, double *y, double *w, double *h) -{ - if (!e) return; - if (x) *x = e->current.viewport.x; - if (y) *y = e->current.viewport.y; - if (w) *w = e->current.viewport.w; - if (h) *h = e->current.viewport.h; -} - -/* the output settings */ -void -evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c) -{ - if (!e) return; - e->current.display = disp; - e->current.drawable = d; - e->current.visual = v; - e->current.colormap = c; - e->changed = 1; -} - -void -evas_set_output_image(Evas e, Imlib_Image image) -{ - if (!e) return; - e->current.image = image; - e->changed = 1; -} - -void -evas_set_output_colors(Evas e, int colors) -{ - if (!e) return; - if (colors < 2) colors = 1; - else if (colors > 256) colors = 256; - e->current.colors = colors; - e->changed = 1; -} - -void -evas_set_output_size(Evas e, int w, int h) -{ - if (!e) return; - if (w < 1) w = 1; - if (h < 1) h = 1; - if ((e->current.drawable_width == w) && (e->current.drawable_height == h)) return; - e->current.drawable_width = w; - e->current.drawable_height = h; - e->current.val_cache.mult_x = (double)e->current.drawable_width / e->current.viewport.w; - e->current.val_cache.mult_y = (double)e->current.drawable_height / e->current.viewport.h; - e->changed = 1; -} - -void -evas_set_output_viewport(Evas e, double x, double y, double w, double h) -{ - if (!e) return; - if (w < 1) w = 1; - if (h < 1) h = 1; - if ((e->current.viewport.x == x) && (e->current.viewport.y == y) && - (e->current.viewport.w == w) && (e->current.viewport.w == h)) return; - e->current.viewport.x = x; - e->current.viewport.y = y; - e->current.viewport.w = w; - e->current.viewport.h = h; - e->current.val_cache.mult_x = (double)e->current.drawable_width / e->current.viewport.w; - e->current.val_cache.mult_y = (double)e->current.drawable_height / e->current.viewport.h; - e->changed = 1; -} - -void -evas_set_output_method(Evas e, Evas_Render_Method method) -{ - if (!e) return; - if ((method != RENDER_METHOD_ALPHA_SOFTWARE) && - (method != RENDER_METHOD_BASIC_HARDWARE) && - (method != RENDER_METHOD_3D_HARDWARE) && - (method != RENDER_METHOD_ALPHA_HARDWARE) && - (method != RENDER_METHOD_IMAGE)) - return; - if (!e->current.display) - { - e->current.render_method = method; - e->changed = 1; - } -} - -void -evas_set_scale_smoothness(Evas e, int smooth) -{ - if (!e) return; - if (smooth <= 0) smooth = 0; - else smooth = 1; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - __evas_imlib_image_set_smooth_scaling(smooth); - break; - case RENDER_METHOD_BASIC_HARDWARE: - __evas_x11_image_set_smooth_scaling(smooth); - break; - case RENDER_METHOD_3D_HARDWARE: - __evas_gl_image_set_smooth_scaling(smooth); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - __evas_render_image_set_smooth_scaling(smooth); - break; - case RENDER_METHOD_IMAGE: - __evas_image_image_set_smooth_scaling(smooth); - break; - default: - return; - break; - } -} diff --git a/legacy/evas/src/evas_render_routines.c b/legacy/evas/src/evas_render_routines.c deleted file mode 100644 index ab1a42bd1f..0000000000 --- a/legacy/evas/src/evas_render_routines.c +++ /dev/null @@ -1,1411 +0,0 @@ -#include "evas_render_routines.h" -#include "evas_fileless_image.h" - - -#ifdef HAVE_RENDER - -static void __evas_render_image_cache_flush(Display *disp); -static int __evas_anti_alias = 1; -static Evas_List drawable_list = NULL; - -/* the current clip region and color */ -static int __evas_clip = 0; -static int __evas_clip_x = 0; -static int __evas_clip_y = 0; -static int __evas_clip_w = 0; -static int __evas_clip_h = 0; -static int __evas_clip_r = 0; -static int __evas_clip_g = 0; -static int __evas_clip_b = 0; -static int __evas_clip_a = 0; - -/*****************************************************************************/ -/* image internals ***********************************************************/ -/*****************************************************************************/ - -static void -__evas_render_image_cache_flush(Display *disp) -{ - int size; - - size = imlib_get_cache_size(); - imlib_set_cache_size(0); - imlib_set_cache_size(size); -} - -static char x_does_shm = -1; -static int list_num = 0; -static XImage **list_xim = NULL; -static XShmSegmentInfo **list_si = NULL; -static Display **list_d = NULL; -static char *list_used = NULL; -static int list_mem_use = 0; -static int list_max_mem = 0; -static int list_max_count = 0; -static char _x_err = 0; - -static Visual *__evas_visual = NULL; -static Colormap __evas_cmap = 0; - -/* the fucntion we use for catching the error */ -static void -__evas_render_image_ximage_tmp_x_error(Display * d, XErrorEvent * ev) -{ - _x_err = 1; - return; - d = NULL; - ev = NULL; -} - -static void -__evas_render_image_ximage_flush(Display *d) -{ - int i; - XImage *xim; - char did_free = 1; - - while (((list_mem_use > list_max_mem) || (list_num > list_max_count)) && - (did_free)) - { - did_free = 0; - for (i = 0; i < list_num; i++) - { - if (list_used[i] == 0) - { - int j; - - xim = list_xim[i]; - list_mem_use -= xim->bytes_per_line * xim->height; - if (list_si[i]) - XShmDetach(d, list_si[i]); - XDestroyImage(xim); - if (list_si[i]) - { - shmdt(list_si[i]->shmaddr); - shmctl(list_si[i]->shmid, IPC_RMID, 0); - free(list_si[i]); - } - list_num--; - for (j = i; j < list_num; j++) - { - list_xim[j] = list_xim[j + 1]; - list_si[j] = list_si[j + 1]; - list_used[j] = list_used[j + 1]; - list_d[j] = list_d[j + 1]; - } - if (list_num == 0) - { - if (list_xim) free(list_xim); - if (list_si) free(list_si); - if (list_used) free(list_used); - if (list_d) free(list_d); - list_xim = NULL; - list_si = NULL; - list_used = NULL; - list_d = NULL; - } - else - { - list_xim = realloc(list_xim, sizeof(XImage *) * list_num); - list_si = realloc(list_si, sizeof(XShmSegmentInfo *) * list_num); - list_used = realloc(list_used, sizeof(char) * list_num); - list_d = realloc(list_d, sizeof(Display *) * list_num); - } - did_free = 1; - } - } - } -} - -XImage * -__evas_render_image_ximage_new(Display *d, Visual *v, int depth, int w, int h, char *shared) -{ - XImage *xim; - int i; - - if (x_does_shm < 0) - { - if (XShmQueryExtension(d)) - x_does_shm = 1; - else - x_does_shm = 0; - } - *shared = 0; - for (i = 0; i < list_num; i++) - { - if ((list_xim[i]->bits_per_pixel == depth) && - (list_xim[i]->width >= w) && - (list_xim[i]->height >= h) && - (!list_used[i])) - { - list_used[i] = 1; - if (list_si[i]) - *shared = 1; - return list_xim[i]; - } - } - list_num++; - if (list_num == 1) - { - list_xim = malloc(sizeof(XImage *) * list_num); - list_si = malloc(sizeof(XShmSegmentInfo *) * list_num); - list_used = malloc(sizeof(char) * list_num); - list_d = malloc(sizeof(Display *) * list_num); - } - else - { - list_xim = realloc(list_xim, sizeof(XImage *) * list_num); - list_si = realloc(list_si, sizeof(XShmSegmentInfo *) * list_num); - list_used = realloc(list_used, sizeof(char) * list_num); - list_d = realloc(list_d, sizeof(Display *) * list_num); - } - list_si[list_num - 1] = malloc(sizeof(XShmSegmentInfo)); - - xim = NULL; - if (x_does_shm) - { - xim = XShmCreateImage(d, v, depth, ZPixmap, NULL, - list_si[list_num - 1], w, h); - if (xim) - { - list_xim[list_num - 1] = xim; - list_si[list_num - 1]->shmid = - shmget(IPC_PRIVATE, xim->bytes_per_line * xim->height, - IPC_CREAT | 0777); - if (list_si[list_num - 1]->shmid != -1) - { - list_si[list_num - 1]->readOnly = False; - list_si[list_num - 1]->shmaddr = xim->data = - shmat(list_si[list_num - 1]->shmid, 0, 0); - if (xim->data != (char *)-1) - { - XErrorHandler ph; - - _x_err = 0; - ph = XSetErrorHandler((XErrorHandler) __evas_render_image_ximage_tmp_x_error); - XShmAttach(d, list_si[list_num - 1]); - XSync(d, False); - XSetErrorHandler((XErrorHandler) ph); - if (!_x_err) - { - list_used[list_num - 1] = 1; - list_mem_use += xim->bytes_per_line * xim->height; - *shared = 1; - } - else - { - x_does_shm = 0; - XDestroyImage(xim); - shmdt(list_si[list_num - 1]->shmaddr); - shmctl(list_si[list_num - 1]->shmid, IPC_RMID, 0); - xim = NULL; - } - } - else - { - XDestroyImage(xim); - shmctl(list_si[list_num - 1]->shmid, IPC_RMID, 0); - xim = NULL; - } - } - else - { - XDestroyImage(xim); - xim = NULL; - } - } - } - if (!xim) - { - free(list_si[list_num - 1]); - list_si[list_num - 1] = NULL; - xim = XCreateImage(d, v, depth, ZPixmap, 0, NULL, w, h, 32, 0); - xim->data = malloc(xim->bytes_per_line * xim->height); - list_xim[list_num - 1] = xim; - list_mem_use += xim->bytes_per_line * xim->height; - list_used[list_num - 1] = 1; - list_d[list_num - 1] = d; - } - __evas_render_image_ximage_flush(d); - return xim; -} - - -static void -__evas_render_image_ximage_free(Display *d, XImage *xim) -{ - int i; - - for (i = 0; i < list_num; i++) - { - if (list_xim[i] == xim) - { - list_used[i] = 0; - __evas_render_image_ximage_flush(d); - return; - } - } -} - -static void -__evas_render_image_ximage_put(Display *d, Drawable dst, GC gc, XImage *xim, - int sx, int sy, int dx, int dy, int w, int h, - int shm) -{ - if (shm) - XShmPutImage(d, dst, gc, xim, sx, sy, dx, dy, w, h, False); - else - XPutImage(d, dst, gc, xim, sx, sy, dx, dy, w, h); - if (shm) - XSync(d, False); -} - - -static Picture -__evas_render_create_picuture(Display *d, Drawable dst, - XRenderPictFormat *format) -{ - Picture pic; - XRenderPictureAttributes att; - - att.repeat = True; - att.dither = True; - att.component_alpha = True; - pic = XRenderCreatePicture (d, dst, format, -/* - CPRepeat | - CPDither | - CPComponentAlpha, - */ - 0, - &att); - return pic; -} - -static void -__evas_render_populate_update(Evas_Render_Update *up) -{ - XRenderPictFormat fmt, *format, *format_color; - Visual *visual; - int screen; - - screen = 0; - visual = __evas_visual; - format = XRenderFindVisualFormat (up->disp, visual); - if (!format) printf("eek no format!\n"); - fmt.depth = 32; - fmt.type = PictTypeDirect; - format_color = XRenderFindFormat(up->disp, PictFormatType | PictFormatDepth, - &fmt, 0); - if (!format_color) printf("eek no format_color\n"); - up->pmap = XCreatePixmap (up->disp, up->drawable, - up->w, up->h, fmt.depth); - up->pic = __evas_render_create_picuture(up->disp, up->pmap, format_color); -} - -static void -__evas_render_dump_current_image_to_pixmap(Display *disp, Pixmap pmap, - Visual *v, int depth, int w, int h) -{ - DATA32 *data, *buf; - int x, y; - XImage *xim; - char shm; - static GC gc = 0; - XGCValues gcv; - int has_alpha; - - data = imlib_image_get_data_for_reading_only(); - shm = 0; - xim = __evas_render_image_ximage_new(disp, v, depth, w, h, &shm); - if (!xim) return; - if (!gc) - { - gcv.graphics_exposures = False; - gc = XCreateGC(disp, pmap, GCGraphicsExposures, &gcv); - } - has_alpha = imlib_image_has_alpha(); - if (has_alpha) - { - for (y = 0; y < h; y++) - { - buf = xim->data + (y * (xim->bytes_per_line)); - for (x = 0; x < w; x++) - { - int r, g, b, a; - - r = ((*data) >> 16) & 0xff; - g = ((*data) >> 8 ) & 0xff; - b = ((*data) ) & 0xff; - a = ((*data) >> 24) & 0xff; - r = (r * a) / 255; - g = (g * a) / 255; - b = (b * a) / 255; - - *buf = (a << 24) | (r << 16) | (g << 8) | b; - buf++; - data++; - } - } - } - else - { - for (y = 0; y < h; y++) - { - buf = xim->data + (y * (xim->bytes_per_line)); - for (x = 0; x < w; x++) - { - int r, g, b, a; - - r = ((*data) >> 16) & 0xff; - g = ((*data) >> 8 ) & 0xff; - b = ((*data) ) & 0xff; - a = 255; - *buf = (a << 24) | (r << 16) | (g << 8) | b; - buf++; - data++; - } - } - } - __evas_render_image_ximage_put(disp, pmap, gc, xim, 0, 0, 0, 0, w, h, shm); - __evas_render_image_ximage_free(disp, xim); - imlib_image_put_back_data(data); -} - -static int -__evas_render_create_dest_buf(Display *disp, Visual *v, int w, int h, - int screen, Pixmap *pmap_ret, Picture *pic_ret) -{ - XRenderPictFormat fmt, *format, *format_color; - - format = XRenderFindVisualFormat(disp, v); - if (!format) printf("eek no format!\n"); - fmt.depth = 32; - fmt.type = PictTypeDirect; - format_color = XRenderFindFormat(disp, PictFormatType | PictFormatDepth, - &fmt, 0); - if (!format_color) printf("eek no format_color\n"); - *pmap_ret = XCreatePixmap(disp, RootWindow(disp, screen), w, h, fmt.depth); - *pic_ret = __evas_render_create_picuture(disp, *pmap_ret, format_color); - return format_color->depth; -} - -/*****************************************************************************/ -/* image externals ***********************************************************/ -/*****************************************************************************/ - -Evas_Render_Image * -__evas_render_image_new_from_file(Display *disp, char *file) -{ - Evas_Render_Image *im; - Imlib_Image i; - int screen, depth; - - /* need to look for image i local cache */ - /* not found - load */ - screen = 0; - i = _evas_find_fileless_image(file); - if (!i) - i = imlib_load_image(file); - if (!i) return NULL; - imlib_context_set_image(i); - im = malloc(sizeof(Evas_Render_Image)); - memset(im, 0, sizeof(Evas_Render_Image)); - im->image = i; - im->file = malloc(strlen(file) + 1); - strcpy(im->file, file); - im->references = 1; - im->disp = disp; - im->has_alpha = imlib_image_has_alpha(); - im->w = imlib_image_get_width(); - im->h = imlib_image_get_height(); -/* - depth = __evas_render_create_dest_buf(disp, __evas_visual, im->w, im->h, - screen, &(im->pmap), &(im->pic)); - __evas_render_dump_current_image_to_pixmap(disp, im->pmap, __evas_visual, - depth, im->w, im->h); -*/ - /* need to add to local cache list */ - return im; -} - -void -__evas_render_image_free(Evas_Render_Image *im) -{ - im->references--; - if (im->references <= 0) - { - /* need to flush cache */ - } -} - -void -__evas_render_image_cache_empty(Display *disp) -{ - int size; - - size = imlib_get_cache_size(); - imlib_set_cache_size(0); - imlib_set_cache_size(size); -} - -void -__evas_render_image_cache_set_size(Display *disp, int size) -{ - imlib_set_cache_size(size); -} - -int -__evas_render_image_cache_get_size(Display *disp) -{ - return imlib_get_cache_size(); -} - -void -__evas_render_image_draw(Evas_Render_Image *im, - Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, - int src_x, int src_y, int src_w, int src_h, - int dst_x, int dst_y, int dst_w, int dst_h, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - - if (ca == 0) return; - if ((src_w == 0) || (src_h == 0) || (dst_w == 0) || (dst_w == 0)) return; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca == 0) return; - for(l = drawable_list; l; l = l->next) - { - Evas_Render_Drawable *dr; - - dr = l->data; - - if ((dr->win == w) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Render_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - dst_x, dst_y, dst_w, dst_h)) - { - int xx, yy, ww, hh, iw, ih, dx, dy, dw, dh; - - if (!up->pmap) - __evas_render_populate_update(up); - dx = dst_x; - dy = dst_y; - dw = dst_w; - dh = dst_h; - iw = im->w; - ih = im->h; - ww = (iw * dw) / src_w; - hh = (ih * dh) / src_h; - xx = (src_x * dw) / src_w; - yy = (src_y * dh) / src_h; - if (__evas_clip) - { - int px, py; - - px = dx; - py = dy; - CLIP_TO(dx, dy, dw, dh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - xx += dx - px; - yy += dy - py; - } - if ((dw > 1) && (dh > 1)) - { - if ((im->current.w != ww) || - (im->current.h != hh) || - (cr != im->current.pr) || - (cg != im->current.pg) || - (cb != im->current.pb) || - (ca != im->current.pa) || - (__evas_anti_alias != im->current.smooth) - ) - { - if (im->pmap) XFreePixmap(im->disp, im->pmap); - if (im->pic) XRenderFreePicture(im->disp, im->pic); - im->pmap = 0; - im->pic = 0; - } - if (!im->pmap) - { - int screen = 0; - int depth; - - im->current.w = ww; - im->current.h = hh; - im->current.pr = cr; - im->current.pg = cg; - im->current.pb = cb; - im->current.pa = ca; - im->current.smooth = __evas_anti_alias; - if ((im->current.border.l != 0) || - (im->current.border.r != 0) || - (im->current.border.t != 0) || - (im->current.border.b != 0) || - (im->current.pr != 255) || - (im->current.pg != 255) || - (im->current.pb != 255) || - (im->current.pa != 255) - ) - { - Imlib_Image i; - Imlib_Border bd; - Imlib_Color_Modifier cm = NULL; - - cm = imlib_create_color_modifier(); - imlib_context_set_color_modifier(cm); - if ((cr != 255) || (cg != 255) || (cb != 255) || (ca != 255)) - { - DATA8 r[256], g[256], b[256], a[256]; - int j; - - cm = imlib_create_color_modifier(); - imlib_context_set_color_modifier(cm); - for (j = 0; j < 256; j++) - { - r[j] = (j * cr) / 255; - g[j] = (j * cg) / 255; - b[j] = (j * cb) / 255; - a[j] = (j * ca) / 255; - } - imlib_set_color_modifier_tables(r, g, b, a); - } - else - imlib_context_set_color_modifier(NULL); - - i = imlib_create_image(im->current.w, im->current.h); - imlib_context_set_image(i); - imlib_image_set_has_alpha(1); - imlib_image_clear(); - bd.left = im->current.border.l; - bd.right = im->current.border.r; - bd.top = im->current.border.t; - bd.bottom = im->current.border.b; - imlib_image_set_border(&bd); - imlib_context_set_anti_alias(__evas_anti_alias); - imlib_context_set_blend(1); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_angle(0.0); - - imlib_blend_image_onto_image(im->image, 1, - 0, 0, im->w, im->h, - 0, 0, dst_w, dst_h); - if (cm) - { - imlib_free_color_modifier(); - imlib_context_set_color_modifier(NULL); - } - } - else - { - Imlib_Image i; - - imlib_context_set_image(im->image); - i = imlib_create_cropped_scaled_image(0, 0, - im->w, im->h, - dst_w, dst_h); - imlib_context_set_image(i); - } - depth = __evas_render_create_dest_buf(disp, - __evas_visual, - im->current.w, - im->current.h, - screen, - &(im->pmap), - &(im->pic)); - __evas_render_dump_current_image_to_pixmap(disp, - im->pmap, - __evas_visual, - depth, - im->current.w, - im->current.h); - imlib_free_image(); - } -/* if (im->has_alpha)*/ - XRenderComposite (disp, - PictOpOver, - im->pic, - None, - up->pic, - xx, yy, 0, 0, - dx - up->x, dy - up->y, - dw, dh); -/* WOW... PictOpSrc is SLOOOOOOOOW - else - XRenderComposite (disp, - PictOpSrc, - im->pic, - None, - up->pic, - xx, yy, 0, 0, - dx - up->x, dy - up->y, - dw, dh); -*/ } - } - } - } - } -} - -int -__evas_render_image_get_width(Evas_Render_Image *im) -{ - return im->w; -} - -int -__evas_render_image_get_height(Evas_Render_Image *im) -{ - return im->h; -} - -void -__evas_render_image_set_borders(Evas_Render_Image *im, int left, int right, - int top, int bottom) -{ - if ((left == im->current.border.l) && - (right == im->current.border.r) && - (top == im->current.border.t) && - (bottom == im->current.border.b)) return; - if (im->pmap) XFreePixmap(im->disp, im->pmap); - if (im->pic) XRenderFreePicture(im->disp, im->pic); - im->pmap = 0; - im->pic = 0; - im->current.border.l = left; - im->current.border.r = right; - im->current.border.t = top; - im->current.border.b = bottom; -} - -void -__evas_render_image_set_smooth_scaling(int on) -{ - __evas_anti_alias = on; -} - - - - - - - - - - - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* font internals ************************************************************/ -/*****************************************************************************/ - -/*****************************************************************************/ -/* font externals ************************************************************/ -/*****************************************************************************/ - -Evas_Render_Font * -__evas_render_text_font_new(Display *disp, char *font, int size) -{ - return NULL; -} - -void -__evas_render_text_font_free(Evas_Render_Font *fn) -{ -} - -int -__evas_render_text_font_get_ascent(Evas_Render_Font *fn) -{ - return 0; -} - -int -__evas_render_text_font_get_descent(Evas_Render_Font *fn) -{ - return 0; -} - -int -__evas_render_text_font_get_max_ascent(Evas_Render_Font *fn) -{ - return 0; -} - -int -__evas_render_text_font_get_max_descent(Evas_Render_Font *fn) -{ - return 0; -} - -void -__evas_render_text_font_get_advances(Evas_Render_Font *fn, char *text, - int *advance_horiz, - int *advance_vert) -{ -} - -int -__evas_render_text_font_get_first_inset(Evas_Render_Font *fn, char *text) -{ - return 0; -} - -void -__evas_render_text_font_add_path(char *path) -{ -} - -void -__evas_render_text_font_del_path(char *path) -{ -} - -char ** -__evas_render_text_font_list_paths(int *count) -{ - return NULL; -} - -void -__evas_render_text_cache_empty(Display *disp) -{ -} - -void -__evas_render_text_cache_set_size(Display *disp, int size) -{ -} - -int -__evas_render_text_cache_get_size(Display *disp) -{ - return 0; -} - -void -__evas_render_text_draw(Evas_Render_Font *fn, Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, int x, int y, char *text, - int r, int g, int b, int a) -{ - Evas_List l; - int w, h; - - if ((!fn) || (!text)) return; - for(l = drawable_list; l; l = l->next) - { - Evas_Render_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Render_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - } - } - } - } -} - -void -__evas_render_text_get_size(Evas_Render_Font *fn, char *text, int *w, int *h) -{ - if ((!fn) || (!text)) - { - *w = 0; *h = 0; - return; - } -} - -int -__evas_render_text_get_character_at_pos(Evas_Render_Font *fn, char *text, - int x, int y, - int *cx, int *cy, int *cw, int *ch) -{ - return -1; -} - -void -__evas_render_text_get_character_number(Evas_Render_Font *fn, char *text, - int num, - int *cx, int *cy, int *cw, int *ch) -{ -} - - - - - - - - - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* rectangle externals *******************************************************/ -/*****************************************************************************/ - -void __evas_render_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - int x, int y, int w, int h, - int r, int g, int b, int a) -{ - Evas_List l; - for(l = drawable_list; l; l = l->next) - { - Evas_Render_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Render_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - } - } - } - } -} - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* rectangle externals *******************************************************/ -/*****************************************************************************/ - -void __evas_render_line_draw(Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - int x1, int y1, int x2, int y2, - int r, int g, int b, int a) -{ - Evas_List l; - int x, y, w, h; - - w = x2 - x1; - if (w < 0) w = -w; - h = y2 - y1; - if (h < 0) h = -h; - if (x1 < x2) x = x1; - else x = x2; - if (y1 < y2) y = y1; - else y = y2; - w++; h++; - for(l = drawable_list; l; l = l->next) - { - Evas_Render_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Render_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - } - } - } - } -} - - - - - - - - - - - - - - - - - -/****************************************************************************/ -/* gradient externals ********************************************************/ -/*****************************************************************************/ - - -Evas_Render_Graident * -__evas_render_gradient_new(Display *disp) -{ - return NULL; -} - -void -__evas_render_gradient_free(Evas_Render_Graident *gr) -{ -} - -void -__evas_render_gradient_color_add(Evas_Render_Graident *gr, int r, int g, int b, int a, int dist) -{ -} - -void -__evas_render_gradient_draw(Evas_Render_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle) -{ - Evas_List l; - - for(l = drawable_list; l; l = l->next) - { - Evas_Render_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Render_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - } - } - } - } -} - - - - -/************/ -/* polygons */ -/************/ -void -__evas_render_poly_draw (Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - Evas_List points, - int r, int g, int b, int a) -{ - Evas_List l, l2; - int x, y, w, h; - - x = y = w = h = 0; - if (points) - { - Evas_Point p; - - p = points->data; - x = p->x; - y = p->y; - w = 1; - h = 1; - } - for (l2 = points; l2; l2 = l2->next) - { - Evas_Point p; - - p = l2->data; - if (p->x < x) - { - w += x - p->x; - x = p->x; - } - if (p->x > (x + w)) - w = p->x - x; - if (p->y < y) - { - h += y - p->y; - y = p->y; - } - if (p->y > (y + h)) - h = p->y - y; - } - for(l = drawable_list; l; l = l->next) - { - Evas_Render_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Render_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - } - } - } - } -} - - - - - - - - - - - - - -/*****************************************************************************/ -/* general externals *********************************************************/ -/*****************************************************************************/ - -void -__evas_render_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a) -{ - __evas_clip = on; - __evas_clip_x = x; - __evas_clip_y = y; - __evas_clip_w = w; - __evas_clip_h = h; - __evas_clip_r = r; - __evas_clip_g = g; - __evas_clip_b = b; - __evas_clip_a = a; -} - -void -__evas_render_sync(Display *disp) -{ - XSync(disp, False); -} - -void -__evas_render_flush_draw(Display *disp, Imlib_Image dstim, Window win) -{ - Evas_List l; - - for(l = drawable_list; l; l = l->next) - { - Evas_Render_Drawable *dr; - XRenderPictFormat *format, *format_color; - Picture picture; - - dr = l->data; - format = XRenderFindVisualFormat (disp, __evas_visual); - if (!format) printf("eek no format!\n"); - picture = __evas_render_create_picuture(disp, win, format); - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_Render_Update *up; - - up = ll->data; - if (up->pmap) - { -/* WOW. PictOpSrc is slooow! - XRenderComposite(disp, PictOpSrc, - up->pic, None, picture, - 0, 0, 0, 0, up->x, up->y, - up->w, up->h); -*/ XRenderComposite(disp, PictOpOver, - up->pic, None, picture, - 0, 0, 0, 0, up->x, up->y, - up->w, up->h); - XRenderFreePicture(disp, up->pic); - XFreePixmap(disp, up->pmap); - } - free(up); - } - if (dr->tmp_images) - dr->tmp_images = evas_list_free(dr->tmp_images); - } - XRenderFreePicture(disp, picture); - free(dr); - } - __evas_render_sync(disp); - if (drawable_list) - drawable_list = evas_list_free(drawable_list); - drawable_list = NULL; -} - -void -__evas_render_set_vis_cmap(Visual *vis, Colormap cmap) -{ - __evas_visual = vis; - __evas_cmap = cmap; -} - -int -__evas_render_capable(Display *disp) -{ - return 1; -} - -Visual * -__evas_render_get_visual(Display *disp, int screen) -{ - int depth; - - __evas_visual = imlib_get_best_visual(disp, screen, &depth); - return __evas_visual; -} - -XVisualInfo * -__evas_render_get_visual_info(Display *disp, int screen) -{ - static XVisualInfo *vi = NULL; - XVisualInfo vi_template; - int n; - - if (vi) return vi; - vi_template.visualid = (__evas_render_get_visual(disp, screen))->visualid; - vi_template.screen = screen; - vi = XGetVisualInfo(disp, VisualIDMask | VisualScreenMask, &vi_template ,&n); - return vi; -} - -Colormap -__evas_render_get_colormap(Display *disp, int screen) -{ - Visual *v; - - if (__evas_cmap) return __evas_cmap; - v = __evas_render_get_visual(disp, screen); - __evas_cmap = DefaultColormap(disp, screen); - return __evas_cmap; - __evas_cmap = XCreateColormap(disp, RootWindow(disp, screen), v, AllocNone); - return __evas_cmap; -} - -void -__evas_render_init(Display *disp, int screen, int colors) -{ - static int initted = 0; - - if (!initted) - { - initted = 1; - } -} - -void -__evas_render_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, - int x, int y, int w, int h) -{ - Evas_List l; - - for(l = drawable_list; l; l = l->next) - { - Evas_Render_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_Render_Update *up; - - up = malloc(sizeof(Evas_Render_Update)); - up->x = x; - up->y = y; - up->w = w; - up->h = h; - up->drawable = win; - up->disp = disp; - up->pmap = 0; - dr->tmp_images = evas_list_append(dr->tmp_images, up); - } - return; - } - { - Evas_Render_Drawable *dr; - Evas_Render_Update *up; - - dr = malloc(sizeof(Evas_Render_Drawable)); - dr->win = win; - dr->disp = disp; - dr->tmp_images = NULL; - up = malloc(sizeof(Evas_Render_Update)); - up->x = x; - up->y = y; - up->w = w; - up->h = h; - up->drawable = win; - up->disp = disp; - up->pmap = 0; - drawable_list = evas_list_append(drawable_list, dr); - dr->tmp_images = evas_list_append(dr->tmp_images, up); - } -} - -#else - -/***************/ -/* image stuff */ -/***************/ -Evas_Render_Image *__evas_render_image_new_from_file(Display *disp, char *file){return NULL;} -void __evas_render_image_free(Evas_Render_Image *im){} -void __evas_render_image_cache_empty(Display *disp){} -void __evas_render_image_cache_set_size(Display *disp, int size){} -int __evas_render_image_cache_get_size(Display *disp){return 0;} -int __evas_render_image_get_width(Evas_Render_Image *im){return 0;} -int __evas_render_image_get_height(Evas_Render_Image *im){return 0;} -void __evas_render_image_set_borders(Evas_Render_Image *im, int left, int right, int top, int bottom){} -void __evas_render_image_set_smooth_scaling(int on){} -void __evas_render_image_draw(Evas_Render_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int cr, int cg, int cb, int ca){} - -/********/ -/* text */ -/********/ -Evas_Render_Font *__evas_render_text_font_new(Display *disp, char *font, int size){return NULL;} -void __evas_render_text_font_free(Evas_Render_Font *fn){} -void __evas_render_text_font_add_path(char *path){} -int __evas_render_text_font_get_ascent(Evas_Render_Font *fn){return 0;} -int __evas_render_text_font_get_descent(Evas_Render_Font *fn){return 0;} -int __evas_render_text_font_get_max_ascent(Evas_Render_Font *fn){return 0;} -int __evas_render_text_font_get_max_descent(Evas_Render_Font *fn){return 0;} -void __evas_render_text_font_get_advances(Evas_Render_Font *fn, char *text, int *advance_horiz, int *advance_vert){} -int __evas_render_text_font_get_first_inset(Evas_Render_Font *fn, char *text){return 0;} -void __evas_render_text_font_del_path(char *path){} -char **__evas_render_text_font_list_paths(int *count){return NULL;} -void __evas_render_text_cache_empty(Display *disp){} -void __evas_render_text_cache_set_size(Display *disp, int size){} -int __evas_render_text_cache_get_size(Display *disp){return 0;} -void __evas_render_text_get_size(Evas_Render_Font *fn, char *text, int *w, int *h){} -int __evas_render_text_get_character_at_pos(Evas_Render_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch){return 0;} -void __evas_render_text_get_character_number(Evas_Render_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch){} -void __evas_render_text_draw(Evas_Render_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a){} - -/**************/ -/* rectangles */ -/**************/ -void __evas_render_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a){} - -/*********/ -/* lines */ -/*********/ -void __evas_render_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a){} - -/*************/ -/* gradients */ -/*************/ -Evas_Render_Graident *__evas_render_gradient_new(Display *disp){return NULL;} -void __evas_render_gradient_free(Evas_Render_Graident *gr){} -void __evas_render_gradient_color_add(Evas_Render_Graident *gr, int r, int g, int b, int a, int dist){} -void __evas_render_gradient_draw(Evas_Render_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle){} - -/************/ -/* polygons */ -/************/ -void __evas_render_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a) {} - -/***********/ -/* drawing */ -/***********/ -void __evas_render_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a) {} -void __evas_render_init(Display *disp, int screen, int colors){} -int __evas_render_capable(Display *disp){return 0;} -void __evas_render_flush_draw(Display *disp, Imlib_Image dstim, Window win){} -void __evas_render_sync(Display *disp){} -Visual *__evas_render_get_visual(Display *disp, int screen){return NULL;} -XVisualInfo *__evas_render_get_visual_info(Display *disp, int screen){return NULL;} -Colormap __evas_render_get_colormap(Display *disp, int screen){return 0;} -void __evas_render_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h){} - -#endif diff --git a/legacy/evas/src/evas_render_routines.h b/legacy/evas/src/evas_render_routines.h deleted file mode 100644 index 98c48b9fd7..0000000000 --- a/legacy/evas/src/evas_render_routines.h +++ /dev/null @@ -1,156 +0,0 @@ -#include "config.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "Evas_private.h" -#include "Evas.h" - -#include -#include - -#ifdef HAVE_RENDER -#include -#else -typedef Pixmap Picture; -#endif - -#ifndef SPANS_COMMON -# define SPANS_COMMON(x1, w1, x2, w2) \ -(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1))))) -#define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \ -((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh)))) -#endif - -typedef struct _evas_render_image Evas_Render_Image; -typedef void Evas_Render_Font; -typedef void Evas_Render_Graident; - -struct _evas_render_image -{ - char *file; - Imlib_Image image; - int references; - int w, h; - Display *disp; - struct { - int w, h; - struct - { - int l, r, t, b; - } border; - int smooth; - int pr, pg, pb, pa; - } current; - Picture pic; - Pixmap pmap; - int has_alpha; -}; - -typedef struct _evas_render_drawable Evas_Render_Drawable; -typedef struct _evas_render_update Evas_Render_Update; - -struct _evas_render_drawable -{ - Display *disp; - Window win; - Evas_List tmp_images; -}; - -struct _evas_render_update -{ - Display *disp; - Drawable drawable; - Picture pic; - Pixmap pmap; - int x, y, w, h; -}; - -/***************/ -/* image stuff */ -/***************/ -Evas_Render_Image *__evas_render_image_new_from_file(Display *disp, char *file); -void __evas_render_image_free(Evas_Render_Image *im); -void __evas_render_image_cache_empty(Display *disp); -void __evas_render_image_cache_set_size(Display *disp, int size); -int __evas_render_image_cache_get_size(Display *disp); -int __evas_render_image_get_width(Evas_Render_Image *im); -int __evas_render_image_get_height(Evas_Render_Image *im); -void __evas_render_image_set_borders(Evas_Render_Image *im, int left, int right, int top, int bottom); -void __evas_render_image_set_smooth_scaling(int on); -void __evas_render_image_draw(Evas_Render_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int cr, int cg, int cb, int ca); - -/********/ -/* text */ -/********/ -Evas_Render_Font *__evas_render_text_font_new(Display *disp, char *font, int size); -void __evas_render_text_font_free(Evas_Render_Font *fn); -int __evas_render_text_font_get_ascent(Evas_Render_Font *fn); -int __evas_render_text_font_get_descent(Evas_Render_Font *fn); -int __evas_render_text_font_get_max_ascent(Evas_Render_Font *fn); -int __evas_render_text_font_get_max_descent(Evas_Render_Font *fn); -void __evas_render_text_font_get_advances(Evas_Render_Font *fn, char *text, int *advance_horiz, int *advance_vert); -int __evas_render_text_font_get_first_inset(Evas_Render_Font *fn, char *text); -void __evas_render_text_font_add_path(char *path); -void __evas_render_text_font_del_path(char *path); -char **__evas_render_text_font_list_paths(int *count); -void __evas_render_text_cache_empty(Display *disp); -void __evas_render_text_cache_set_size(Display *disp, int size); -int __evas_render_text_cache_get_size(Display *disp); -void __evas_render_text_get_size(Evas_Render_Font *fn, char *text, int *w, int *h); -int __evas_render_text_get_character_at_pos(Evas_Render_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch); -void __evas_render_text_get_character_number(Evas_Render_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch); -void __evas_render_text_draw(Evas_Render_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a); - -/**************/ -/* rectangles */ -/**************/ - -void __evas_render_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a); - -/*********/ -/* lines */ -/*********/ - -void __evas_render_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a); - -/*************/ -/* gradients */ -/*************/ -Evas_Render_Graident *__evas_render_gradient_new(Display *disp); -void __evas_render_gradient_free(Evas_Render_Graident *gr); -void __evas_render_gradient_color_add(Evas_Render_Graident *gr, int r, int g, int b, int a, int dist); -void __evas_render_gradient_draw(Evas_Render_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle); - -/************/ -/* polygons */ -/************/ -void __evas_render_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a); - -/***********/ -/* drawing */ -/***********/ -void __evas_render_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a); -void __evas_render_init(Display *disp, int screen, int colors); -void __evas_render_set_vis_cmap(Visual *vis, Colormap cmap); -int __evas_render_capable(Display *disp); -void __evas_render_flush_draw(Display *disp, Imlib_Image dstim, Window win); -void __evas_render_sync(Display *disp); -Visual *__evas_render_get_visual(Display *disp, int screen); -XVisualInfo *__evas_render_get_visual_info(Display *disp, int screen); -Colormap __evas_render_get_colormap(Display *disp, int screen); -void __evas_render_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h); - diff --git a/legacy/evas/src/evas_text.c b/legacy/evas/src/evas_text.c deleted file mode 100644 index 94e013a503..0000000000 --- a/legacy/evas/src/evas_text.c +++ /dev/null @@ -1,1114 +0,0 @@ -#include "Evas_private.h" -#include "Evas.h" -#include -#include -#include -#include -#include "evas_gl_routines.h" -#include "evas_imlib_routines.h" -#include "evas_image_routines.h" -#include "evas_x11_routines.h" -#include "evas_render_routines.h" - -static void -_evas_free_text(Evas_Object o) -{ - Evas_Object_Text oo; - - IF_OBJ(o, OBJECT_TEXT) return; - oo = o; - if (oo->current.text) free(oo->current.text); - if (oo->current.font) free(oo->current.font); - free(o); -} - -static void -_evas_free_text_renderer_data(Evas e, Evas_Object o) -{ - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_imlib_text_font_free((void *)o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_BASIC_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_x11_text_font_free((void *)o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_3D_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_gl_text_font_free((void *)o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_ALPHA_HARDWARE: - if (o->renderer_data.method[e->current.render_method]) - __evas_render_text_font_free((void *)o->renderer_data.method[e->current.render_method]); - break; - case RENDER_METHOD_IMAGE: - if (o->renderer_data.method[e->current.render_method]) - __evas_image_text_font_free((void *)o->renderer_data.method[e->current.render_method]); - break; - default: - break; - } - o->renderer_data.method[e->current.render_method] = NULL; -} - -Evas_Object -evas_add_text(Evas e, char *font, int size, char *text) -{ - Evas_Object_Text oo; - Evas_Object_Any o; - Evas_List l; - Evas_Layer layer; - - if (!e) return NULL; - o = oo = malloc(sizeof(struct _Evas_Object_Text)); - memset(o, 0, sizeof(struct _Evas_Object_Text)); - o->type = OBJECT_TEXT; - o->object_free = _evas_free_text; - o->object_renderer_data_free = _evas_free_text_renderer_data; - - oo->current.text = malloc(strlen(text) + 1); - strcpy(oo->current.text, text); - oo->current.font = malloc(strlen(font) + 1); - strcpy(oo->current.font, font); - oo->current.size = size; - - { - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - { - Evas_Imlib_Font *fn; - - fn = __evas_imlib_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_imlib_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - __evas_imlib_text_font_free(fn); - } - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - { - Evas_X11_Font *fn; - - fn = __evas_x11_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_x11_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - __evas_x11_text_font_free(fn); - } - } - break; - case RENDER_METHOD_3D_HARDWARE: - { - Evas_GL_Font *fn; - - fn = __evas_gl_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_gl_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - __evas_gl_text_font_free(fn); - } - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - { - Evas_Render_Font *fn; - - fn = __evas_render_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_render_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - __evas_render_text_font_free(fn); - } - } - break; - case RENDER_METHOD_IMAGE: - { - Evas_Image_Font *fn; - - fn = __evas_image_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_image_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - __evas_image_text_font_free(fn); - } - } - break; - default: - break; - } - } - - o->current.x = 0; - o->current.y = 0; - o->current.w = (double)oo->current.string.w; - o->current.h = (double)oo->current.string.h; - - for (l = e->layers; l; l = l->next) - { - layer = l->data; - if (layer->layer == o->current.layer) - { - layer->objects = evas_list_append(layer->objects, o); - return o; - } - if (layer->layer > o->current.layer) - { - Evas_Layer layer_new; - - layer_new = malloc(sizeof(struct _Evas_Layer)); - memset(layer_new, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_prepend_relative(e->layers, layer_new, layer); - layer_new->objects = evas_list_append(layer_new->objects, o); - layer_new->layer = o->current.layer; - return o; - } - } - - layer = malloc(sizeof(struct _Evas_Layer)); - memset(layer, 0, sizeof(struct _Evas_Layer)); - e->layers = evas_list_append(e->layers, layer); - layer->objects = evas_list_append(layer->objects, o); - - return o; -} - -char * -evas_get_text_string(Evas e, Evas_Object o) -{ - Evas_Object_Text oo; - - if (!e) return NULL; - o = TO_OBJECT(e, o); - if (!o) return NULL; - IF_OBJ(o, OBJECT_TEXT) return ""; - oo = o; - return oo->current.text; -} - -char * -evas_get_text_font(Evas e, Evas_Object o) -{ - Evas_Object_Text oo; - - if (!e) return NULL; - o = TO_OBJECT(e, o); - if (!o) return NULL; - IF_OBJ(o, OBJECT_TEXT) return ""; - oo = o; - return oo->current.font; -} - -int -evas_get_text_size(Evas e, Evas_Object o) -{ - Evas_Object_Text oo; - - if (!e) return 0; - o = TO_OBJECT(e, o); - if (!o) return 0; - IF_OBJ(o, OBJECT_TEXT) return 0; - oo = o; - return oo->current.size; -} - -double -evas_get_text_height(Evas e, Evas_Object o) -{ - Evas_Object_Text oo; - - if (!e) return 0; - o = TO_OBJECT(e, o); - if (!o) return 0; - IF_OBJ(o, OBJECT_TEXT) return 0; - oo = o; - - return (double)oo->current.string.h; -} - -double -evas_get_text_width(Evas e, Evas_Object o) -{ - Evas_Object_Text oo; - - if (!e) return 0; - if (!o) return 0; - IF_OBJ(o, OBJECT_TEXT) return 0; - oo = o; - - return (double)oo->current.string.w; -} - -int -evas_text_at_position(Evas e, Evas_Object o, double x, double y, - double *char_x, double *char_y, double *char_w, double *char_h) -{ - Evas_Object_Text oo; - int cx, cy, cw, ch; - - if (!e) return -1; - o = TO_OBJECT(e, o); - if (!o) return -1; - IF_OBJ(o, OBJECT_TEXT) return -1; - oo = o; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - { - int ret; - Evas_Imlib_Font *fn; - - fn = __evas_imlib_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - ret = __evas_imlib_text_get_character_at_pos(fn, oo->current.text, - (int)(x), - (int)(y), - &cx, &cy, &cw, &ch); - if (char_x) *char_x = (double)cx; - if (char_y) *char_y = (double)cy; - if (char_w) *char_w = (double)cw; - if (char_h) *char_h = (double)ch; - __evas_imlib_text_font_free(fn); - return ret; - } - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - { - int ret; - Evas_X11_Font *fn; - - fn = __evas_x11_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - ret = __evas_x11_text_get_character_at_pos(fn, oo->current.text, - (int)(x), - (int)(y), - &cx, &cy, &cw, &ch); - if (char_x) *char_x = (double)cx; - if (char_y) *char_y = (double)cy; - if (char_w) *char_w = (double)cw; - if (char_h) *char_h = (double)ch; - __evas_x11_text_font_free(fn); - return ret; - } - } - break; - case RENDER_METHOD_3D_HARDWARE: - { - int ret; - Evas_GL_Font *fn; - - fn = __evas_gl_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - ret = __evas_gl_text_get_character_at_pos(fn, oo->current.text, - (int)(x), - (int)(y), - &cx, &cy, &cw, &ch); - if (char_x) *char_x = (double)cx; - if (char_y) *char_y = (double)cy; - if (char_w) *char_w = (double)cw; - if (char_h) *char_h = (double)ch; - __evas_gl_text_font_free(fn); - return ret; - } - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - { - int ret; - Evas_Render_Font *fn; - - fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - ret = __evas_render_text_get_character_at_pos(fn, oo->current.text, - (int)(x), - (int)(y), - &cx, &cy, &cw, &ch); - if (char_x) *char_x = (double)cx; - if (char_y) *char_y = (double)cy; - if (char_w) *char_w = (double)cw; - if (char_h) *char_h = (double)ch; - __evas_gl_text_font_free(fn); - return ret; - } - } - break; - case RENDER_METHOD_IMAGE: - { - int ret; - Evas_Image_Font *fn; - - fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - ret = __evas_image_text_get_character_at_pos(fn, oo->current.text, - (int)(x), - (int)(y), - &cx, &cy, &cw, &ch); - if (char_x) *char_x = (double)cx; - if (char_y) *char_y = (double)cy; - if (char_w) *char_w = (double)cw; - if (char_h) *char_h = (double)ch; - __evas_image_text_font_free(fn); - return ret; - } - } - break; - default: - break; - } - return 0; -} - -void -evas_text_at(Evas e, Evas_Object o, int index, - double *char_x, double *char_y, double *char_w, double *char_h) -{ - Evas_Object_Text oo; - int cx, cy, cw, ch; - - if (!e) return; - if (!o) return; - IF_OBJ(o, OBJECT_TEXT) return; - oo = o; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - { - Evas_Imlib_Font *fn; - - fn = __evas_imlib_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - __evas_imlib_text_get_character_number(fn, oo->current.text, - index, - &cx, &cy, &cw, &ch); - if (char_x) *char_x = (double)cx; - if (char_y) *char_y = (double)cy; - if (char_w) *char_w = (double)cw; - if (char_h) *char_h = (double)ch; - __evas_imlib_text_font_free(fn); - } - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - { - Evas_X11_Font *fn; - - fn = __evas_x11_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - __evas_x11_text_get_character_number(fn, oo->current.text, - index, - &cx, &cy, &cw, &ch); - if (char_x) *char_x = (double)cx; - if (char_y) *char_y = (double)cy; - if (char_w) *char_w = (double)cw; - if (char_h) *char_h = (double)ch; - __evas_x11_text_font_free(fn); - } - } - break; - case RENDER_METHOD_3D_HARDWARE: - { - Evas_GL_Font *fn; - - fn = __evas_gl_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - __evas_gl_text_get_character_number(fn, oo->current.text, - index, - &cx, &cy, &cw, &ch); - if (char_x) *char_x = (double)cx; - if (char_y) *char_y = (double)cy; - if (char_w) *char_w = (double)cw; - if (char_h) *char_h = (double)ch; - __evas_gl_text_font_free(fn); - } - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - { - Evas_Render_Font *fn; - - fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - __evas_render_text_get_character_number(fn, oo->current.text, - index, - &cx, &cy, &cw, &ch); - if (char_x) *char_x = (double)cx; - if (char_y) *char_y = (double)cy; - if (char_w) *char_w = (double)cw; - if (char_h) *char_h = (double)ch; - __evas_render_text_font_free(fn); - } - } - break; - case RENDER_METHOD_IMAGE: - { - Evas_Image_Font *fn; - - fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - __evas_image_text_get_character_number(fn, oo->current.text, - index, - &cx, &cy, &cw, &ch); - if (char_x) *char_x = (double)cx; - if (char_y) *char_y = (double)cy; - if (char_w) *char_w = (double)cw; - if (char_h) *char_h = (double)ch; - __evas_image_text_font_free(fn); - } - } - break; - default: - break; - } -} - -void -evas_text_get_ascent_descent(Evas e, Evas_Object o, - double *ascent, double *descent) -{ - int a, d; - Evas_Object_Text oo; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - IF_OBJ(o, OBJECT_TEXT) return; - oo = o; - a = 0; d = 0; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - { - Evas_Imlib_Font *fn; - - fn = __evas_imlib_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - a = __evas_imlib_text_font_get_ascent(fn); - d = __evas_imlib_text_font_get_descent(fn); - __evas_imlib_text_font_free(fn); - } - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - { - Evas_X11_Font *fn; - - fn = __evas_x11_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - a = __evas_x11_text_font_get_ascent(fn); - d = __evas_x11_text_font_get_descent(fn); - __evas_x11_text_font_free(fn); - } - } - break; - case RENDER_METHOD_3D_HARDWARE: - { - Evas_GL_Font *fn; - - fn = __evas_gl_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - a = __evas_gl_text_font_get_ascent(fn); - d = __evas_gl_text_font_get_descent(fn); - __evas_gl_text_font_free(fn); - } - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - { - Evas_Render_Font *fn; - - fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - a = __evas_render_text_font_get_ascent(fn); - d = __evas_render_text_font_get_descent(fn); - __evas_render_text_font_free(fn); - } - } - break; - case RENDER_METHOD_IMAGE: - { - Evas_Image_Font *fn; - - fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - a = __evas_image_text_font_get_ascent(fn); - d = __evas_image_text_font_get_descent(fn); - __evas_image_text_font_free(fn); - } - } - break; - default: - break; - } - if (ascent) *ascent = a; - if (descent) *descent = d; -} - -void -evas_text_get_max_ascent_descent(Evas e, Evas_Object o, - double *ascent, double *descent) -{ - int a, d; - Evas_Object_Text oo; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - IF_OBJ(o, OBJECT_TEXT) return; - oo = o; - a = 0; d = 0; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - { - Evas_Imlib_Font *fn; - - fn = __evas_imlib_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - a = __evas_imlib_text_font_get_max_ascent(fn); - d = __evas_imlib_text_font_get_max_descent(fn); - __evas_imlib_text_font_free(fn); - } - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - { - Evas_X11_Font *fn; - - fn = __evas_x11_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - a = __evas_x11_text_font_get_max_ascent(fn); - d = __evas_x11_text_font_get_max_descent(fn); - __evas_x11_text_font_free(fn); - } - } - break; - case RENDER_METHOD_3D_HARDWARE: - { - Evas_GL_Font *fn; - - fn = __evas_gl_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - a = __evas_gl_text_font_get_max_ascent(fn); - d = __evas_gl_text_font_get_max_descent(fn); - __evas_gl_text_font_free(fn); - } - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - { - Evas_Render_Font *fn; - - fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - a = __evas_render_text_font_get_max_ascent(fn); - d = __evas_render_text_font_get_max_descent(fn); - __evas_render_text_font_free(fn); - } - } - break; - case RENDER_METHOD_IMAGE: - { - Evas_Image_Font *fn; - - fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - a = __evas_image_text_font_get_max_ascent(fn); - d = __evas_image_text_font_get_max_descent(fn); - __evas_image_text_font_free(fn); - } - } - break; - default: - break; - } - if (ascent) *ascent = a; - if (descent) *descent = d; -} - -void -evas_text_get_advance(Evas e, Evas_Object o, - double *h_advance, double *v_advance) -{ - int a, d; - Evas_Object_Text oo; - - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - IF_OBJ(o, OBJECT_TEXT) return; - oo = o; - a = 0; d = 0; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - { - Evas_Imlib_Font *fn; - - fn = __evas_imlib_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - __evas_imlib_text_font_get_advances(fn, oo->current.text, &a, &d); - __evas_imlib_text_font_free(fn); - } - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - { - Evas_X11_Font *fn; - - fn = __evas_x11_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - __evas_x11_text_font_get_advances(fn, oo->current.text, &a, &d); - __evas_x11_text_font_free(fn); - } - } - break; - case RENDER_METHOD_3D_HARDWARE: - { - Evas_GL_Font *fn; - - fn = __evas_gl_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - __evas_gl_text_font_get_advances(fn, oo->current.text, &a, &d); - __evas_gl_text_font_free(fn); - } - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - { - Evas_Render_Font *fn; - - fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - __evas_render_text_font_get_advances(fn, oo->current.text, &a, &d); - __evas_render_text_font_free(fn); - } - } - break; - case RENDER_METHOD_IMAGE: - { - Evas_Image_Font *fn; - - fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - __evas_image_text_font_get_advances(fn, oo->current.text, &a, &d); - __evas_image_text_font_free(fn); - } - } - break; - default: - break; - } - if (h_advance) *h_advance = a; - if (v_advance) *v_advance = d; -} - -double -evas_text_get_inset(Evas e, Evas_Object o) -{ - Evas_Object_Text oo; - int inset; - - if (!e) return 0; - o = TO_OBJECT(e, o); - if (!o) return 0; - IF_OBJ(o, OBJECT_TEXT) return 0; - oo = o; - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - { - Evas_Imlib_Font *fn; - - fn = __evas_imlib_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - inset = __evas_imlib_text_font_get_first_inset(fn, oo->current.text); - __evas_imlib_text_font_free(fn); - return (double)inset; - } - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - { - Evas_X11_Font *fn; - - fn = __evas_x11_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - inset = __evas_x11_text_font_get_first_inset(fn, oo->current.text); - __evas_x11_text_font_free(fn); - return (double)inset; - } - } - break; - case RENDER_METHOD_3D_HARDWARE: - { - Evas_GL_Font *fn; - - fn = __evas_gl_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - inset = __evas_gl_text_font_get_first_inset(fn, oo->current.text); - __evas_gl_text_font_free(fn); - return (double)inset; - } - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - { - Evas_Render_Font *fn; - - fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - inset = __evas_render_text_font_get_first_inset(fn, oo->current.text); - __evas_render_text_font_free(fn); - return (double)inset; - } - } - break; - case RENDER_METHOD_IMAGE: - { - Evas_Image_Font *fn; - - fn = __evas_image_text_font_new(e->current.display, oo->current.font, oo->current.size); - if (fn) - { - inset = __evas_image_text_font_get_first_inset(fn, oo->current.text); - __evas_image_text_font_free(fn); - return (double)inset; - } - } - break; - default: - break; - } - return 0; -} - -void -evas_set_text(Evas e, Evas_Object o, char *text) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - switch (o->type) - { - case OBJECT_TEXT: - { - Evas_Object_Text oo; - - oo = (Evas_Object_Text)o; - if ((text) && (oo->current.text) && (!strcmp(oo->current.text, text))) - return; - if (oo->current.text) free(oo->current.text); - oo->current.text = NULL; - if (text) - { - oo->current.text = malloc(strlen(text) + 1); - strcpy(oo->current.text, text); - } - else - { - oo->current.text = malloc(strlen("") + 1); - strcpy(oo->current.text, ""); - } - oo->previous.text = NULL; - { - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - { - Evas_Imlib_Font *fn; - - fn = __evas_imlib_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_imlib_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - evas_resize(e, o, - (double)oo->current.string.w, - (double)oo->current.string.h); - __evas_imlib_text_font_free(fn); - } - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - { - Evas_X11_Font *fn; - - fn = __evas_x11_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_x11_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - evas_resize(e, o, - (double)oo->current.string.w, - (double)oo->current.string.h); - __evas_x11_text_font_free(fn); - } - } - break; - case RENDER_METHOD_3D_HARDWARE: - { - Evas_GL_Font *fn; - - fn = __evas_gl_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_gl_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - evas_resize(e, o, - (double)oo->current.string.w, - (double)oo->current.string.h); - __evas_gl_text_font_free(fn); - } - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - { - Evas_Render_Font *fn; - - fn = __evas_render_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_render_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - evas_resize(e, o, - (double)oo->current.string.w, - (double)oo->current.string.h); - __evas_render_text_font_free(fn); - } - } - break; - case RENDER_METHOD_IMAGE: - { - Evas_Image_Font *fn; - - fn = __evas_image_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_image_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - evas_resize(e, o, - (double)oo->current.string.w, - (double)oo->current.string.h); - __evas_image_text_font_free(fn); - } - } - break; - default: - break; - } - } - o->current.w = (double)oo->current.string.w; - o->current.h = (double)oo->current.string.h; - o->changed = 1; - e->changed = 1; - } - break; - default: - break; - } -} - -void -evas_set_font(Evas e, Evas_Object o, char *font, int size) -{ - if (!e) return; - o = TO_OBJECT(e, o); - if (!o) return; - if (!font) return; - if (size < 0) size = 0; - switch (o->type) - { - case OBJECT_TEXT: - { - Evas_Object_Text oo; - - oo = (Evas_Object_Text)o; - if ((oo->current.font) && (!strcmp(oo->current.font, font)) - && (size == oo->current.size)) - return; - _evas_free_text_renderer_data(e, o); - if (oo->current.font) free(oo->current.font); - oo->current.font = malloc(strlen(font) + 1); - strcpy(oo->current.font, font); - oo->previous.font = NULL; - oo->current.size = size; - { - switch (e->current.render_method) - { - case RENDER_METHOD_ALPHA_SOFTWARE: - { - Evas_Imlib_Font *fn; - - fn = __evas_imlib_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_imlib_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - evas_resize(e, o, - (double)oo->current.string.w, - (double)oo->current.string.h); - __evas_imlib_text_font_free(fn); - } - } - break; - case RENDER_METHOD_BASIC_HARDWARE: - { - Evas_X11_Font *fn; - - fn = __evas_x11_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_x11_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - evas_resize(e, o, - (double)oo->current.string.w, - (double)oo->current.string.h); - __evas_x11_text_font_free(fn); - } - } - break; - case RENDER_METHOD_3D_HARDWARE: - { - Evas_GL_Font *fn; - - fn = __evas_gl_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_gl_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - evas_resize(e, o, - (double)oo->current.string.w, - (double)oo->current.string.h); - __evas_gl_text_font_free(fn); - } - } - break; - case RENDER_METHOD_ALPHA_HARDWARE: - { - Evas_Render_Font *fn; - - fn = __evas_render_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_render_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - evas_resize(e, o, - (double)oo->current.string.w, - (double)oo->current.string.h); - __evas_render_text_font_free(fn); - } - } - break; - case RENDER_METHOD_IMAGE: - { - Evas_Image_Font *fn; - - fn = __evas_image_text_font_new (e->current.display, - oo->current.font, - oo->current.size); - if (fn) - { - __evas_image_text_get_size(fn, oo->current.text, - &oo->current.string.w, - &oo->current.string.h); - evas_resize(e, o, - (double)oo->current.string.w, - (double)oo->current.string.h); - __evas_image_text_font_free(fn); - } - } - break; - default: - break; - } - } - o->current.w = (double)oo->current.string.w; - o->current.h = (double)oo->current.string.h; - o->changed = 1; - e->changed = 1; - } - break; - default: - break; - } -} diff --git a/legacy/evas/src/evas_x11_routines.c b/legacy/evas/src/evas_x11_routines.c deleted file mode 100644 index 850f09cd2f..0000000000 --- a/legacy/evas/src/evas_x11_routines.c +++ /dev/null @@ -1,2034 +0,0 @@ -#include "evas_x11_routines.h" -#include "evas_fileless_image.h" -#include -#include -#include -#include - -#define CLIP(x, y, w, h, xx, yy, ww, hh) \ -if (x < (xx)) {w += (x - (xx)); x = (xx);} \ -if (y < (yy)) {h += (y - (yy)); y = (yy);} \ -if ((x + w) > ((xx) + (ww))) {w = (ww) - (x - xx);} \ -if ((y + h) > ((yy) + (hh))) {h = (hh) - (y - yy);} - -#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \ - ((x < (xx + ww)) && \ - (y < (yy + hh)) && \ - ((x + w) > xx) && \ - ((y + h) > yy)) - -#define CLIP_TO(_x, _y, _w, _h, _cx, _cy, _cw, _ch) \ - { \ - if (INTERSECTS(_x, _y, _w, _h, _cx, _cy, _cw, _ch)) \ - { \ - if (_x < _cx) \ - { \ - _w += _x - _cx; \ - _x = _cx; \ - if (_w < 0) _w = 0; \ - } \ - if ((_x + _w) > (_cx + _cw)) \ - _w = _cx + _cw - _x; \ - if (_y < _cy) \ - { \ - _h += _y - _cy; \ - _y = _cy; \ - if (_h < 0) _h = 0; \ - } \ - if ((_y + _h) > (_cy + _ch)) \ - _h = _cy + _ch - _y; \ - } \ - else \ - { \ - _w = 0; _h = 0; \ - } \ - } - - -static void __evas_x11_image_cache_flush(Display *disp); -static int __evas_anti_alias = 1; -static Evas_List drawable_list = NULL; - -static Visual *__evas_visual = NULL; -static Colormap __evas_cmap = 0; - -static Evas_List __evas_images = NULL; -static int __evas_image_cache = 0; -static int __evas_image_cache_max = 512 * 1024; - -/* the current clip region and color */ -static int __evas_clip = 0; -static int __evas_clip_x = 0; -static int __evas_clip_y = 0; -static int __evas_clip_w = 0; -static int __evas_clip_h = 0; -static int __evas_clip_r = 0; -static int __evas_clip_g = 0; -static int __evas_clip_b = 0; -static int __evas_clip_a = 0; - - -/*****************************************************************************/ -/* image internals ***********************************************************/ -/*****************************************************************************/ - -static void -__evas_x11_image_cache_flush(Display *disp) -{ - Evas_X11_Image *im, *im_last; - Evas_List l; - - while (__evas_image_cache > __evas_image_cache_max) - { - for (l = __evas_images; l; l = l->next) - { - im = l->data; - - if (im->references == 0) im_last = im; - } - if (im_last) - { - im = im_last; - - __evas_images = evas_list_remove(__evas_images, im); - if (im->pmap) imlib_free_pixmap_and_mask(im->pmap); - if (im->gc) XFreeGC(im->disp, im->gc); - if (im->file) free(im->file); - if (im->image) - { - imlib_context_set_image(im->image); - imlib_free_image_and_decache(); - } - __evas_image_cache -= im->pw * im->ph * 4; - free(im); - } - } -} - -/*****************************************************************************/ -/* image externals ***********************************************************/ -/*****************************************************************************/ - -Evas_X11_Image * -__evas_x11_image_new_from_file(Display *disp, char *file) -{ - Evas_X11_Image *im; - Evas_List l; - - for (l = __evas_images; l; l = l->next) - { - im = l->data; - if ((!strcmp(im->file, file)) && (im->disp == disp)) - { - if (l != __evas_images) - { - __evas_images = evas_list_remove(__evas_images, im); - __evas_images = evas_list_prepend(__evas_images, im); - } - if (im->references == 0) - { - __evas_image_cache -= im->pw * im->ph * 4; - } - im->references++; - return im; - } - } - im = malloc(sizeof(Evas_X11_Image)); - memset(im, 0, sizeof(Evas_X11_Image)); - im->image = _evas_find_fileless_image(file); - if (!im->image) - im->image = imlib_load_image(file); - if (!im->image) - { - free(im); - return NULL; - } - im->disp = disp; - im->file = malloc(strlen(file) + 1); - strcpy(im->file, file); - im->references = 1; - imlib_context_set_image(im->image); - imlib_image_set_changes_on_disk(); - im->w = imlib_image_get_width(); - im->h = imlib_image_get_height(); - im->has_alpha = imlib_image_has_alpha(); - __evas_images = evas_list_prepend(__evas_images, im); - return im; -} - -void -__evas_x11_image_free(Evas_X11_Image *im) -{ - im->references--; - if (im->references == 0) - { - /* flush */ - __evas_image_cache += im->pw * im->ph * 4; - __evas_x11_image_cache_flush(im->disp); - } -} - -void -__evas_x11_image_cache_empty(Display *disp) -{ - int size; - - size = imlib_get_cache_size(); - imlib_set_cache_size(0); - imlib_set_cache_size(size); - size = __evas_image_cache_max; - __evas_image_cache_max = 0; - __evas_x11_image_cache_flush(disp); - __evas_image_cache_max = size; -} - -void -__evas_x11_image_cache_set_size(Display *disp, int size) -{ - __evas_image_cache_max = size; - imlib_set_cache_size(size * 2); - __evas_x11_image_cache_flush(disp); -} - -int -__evas_x11_image_cache_get_size(Display *disp) -{ - return __evas_image_cache_max; -} - -void -__evas_x11_image_draw(Evas_X11_Image *im, - Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, - int src_x, int src_y, int src_w, int src_h, - int dst_x, int dst_y, int dst_w, int dst_h, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - Imlib_Color_Modifier cm = NULL; - - if (ca == 0) return; - if ((src_w == 0) || (src_h == 0) || (dst_w == 0) || (dst_w == 0)) return; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca < 128) return; - if ((cr != 255) || (cg != 255) || (cb != 255) || (ca != 255)) - { - DATA8 r[256], g[256], b[256], a[256]; - int i; - - cm = imlib_create_color_modifier(); - imlib_context_set_color_modifier(cm); - for (i = 0; i < 256; i++) - { - r[i] = (i * cr) / 255; - g[i] = (i * cg) / 255; - b[i] = (i * cb) / 255; - a[i] = (i * ca) / 255; - } - imlib_set_color_modifier_tables(r, g, b, a); - } - else - imlib_context_set_color_modifier(NULL); - - imlib_context_set_display(disp); - imlib_context_set_visual(__evas_visual); - imlib_context_set_colormap(__evas_cmap); - imlib_context_set_drawable(w); - imlib_context_set_dither_mask(0); - imlib_context_set_anti_alias(0); - if (imlib_get_visual_depth(disp, __evas_visual) <= 8) - imlib_context_set_dither(__evas_anti_alias); - else imlib_context_set_dither(0); - imlib_context_set_blend(0); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - for(l = drawable_list; l; l = l->next) - { - Evas_X11_Drawable *dr; - - dr = l->data; - if ((dr->win == w) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_X11_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - dst_x, dst_y, dst_w, dst_h)) - { - int xx, yy, ww, hh, iw, ih, dx, dy, dw, dh; - - - if (!up->p) - up->p = XCreatePixmap(disp, w, up->w, up->h, dr->depth); - - dx = dst_x; - dy = dst_y; - dw = dst_w; - dh = dst_h; - iw = im->w; - ih = im->h; - ww = (iw * dw) / src_w; - hh = (ih * dh) / src_h; - xx = (src_x * dw) / src_w; - yy = (src_y * dh) / src_h; - if (__evas_clip) - { - int px, py; - - px = dx; - py = dy; - CLIP_TO(dx, dy, dw, dh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - xx += dx - px; - yy += dy - py; - } - if ((dw > 1) && (dh > 1)) - { - if ((ww != im->pw) || (hh != im->ph) || - (cr != im->pr) || (cg != im->pg) || - (cb != im->pb) || (ca != im->pa)) - { - if (im->pmap) imlib_free_pixmap_and_mask(im->pmap); - if (im->gc) XFreeGC(im->disp, im->gc); - im->pmap = 0; - im->mask = 0; - im->gc = 0; - im->pw = 0; - im->ph = 0; - } - if (!im->pmap) - { - XGCValues gcv; - - imlib_context_set_image(im->image); - im->pw = ww; - im->ph = hh; - im->pr = cr; - im->pg = cg; - im->pb = cb; - im->pa = ca; - imlib_render_pixmaps_for_whole_image_at_size(&im->pmap, &im->mask, - ww, hh); - gcv.graphics_exposures = False; - im->gc = XCreateGC(disp, w, - GCGraphicsExposures, &gcv); - im->win = w; - if (im->mask) - XSetClipMask(disp, im->gc, im->mask); - } - if (im->mask) - XSetClipOrigin(disp, im->gc, - dst_x - up->x - src_x, - dst_y - up->y - src_y); - if (im->pmap) - XCopyArea(disp, - im->pmap, up->p, - im->gc, - xx, yy, - dw, dh, - dx - up->x, dy - up->y); - } - } - } - } - } - if (cm) - { - imlib_free_color_modifier(); - imlib_context_set_color_modifier(NULL); - } -} - -int -__evas_x11_image_get_width(Evas_X11_Image *im) -{ - return im->w; -} - -int -__evas_x11_image_get_height(Evas_X11_Image *im) -{ - return im->h; -} - -void -__evas_x11_image_set_borders(Evas_X11_Image *im, int left, int right, - int top, int bottom) -{ - Imlib_Border bd; - - imlib_context_set_image(im->image); - imlib_image_get_border(&bd); - if ((bd.left != left) || (bd.right != right) || - (bd.top != top) || (bd.bottom != bottom)) - { - if (im->pmap) imlib_free_pixmap_and_mask(im->pmap); - if (im->gc) XFreeGC(im->disp, im->gc); - im->pmap = 0; - im->mask = 0; - im->gc = 0; - im->pw = 0; - im->ph = 0; - bd.left = left; - bd.right = right; - bd.top = top; - bd.bottom = bottom; - imlib_image_set_border(&bd); - } -} - -void -__evas_x11_image_set_smooth_scaling(int on) -{ - __evas_anti_alias = on; -} - - - - - - - - - - - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* font internals ************************************************************/ -/*****************************************************************************/ - -#define TT_VALID( handle ) ( ( handle ).z != NULL ) - -static Evas_List __evas_fonts = NULL; - -static char **__evas_fpath = NULL; -static int __evas_fpath_num = 0; -static int __evas_font_cache = 0; -static int __evas_font_cache_max = 512 * 1024; - -static int __evas_have_tt_engine = 0; -static TT_Engine __evas_tt_engine; - -static Evas_X11_Glyph * -__evas_x11_text_font_get_glyph(Evas_X11_Font *fn, int glyph) -{ - Evas_X11_Glyph *g; - Evas_List l; - int hash; - int code; - - hash = glyph & 0xff; - for (l = fn->glyphs[hash]; l; l = l->next) - { - g = l->data; - if (g->glyph_id == glyph) - { - if (l != fn->glyphs[hash]) - { - fn->glyphs[hash] = evas_list_remove(fn->glyphs[hash], g); - fn->glyphs[hash] = evas_list_prepend(fn->glyphs[hash], g); - } - return g; - } - } - g = malloc(sizeof(Evas_X11_Glyph)); - g->glyph_id = glyph; - TT_New_Glyph(fn->face, &(g->glyph)); - code = TT_Char_Index(fn->char_map, glyph); - TT_Load_Glyph(fn->instance, g->glyph, code, TTLOAD_SCALE_GLYPH | TTLOAD_HINT_GLYPH); - TT_Get_Glyph_Metrics(g->glyph, &(g->metrics)); - g->pw = 0; - g->ph = 0; - g->pmap = 0; - fn->glyphs[hash] = evas_list_prepend(fn->glyphs[hash], g); - return g; -} - -static TT_Raster_Map * -__evas_x11_text_font_raster_new(int width, int height) -{ - TT_Raster_Map *rmap; - - rmap = malloc(sizeof(TT_Raster_Map)); - if (!rmap) return NULL; - rmap->width = (width + 3) & -4; - rmap->rows = height; - rmap->flow = TT_Flow_Up; - rmap->cols = rmap->width; - rmap->size = rmap->rows * rmap->width; - if (rmap->size <= 0) - { - free(rmap); - return NULL; - } - rmap->bitmap = malloc(rmap->size); - if (!rmap->bitmap) - { - free(rmap); - return NULL; - } - memset(rmap->bitmap, 0, rmap->size); - return rmap; -} - -static void -__evas_x11_text_font_raster_free(TT_Raster_Map * rmap) -{ - if (rmap->bitmap) free(rmap->bitmap); - free(rmap); -} - -static void -__evas_x11_text_font_render_glyph(Window win, Evas_X11_Font *fn, Evas_X11_Glyph *g) -{ - int tw, th, xmin, ymin, xmax, ymax; - TT_Raster_Map *rmap; - - if (g->pmap) return; - xmin = g->metrics.bbox.xMin & -64; - ymin = g->metrics.bbox.yMin & -64; - xmax = (g->metrics.bbox.xMax + 63) & -64; - ymax = (g->metrics.bbox.yMax + 63) & -64; - tw = ((xmax - xmin) / 64) + 1; - th = ((ymax - ymin) / 64) + 1; - - g->pmap = XCreatePixmap(fn->disp, win, tw, th, 1); - g->pw = tw; - g->ph = th; - - fn->mem_use += (((g->pw -1) | 0x7) + 1) * g->ph / 8; - - rmap = __evas_x11_text_font_raster_new(tw, th); - if (rmap) - { - int x, y; - XImage *xim; - XGCValues gcv; - GC gc; - - xim = XCreateImage(fn->disp, __evas_visual, 1, ZPixmap, 0, NULL, tw, th, 8, 0); - xim->data = malloc(xim->bytes_per_line * xim->height); - TT_Get_Glyph_Bitmap(g->glyph, rmap, -xmin, -ymin); - for (y = 0; y < th; y++) - { - for (x = 0; x < tw; x++) - { - DATA8 rval; - - rval = (DATA8)(((unsigned char *)(rmap->bitmap))[((rmap->rows - y - 1) * rmap->cols) + (x >> 3)]); - rval >>= (7 - (x - ((x >> 3) << 3))); - XPutPixel(xim, x, y, rval); - } - } - gc = XCreateGC(fn->disp, g->pmap, 0, &gcv); - XPutImage(fn->disp, g->pmap, gc, xim, 0, 0, 0, 0, tw, th); - XDestroyImage(xim); - XFreeGC(fn->disp, gc); - __evas_x11_text_font_raster_free(rmap); - } -} - -__evas_x11_is_file(char *file) -{ - struct stat st; - - if (stat(file, &st) < 0) - return 0; - return 1; -} - -static char * -__evas_x11_font_find(char *font) -{ - char buf[4096]; - char *ext[] = {".ttf", ".TTF", "" - }; - int i, j; - - for (i = 0; i < 3; i++) - { - sprintf(buf, "%s%s", font, ext[i]); - if (__evas_x11_is_file(buf)) - { - char *f; - - f = malloc(strlen(buf) + 1); - strcpy(f, buf); - return f; - } - } - for (j = 0; j < __evas_fpath_num; j++) - { - for (i = 0; i < 3; i++) - { - sprintf(buf, "%s/%s%s", __evas_fpath[j], font, ext[i]); - if (__evas_x11_is_file(buf)) - { - char *f; - - f = malloc(strlen(buf) + 1); - strcpy(f, buf); - return f; - } - } - } - return NULL; -} - -static Evas_X11_Font * -__evas_x11_font_load(char *font, int size) -{ - Evas_X11_Font *fn; - char *file; - TT_Error error; - int i, num_cmap, upm; - const int dpi = 96; - - file = __evas_x11_font_find(font); - if (!file) return NULL; - if (!__evas_have_tt_engine) - { - error = TT_Init_FreeType(&__evas_tt_engine); - if (error) return NULL; - __evas_have_tt_engine = 1; - } - fn = malloc(sizeof(Evas_X11_Font)); - fn->font = malloc(strlen(font) + 1); - strcpy(fn->font, font); - fn->size = size; - fn->engine = __evas_tt_engine; - fn->mem_use = 0; - error = TT_Open_Face(fn->engine, file, &fn->face); - if (error) - { - free(fn->font); - free(fn); - free(file); - return NULL; - } - free(file); - error = TT_Get_Face_Properties(fn->face, &fn->properties); - if (error) - { - TT_Close_Face(fn->face); - free(fn->font); - free(fn); - return NULL; - } - error = TT_New_Instance(fn->face, &fn->instance); - if (error) - { - TT_Close_Face(fn->face); - free(fn->font); - free(fn); - return NULL; - } - TT_Set_Instance_Resolutions(fn->instance, dpi, dpi); - TT_Set_Instance_CharSize(fn->instance, size * 64); - TT_Get_Instance_Metrics(fn->instance, &fn->metrics); - upm = fn->properties.header->Units_Per_EM; - fn->ascent = (fn->properties.horizontal->Ascender * fn->metrics.y_ppem) / upm; - fn->descent = (fn->properties.horizontal->Descender * fn->metrics.y_ppem) / upm; - if (fn->descent < 0) fn->descent = -fn->descent; - num_cmap = fn->properties.num_CharMaps; - for (i = 0; i < num_cmap; i++) - { - unsigned short platform, encoding; - - TT_Get_CharMap_ID(fn->face, i, &platform, &encoding); - if ((platform == 3 && encoding == 1) || - (platform == 0 && encoding == 0)) - { - TT_Get_CharMap(fn->face, i, &fn->char_map); - break; - } - } - if (i == num_cmap) - TT_Get_CharMap(fn->face, 0, &fn->char_map); - fn->max_descent = 0; - fn->max_ascent = 0; - memset(fn->glyphs, 0, sizeof(Evas_List) * 256); - fn->references = 1; - - /* go thru the first 256 glyps to calculate max ascent/descent */ - { - Evas_X11_Glyph *g; - - for (i = 0; i < 256; i++) - { - g = __evas_x11_text_font_get_glyph(fn, i); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - if ((g->metrics.bbox.yMin & -64) < fn->max_descent) - fn->max_descent = (g->metrics.bbox.yMin & -64); - if (((g->metrics.bbox.yMax + 63) & -64) > fn->max_ascent) - fn->max_ascent = ((g->metrics.bbox.yMax + 63) & -64); - } - } - - if (((fn->ascent == 0) && (fn->descent == 0)) || (fn->ascent == 0)) - { - fn->ascent = fn->max_ascent / 64; - fn->descent = -fn->max_descent / 64; - } - TT_Flush_Face(fn->face); - return fn; -} - -static void -__evas_x11_text_font_cache_flush(void) -{ - Evas_List l; - Evas_X11_Font *fn_last; - Evas_X11_Font *fn; - - while (__evas_font_cache > __evas_font_cache_max) - { - fn_last = NULL; - for (l = __evas_fonts; l; l = l->next) - { - fn = l->data; - if (fn->references == 0) fn_last = fn; - } - if (fn_last) - { - int i; - - __evas_font_cache -= fn->mem_use; - TT_Done_Instance(fn_last->instance); - TT_Close_Face(fn_last->face); - if (fn_last->font) free(fn_last->font); - for (i = 0; i < 256; i++) - { - if (fn_last->glyphs[i]) - { - for (l = fn_last->glyphs[i]; l; l = l->next) - { - Evas_X11_Glyph *g; - Evas_List ll; - - g = l->data; - if (g->pmap) - XFreePixmap(fn->disp, g->pmap); - free(g); - } - evas_list_free(fn_last->glyphs[i]); - } - } - __evas_fonts = evas_list_remove(__evas_fonts, fn_last); - free(fn_last); - } - } -} -/*****************************************************************************/ -/* font externals ************************************************************/ -/*****************************************************************************/ - -Evas_X11_Font * -__evas_x11_text_font_new(Display *disp, char *font, int size) -{ - Evas_List l; - Evas_X11_Font *fn; - - if (!font) return NULL; - for (l = __evas_fonts; l; l = l->next) - { - Evas_X11_Font *fn; - - fn = l->data; - if (!strcmp(fn->font, font) && (size == fn->size)) - { - if (l != __evas_fonts) - { - __evas_fonts = evas_list_remove(__evas_fonts, fn); - __evas_fonts = evas_list_prepend(__evas_fonts, fn); - } - if (fn->references == 0) - __evas_font_cache -= fn->mem_use; - fn->references++; - return fn; - } - } - fn = __evas_x11_font_load(font, size); - if (!fn) return NULL; - __evas_fonts = evas_list_prepend(__evas_fonts, fn); - return fn; -} - -void -__evas_x11_text_font_free(Evas_X11_Font *fn) -{ - if (!fn) return; - if (fn->references >= 0) - { - fn->references--; - if (fn->references == 0) - __evas_font_cache += fn->mem_use; - } - __evas_x11_text_font_cache_flush(); -} - -int -__evas_x11_text_font_get_ascent(Evas_X11_Font *fn) -{ - if (!fn) return 0; - return fn->ascent / 64; -} - -int -__evas_x11_text_font_get_descent(Evas_X11_Font *fn) -{ - if (!fn) return 0; - return fn->descent / 64; -} - -int -__evas_x11_text_font_get_max_ascent(Evas_X11_Font *fn) -{ - if (!fn) return 0; - return fn->max_ascent / 64; -} - -int -__evas_x11_text_font_get_max_descent(Evas_X11_Font *fn) -{ - if (!fn) return 0; - return fn->max_descent / 64; -} - -void -__evas_x11_text_font_get_advances(Evas_X11_Font *fn, char *text, - int *advance_horiz, - int *advance_vert) -{ - int i, ascent, descent, pw, ph; - - if (advance_horiz) *advance_horiz = 0; - if (advance_horiz) *advance_vert = 0; - if (!fn) return; - if (!text) return; - if (text[0] == 0) return; - - ascent = fn->ascent; - descent = fn->descent; - pw = 0; - ph = ascent + descent; - - for (i = 0; text[i]; i++) - { - Evas_X11_Glyph *g; - int glyph; - - glyph = ((unsigned char *)text)[i]; - g = __evas_x11_text_font_get_glyph(fn, glyph); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - if (i == 0) - pw += ((-g->metrics.bearingX) / 64); - pw += g->metrics.advance / 64; - } - *advance_horiz = pw; - *advance_vert = ph; -} - -int -__evas_x11_text_font_get_first_inset(Evas_X11_Font *fn, char *text) -{ - int i; - - if (!fn) return 0; - if (!text) return 0; - if (text[0] == 0) return 0; - - for (i = 0; text[i]; i++) - { - Evas_X11_Glyph *g; - int glyph; - - glyph = ((unsigned char *)text)[i]; - g = __evas_x11_text_font_get_glyph(fn, glyph); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - return ((-g->metrics.bearingX) / 64); - } - return 0; -} - -void -__evas_x11_text_font_add_path(char *path) -{ - int i; - - for (i = 0; i < __evas_fpath_num; i++) - { - if (!strcmp(path, __evas_fpath[i])) return; - } - __evas_fpath_num++; - if (!__evas_fpath) __evas_fpath = malloc(sizeof(char *)); - else __evas_fpath = realloc(__evas_fpath, - (__evas_fpath_num * sizeof(char *))); - __evas_fpath[__evas_fpath_num - 1] = malloc(strlen(path) + 1); - strcpy(__evas_fpath[__evas_fpath_num - 1], path); -} - -void -__evas_x11_text_font_del_path(char *path) -{ - int i, j; - - for (i = 0; i < __evas_fpath_num; i++) - { - if (!strcmp(path, __evas_fpath[i])) - { - __evas_fpath_num--; - for (j = i; j < __evas_fpath_num; j++) - __evas_fpath[j] = __evas_fpath[j + 1]; - if (__evas_fpath_num > 0) - __evas_fpath = realloc(__evas_fpath, - __evas_fpath_num * sizeof(char *)); - else - { - free(__evas_fpath); - __evas_fpath = NULL; - } - } - } -} - -char ** -__evas_x11_text_font_list_paths(int *count) -{ - *count = __evas_fpath_num; - return __evas_fpath; -} - -void -__evas_x11_text_cache_empty(Display *disp) -{ - int prev_cache; - - prev_cache = __evas_font_cache_max; - __evas_font_cache_max = 0; - __evas_x11_text_font_cache_flush(); - __evas_font_cache_max = prev_cache; -} - -void -__evas_x11_text_cache_set_size(Display *disp, int size) -{ - __evas_font_cache_max = size; - __evas_x11_text_font_cache_flush(); -} - -int -__evas_x11_text_cache_get_size(Display *disp) -{ - return __evas_font_cache_max; -} - -void -__evas_x11_text_draw(Evas_X11_Font *fn, Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, int x, int y, char *text, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - DATA32 pixel; - int w, h; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca < 128) return; - imlib_context_set_display(disp); - imlib_context_set_visual(__evas_visual); - imlib_context_set_colormap(__evas_cmap); - imlib_context_set_drawable(win); - imlib_context_set_color(cr, cg, cb, ca); - pixel = imlib_render_get_pixel_color(); - imlib_context_set_dither_mask(0); - imlib_context_set_anti_alias(0); - imlib_context_set_dither(0); - imlib_context_set_blend(0); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_color_modifier(NULL); - __evas_x11_text_get_size(fn, text, &w, &h); - fn->disp = disp; - for(l = drawable_list; l; l = l->next) - { - Evas_X11_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_X11_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (!up->p) - up->p = XCreatePixmap(disp, win, up->w, up->h, dr->depth); - XSetForeground(disp, dr->gc, pixel); - XSetClipMask(disp, dr->gc, None); - XSetClipOrigin(disp, dr->gc, 0, 0); - XSetFillStyle(disp, dr->gc, FillStippled); - { - int xx, yy, ww, hh; - XRectangle rect; - - xx = up->x; - yy = up->y; - ww = up->w; - hh = up->h; - - if (__evas_clip) - { - CLIP_TO(xx, yy, ww, hh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - rect.x = xx - up->x; - rect.y = yy - up->y; - rect.width = ww; - rect.height = hh; - XSetClipRectangles(disp, dr->gc, 0, 0, - &rect, 1, Unsorted); - { - int i; - int x_offset, y_offset; - int glyph, rows; - Evas_X11_Glyph *g; - - if (text[0] == 0) return; - glyph = ((unsigned char *)text)[0]; - g = __evas_x11_text_font_get_glyph(fn, glyph); - if (!TT_VALID(g->glyph)) continue; - x_offset = 0; - if (g) x_offset = - (g->metrics.bearingX / 64); - y_offset = -(fn->max_descent / 64); - rows = h; - for (i = 0; text[i]; i++) - { - int xmin, ymin, xmax, ymax, off, adj; - - /* for internationalization this here wouldnt just use */ - /* the char value of the text[i] but translate form utf-8 */ - /* or whetever and incriment i appropriately and set g to */ - /* the glyph index */ - glyph = ((unsigned char *)text)[i]; - g = __evas_x11_text_font_get_glyph(fn, glyph); - __evas_x11_text_font_render_glyph(win, fn, g); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - - xmin = g->metrics.bbox.xMin & -64; - ymin = g->metrics.bbox.yMin & -64; - xmax = (g->metrics.bbox.xMax + 63) & -64; - ymax = (g->metrics.bbox.yMax + 63) & -64; - - xmin = (xmin >> 6) + x_offset; - ymin = (ymin >> 6) + y_offset; - xmax = (xmax >> 6) + x_offset; - ymax = (ymax >> 6) + y_offset; - - if (ymin < 0) off = 0; - else off = rows - ymin - 1; - adj = (rows - ymax) - - ((fn->max_ascent - fn->max_descent) >> 6); - if (g->pmap) - { - XSetStipple(disp, dr->gc, g->pmap); - XSetTSOrigin(disp, dr->gc, - x + xmin - up->x, - y + ymin + off + adj - up->y); - XFillRectangle(disp, up->p, dr->gc, - x + xmin - up->x, - y + ymin + off + adj - up->y, - xmax - xmin + 1, - ymax - ymin + 1); - x_offset += g->metrics.advance / 64; - } - } - } - } - } - } - } - } -} - -void -__evas_x11_text_get_size(Evas_X11_Font *fn, char *text, int *w, int *h) -{ - int i, pw, ph; - Evas_X11_Glyph *g; - int glyph; - - if (!fn) return; - if (!text) return; - if (text[0] == 0) return; - pw = 0; - ph = (fn->max_ascent - fn->max_descent) / 64; - for (i = 0; text[i]; i++) - { - /* for internationalization this here wouldnt just use */ - /* the char value of the text[i] but translate form utf-8 */ - /* or whetever and incriment i appropriately and set g to */ - /* the glyph index */ - glyph = ((unsigned char *)text)[i]; - g = __evas_x11_text_font_get_glyph(fn, glyph); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - if (i == 0) - pw += ((-g->metrics.bearingX) / 64); - if (text[i + 1] == 0) /* last char - ineternationalization issue */ - { - if ((g->metrics.bbox.xMax / 64) == 0) - pw += (g->metrics.advance / 64); - else - pw += (g->metrics.bbox.xMax / 64); - } - else - pw += g->metrics.advance / 64; - } - if (w) *w = pw; - if (h) *h = ph; -} - -int -__evas_x11_text_get_character_at_pos(Evas_X11_Font *fn, char *text, - int x, int y, - int *cx, int *cy, int *cw, int *ch) -{ - int i, px, ppx; - - if (cx) *cx = 0; - if (cy) *cy = 0; - if (cw) *cw = 0; - if (ch) *ch = 0; - if (!fn) return -1; - if (!text) return -1; - if (text[0] == 0) return -1; - - if ((y < 0) || (y > (fn->ascent + fn->descent))) return -1; - if (cy) *cy = 0; - if (ch) *ch = fn->ascent + fn->descent; - ppx = 0; - px = 0; - for (i = 0; text[i]; i++) - { - Evas_X11_Glyph *g; - int glyph; - - glyph = ((unsigned char *)text)[i]; - g = __evas_x11_text_font_get_glyph(fn, glyph); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - if (i == 0) - px += ((-g->metrics.bearingX) / 64); - if (text[i + 1] == 0) - px += (g->metrics.bbox.xMax / 64); - else - px += g->metrics.advance / 64; - if ((x >= ppx) && (x < px)) - { - if (cx) - *cx = ppx; - if (cw) - *cw = px - ppx; - return i; - } - } - return -1; -} - -void -__evas_x11_text_get_character_number(Evas_X11_Font *fn, char *text, - int num, - int *cx, int *cy, int *cw, int *ch) -{ - int i, px, ppx; - - if (cx) *cx = 0; - if (cy) *cy = 0; - if (cw) *cw = 0; - if (ch) *ch = 0; - if (!fn) return; - if (!text) return; - if (text[0] == 0) return; - - if (cy) *cy = 0; - if (ch) *ch = fn->ascent + fn->descent; - ppx = 0; - px = 0; - for (i = 0; text[i]; i++) - { - Evas_X11_Glyph *g; - int glyph; - - glyph = ((unsigned char *)text)[i]; - g = __evas_x11_text_font_get_glyph(fn, glyph); - if (!g) continue; - if (!TT_VALID(g->glyph)) continue; - ppx = px; - if (i == 0) - px += ((-g->metrics.bearingX) / 64); - if (text[i + 1] == 0) - px += (g->metrics.bbox.xMax / 64); - else - px += g->metrics.advance / 64; - if (i == num) - { - if (cx) *cx = ppx; - if (cw) *cw = px - ppx; - return; - } - } -} - - - - - - - - - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* rectangle externals *******************************************************/ -/*****************************************************************************/ - -void __evas_x11_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - int x, int y, int w, int h, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - DATA32 pixel; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca < 128) return; - imlib_context_set_display(disp); - imlib_context_set_visual(__evas_visual); - imlib_context_set_colormap(__evas_cmap); - imlib_context_set_drawable(win); - imlib_context_set_color(cr, cg, cb, ca); - pixel = imlib_render_get_pixel_color(); - imlib_context_set_dither_mask(0); - imlib_context_set_anti_alias(0); - imlib_context_set_dither(0); - imlib_context_set_blend(0); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_color_modifier(NULL); - for(l = drawable_list; l; l = l->next) - { - Evas_X11_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_X11_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (!up->p) - up->p = XCreatePixmap(disp, win, up->w, up->h, dr->depth); - XSetForeground(disp, dr->gc, pixel); - XSetClipMask(disp, dr->gc, None); - XSetClipOrigin(disp, dr->gc, 0, 0); - XSetFillStyle(disp, dr->gc, FillSolid); - { - int xx, yy, ww, hh; - - xx = x; - yy = y; - ww = w; - hh = h; - - CLIP_TO(xx, yy, ww, hh, up->x, up->y, up->w, up->h); - if (__evas_clip) - { - CLIP_TO(xx, yy, ww, hh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - if ((w > 1) && (h > 1)) - XFillRectangle(disp, up->p, dr->gc, - xx - up->x, yy - up->y, ww, hh); - } - } - } - } - } -} - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* rectangle externals *******************************************************/ -/*****************************************************************************/ - -void __evas_x11_line_draw(Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - int x1, int y1, int x2, int y2, - int cr, int cg, int cb, int ca) -{ - Evas_List l; - int x, y, w, h; - DATA32 pixel; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca < 128) return; - imlib_context_set_display(disp); - imlib_context_set_visual(__evas_visual); - imlib_context_set_colormap(__evas_cmap); - imlib_context_set_drawable(win); - imlib_context_set_color(cr, cg, cb, ca); - pixel = imlib_render_get_pixel_color(); - imlib_context_set_dither_mask(0); - imlib_context_set_anti_alias(0); - imlib_context_set_dither(0); - imlib_context_set_blend(0); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_color_modifier(NULL); - w = x2 - x1; - if (w < 0) w = -w; - h = y2 - y1; - if (h < 0) h = -h; - if (x1 < x2) x = x1; - else x = x2; - if (y1 < y2) y = y1; - else y = y2; - w++; h++; - for(l = drawable_list; l; l = l->next) - { - Evas_X11_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_X11_Update *up; - - up = ll->data; - - /* if image intersects image update - render */ - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (!up->p) - up->p = XCreatePixmap(disp, win, up->w, up->h, dr->depth); - XSetForeground(disp, dr->gc, pixel); - XSetClipMask(disp, dr->gc, None); - XSetClipOrigin(disp, dr->gc, 0, 0); - XSetFillStyle(disp, dr->gc, FillSolid); - { - int xx, yy, ww, hh; - XRectangle rect; - - xx = up->x; - yy = up->y; - ww = up->w; - hh = up->h; - - if (__evas_clip) - { - CLIP_TO(xx, yy, ww, hh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - rect.x = xx - up->x; - rect.y = yy - up->y; - rect.width = ww; - rect.height = hh; - XSetClipRectangles(disp, dr->gc, 0, 0, - &rect, 1, Unsorted); - XDrawLine(disp, up->p, dr->gc, - x1 - up->x, y1 - up->y, - x2 - up->x, y2 - up->y); - } - } - } - } - } -} - - - - - - - - - - - - - - - - - -/*****************************************************************************/ -/* gradient externals ********************************************************/ -/*****************************************************************************/ - - -Evas_X11_Graident * -__evas_x11_gradient_new(Display *disp) -{ - Evas_X11_Graident *gr; - - gr = malloc(sizeof(Evas_X11_Graident)); - gr->colors = NULL; -} - -void -__evas_x11_gradient_free(Evas_X11_Graident *gr) -{ - Evas_List l; - - if (gr->colors) - { - for (l = gr->colors; l; l = l->next) - { - free(l->data); - } - evas_list_free(gr->colors); - } - free(gr); -} - -void -__evas_x11_gradient_color_add(Evas_X11_Graident *gr, int r, int g, int b, int a, int dist) -{ - Evas_X11_Color *cl; - - cl = malloc(sizeof(Evas_X11_Color)); - cl->r = r; - cl->g = g; - cl->b = b; - cl->a = a; - cl->dist = dist; - gr->colors = evas_list_append(gr->colors, cl); -} - -void -__evas_x11_gradient_draw(Evas_X11_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle) -{ - Evas_List l; - - imlib_context_set_display(disp); - imlib_context_set_visual(__evas_visual); - imlib_context_set_colormap(__evas_cmap); - imlib_context_set_drawable(win); - imlib_context_set_dither_mask(0); - imlib_context_set_anti_alias(0); - imlib_context_set_dither(0); - imlib_context_set_blend(0); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_color_modifier(NULL); - - /* oops - math was rotated 180 derees - fixup here */ - angle += 180; - - while (angle < 0.0) angle += 360.0; - while (angle > 360.0) angle -= 360.0; - - - for (l = drawable_list; l; l = l->next) - { - Evas_X11_Drawable *dr; - - dr = l->data; - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_X11_Update *up; - - up = ll->data; - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - int i, p, tot; - int xx, yy, ww, hh; - XRectangle rect; - Evas_List l2; - - if (!up->p) - up->p = XCreatePixmap(disp, win, up->w, up->h, dr->depth); - - XSetClipMask(disp, dr->gc, None); - XSetClipOrigin(disp, dr->gc, 0, 0); - XSetFillStyle(disp, dr->gc, FillSolid); - - xx = x; - yy = y; - ww = w; - hh = h; - if (__evas_clip) - { - CLIP_TO(xx, yy, ww, hh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - tot = 0; - for (l2 = gr->colors; l2; l2 = l2->next) - { - Evas_X11_Color *c1; - - c1 = l2->data; - if (l2 != gr->colors) tot += c1->dist; - } - tot <<= 2; - if ((ww > 1) && (hh > 1)) - { - rect.x = xx - up->x; - rect.y = yy - up->y; - rect.width = ww; - rect.height = hh; - XSetClipRectangles(disp, dr->gc, 0, 0, - &rect, 1, Unsorted); - p = 0; - for (l2 = gr->colors; l2; l2 = l2->next) - { - int r, g, b, a; - int dist; - Evas_X11_Color *c1, *c2; - XPoint xpoints[4]; - DATA32 pixel; - double x1, y1, x2, y2, x3, y3, per1, per2; - - c1 = l2->data; - if (!l2->next) break;; - c2 = l2->next->data; - dist = c2->dist; - - for (i = 0; i < (dist << 2); i++) - { - r = ((c1->r * ((dist << 2) - i)) + (c2->r * i)) / (dist << 2); - g = ((c1->g * ((dist << 2) - i)) + (c2->g * i)) / (dist << 2); - b = ((c1->b * ((dist << 2) - i)) + (c2->b * i)) / (dist << 2); - a = ((c1->a * ((dist << 2) - i)) + (c2->a * i)) / (dist << 2); - if (__evas_clip) - { - r = (r * __evas_clip_r) / 255; - g = (g * __evas_clip_g) / 255; - b = (b * __evas_clip_b) / 255; - a = (a * __evas_clip_a) / 255; - } - if (a >= 128) - { - /* | 0/x2 */ - /* |_ / */ - /* |a/ */ - /* -_|/ */ - /* |-_ */ - /* x3 1/| x1 */ - - x1 = cos((angle * 2.0 * 3.141592654) / 360.0); - y1 = sin((angle * 2.0 * 3.141592654) / 360.0); - x2 = cos(((angle - 90) * 2.0 * 3.141592654) / 360.0); - y2 = sin(((angle - 90) * 2.0 * 3.141592654) / 360.0); - - if ((angle > 0.0) && (angle <= 90.0)) {x3 = -1.0; y3 = 1.0;} - else if ((angle > 90.0) && (angle <= 180.0)) {x3 = -1.0; y3 = -1.0;} - else if ((angle > 180.0) && (angle <= 270.0)) {x3 = 1.0; y3 = -1.0;} - else {x3 = 1.0; y3 = 1.0;} - - if ((angle > 315.0) || (angle <= 45.0)) {x2 *= -1.0 / y2; y2 = -1.0;} - else if ((angle > 45.0) && (angle <= 135.0)) {y2 *= 1.0 / x2; x2 = 1.0;} - else if ((angle > 135.0) && (angle <= 225.0)) {x2 *= 1.0 / y2; y2 = 1.0;} - else {y2 *= -1.0 / x2; x2 = -1.0;} - - x3 = (x3 + 1.0) / 2.0; - y3 = (y3 + 1.0) / 2.0; - - x2 *= 0.5; - y2 *= 0.5; - - per1 = (-1.0 + ((((double)(tot - p - 1) / (double)tot) - 0.5) * 2.0)); - per2 = (-1.0 + ((((double)(tot - p) / (double)tot) - 0.5) * 2.0)); - - xpoints[0].x = x - up->x + (int) - ((x3 + (2.0 * x1) + (-x2 * per2)) * (double)w); - xpoints[0].y = y - up->y + (int) - ((y3 + (2.0 * y1) + (-y2 * per2)) * (double)h); - - xpoints[1].x = x - up->x + (int) - ((x3 + (2.0 * x1) + (-x2 * per1)) * (double)w); - xpoints[1].y = y - up->y + (int) - ((y3 + (2.0 * y1) + (-y2 * per1)) * (double)h); - - xpoints[2].x = x - up->x + (int) - ((x3 - (2.0 * x1) + (-x2 * per1)) * (double)w); - xpoints[2].y = y - up->y + (int) - ((y3 - (2.0 * y1) + (-y2 * per1)) * (double)h); - - xpoints[3].x = x - up->x + (int) - ((x3 - (2.0 * x1) + (-x2 * per2)) * (double)w); - xpoints[3].y = y - up->y + (int) - ((y3 - (2.0 * y1) + (-y2 * per2)) * (double)h); - - imlib_context_set_color(r, g, b, a); - pixel = 0; - pixel = imlib_render_get_pixel_color(); - XSetForeground(disp, dr->gc, pixel); - XFillPolygon(disp, up->p, dr->gc, - xpoints, 4, - Convex, CoordModeOrigin); - } - p++; - } - } - } - } - } - } - } -} - - - - - - - - - - - -/************/ -/* polygons */ -/************/ -void -__evas_x11_poly_draw (Display *disp, Imlib_Image dstim, Window win, - int win_w, int win_h, - Evas_List points, - int cr, int cg, int cb, int ca) -{ - Evas_List l, l2; - DATA32 pixel; - int x, y, w, h; - - if (__evas_clip) - { - cr = (cr * __evas_clip_r) / 255; - cg = (cg * __evas_clip_g) / 255; - cb = (cb * __evas_clip_b) / 255; - ca = (ca * __evas_clip_a) / 255; - } - if (ca < 128) return; - imlib_context_set_display(disp); - imlib_context_set_visual(__evas_visual); - imlib_context_set_colormap(__evas_cmap); - imlib_context_set_drawable(win); - imlib_context_set_color(cr, cg, cb, ca); - pixel = imlib_render_get_pixel_color(); - imlib_context_set_dither_mask(0); - imlib_context_set_anti_alias(0); - imlib_context_set_dither(0); - imlib_context_set_blend(0); - imlib_context_set_angle(0.0); - imlib_context_set_operation(IMLIB_OP_COPY); - imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); - imlib_context_set_color_modifier(NULL); - x = y = w = h = 0; - if (points) - { - Evas_Point p; - - p = points->data; - x = p->x; - y = p->y; - w = 1; - h = 1; - } - for (l2 = points; l2; l2 = l2->next) - { - Evas_Point p; - - p = l2->data; - if (p->x < x) - { - w += x - p->x; - x = p->x; - } - if (p->x > (x + w)) - w = p->x - x; - if (p->y < y) - { - h += y - p->y; - y = p->y; - } - if (p->y > (y + h)) - h = p->y - y; - } - for(l = drawable_list; l; l = l->next) - { - Evas_X11_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_X11_Update *up; - - up = ll->data; - - if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, - x, y, w, h)) - { - if (!up->p) - up->p = XCreatePixmap(disp, win, up->w, up->h, dr->depth); - XSetForeground(disp, dr->gc, pixel); - XSetClipMask(disp, dr->gc, None); - XSetClipOrigin(disp, dr->gc, 0, 0); - XSetFillStyle(disp, dr->gc, FillSolid); - { - XPoint *xpoints; - int point_count, i; - int xx, yy, ww, hh; - XRectangle rect; - - xx = up->x; - yy = up->y; - ww = up->w; - hh = up->h; - - if (__evas_clip) - { - CLIP_TO(xx, yy, ww, hh, - __evas_clip_x, __evas_clip_y, - __evas_clip_w, __evas_clip_h); - } - rect.x = xx - up->x; - rect.y = yy - up->y; - rect.width = ww; - rect.height = hh; - XSetClipRectangles(disp, dr->gc, 0, 0, - &rect, 1, Unsorted); - point_count = 0; - for (l2 = points; l2; l2 = l2->next) point_count++; - xpoints = malloc(point_count * sizeof(XPoint)); - for (l2 = points, i = 0; l2; l2 = l2->next, i++) - { - Evas_Point p; - - p = l2->data; - xpoints[i].x = p->x - up->x; - xpoints[i].y = p->y - up->y; - } - XFillPolygon(disp, up->p, dr->gc, xpoints, - point_count, Complex, - CoordModeOrigin); - free(xpoints); - } - } - } - } - } -} - - - - - - - - - - -/*****************************************************************************/ -/* general externals *********************************************************/ -/*****************************************************************************/ - -void -__evas_x11_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a) -{ - __evas_clip = on; - __evas_clip_x = x; - __evas_clip_y = y; - __evas_clip_w = w; - __evas_clip_h = h; - __evas_clip_r = r; - __evas_clip_g = g; - __evas_clip_b = b; - __evas_clip_a = a; -} - -void -__evas_x11_sync(Display *disp) -{ - XSync(disp, False); -} - -void -__evas_x11_flush_draw(Display *disp, Imlib_Image dstim, Window win) -{ - Evas_List l; - - for(l = drawable_list; l; l = l->next) - { - Evas_X11_Drawable *dr; - - dr = l->data; - - XSetClipMask(disp, dr->gc, None); - XSetClipOrigin(disp, dr->gc, 0, 0); - XSetFillStyle(disp, dr->gc, FillSolid); - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_List ll; - - for (ll = dr->tmp_images; ll; ll = ll->next) - { - Evas_X11_Update *up; - - up = ll->data; - - if (up->p) - { - XCopyArea(disp, up->p, win, dr->gc, - 0, 0, up->w, up->h, up->x, up->y); - XFreePixmap(disp, up->p); - } - free(up); - } - if (dr->tmp_images) - dr->tmp_images = evas_list_free(dr->tmp_images); - } - XFreeGC(disp, dr->gc); - free(dr); - } - if (drawable_list) - drawable_list = evas_list_free(drawable_list); - drawable_list = NULL; -} - -void -__evas_x11_set_vis_cmap(Visual *vis, Colormap cmap) -{ - __evas_visual = vis; - __evas_cmap = cmap; -} - -int -__evas_x11_capable(Display *disp) -{ - return 1; -} - -Visual * -__evas_x11_get_visual(Display *disp, int screen) -{ - int depth; - - __evas_visual = imlib_get_best_visual(disp, screen, &depth); - return __evas_visual; -} - -XVisualInfo * -__evas_x11_get_visual_info(Display *disp, int screen) -{ - static XVisualInfo *vi = NULL; - XVisualInfo vi_template; - int n; - - if (vi) return vi; - vi_template.visualid = (__evas_x11_get_visual(disp, screen))->visualid; - vi_template.screen = screen; - vi = XGetVisualInfo(disp, VisualIDMask | VisualScreenMask, &vi_template ,&n); - return vi; -} - -Colormap -__evas_x11_get_colormap(Display *disp, int screen) -{ - Visual *v; - - if (__evas_cmap) return __evas_cmap; - v = __evas_x11_get_visual(disp, screen); - __evas_cmap = DefaultColormap(disp, screen); - return __evas_cmap; - __evas_cmap = XCreateColormap(disp, RootWindow(disp, screen), v, AllocNone); - return __evas_cmap; -} - -void -__evas_x11_init(Display *disp, int screen, int colors) -{ - static int initted = 0; - - if (!initted) - { - imlib_set_color_usage(216); - imlib_set_font_cache_size(1024 * 1024); - imlib_set_cache_size(8 * 1024 * 1024); - initted = 1; - } - imlib_set_color_usage(colors); -} - -void -__evas_x11_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, - int x, int y, int w, int h) -{ - Evas_List l; - - for(l = drawable_list; l; l = l->next) - { - Evas_X11_Drawable *dr; - - dr = l->data; - - if ((dr->win == win) && (dr->disp == disp)) - { - Evas_X11_Update *up; - - up = malloc(sizeof(Evas_X11_Update)); - up->x = x; - up->y = y; - up->w = w; - up->h = h; - up->p = 0; - dr->tmp_images = evas_list_append(dr->tmp_images, up); - } - return; - } - { - Evas_X11_Drawable *dr; - Evas_X11_Update *up; - GC gc; - XGCValues gcv; - XWindowAttributes att; - - gc = XCreateGC(disp, win, 0, &gcv); - XGetWindowAttributes(disp, win, &att); - dr = malloc(sizeof(Evas_X11_Drawable)); - dr->win = win; - dr->disp = disp; - dr->tmp_images = NULL; - dr->gc = gc; - dr->depth = att.depth; - up = malloc(sizeof(Evas_X11_Update)); - up->x = x; - up->y = y; - up->w = w; - up->h = h; - up->p = 0; - drawable_list = evas_list_append(drawable_list, dr); - dr->tmp_images = evas_list_append(dr->tmp_images, up); - } -} diff --git a/legacy/evas/src/evas_x11_routines.h b/legacy/evas/src/evas_x11_routines.h deleted file mode 100644 index 23d0b5d709..0000000000 --- a/legacy/evas/src/evas_x11_routines.h +++ /dev/null @@ -1,198 +0,0 @@ -#include "config.h" -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifdef HAVE_FREETYPE1_FREETYPE_FREETYPE_H -#include -#else -# ifdef HAVE_FREETYPE_FREETYPE_H -#include -#else -#include -#endif -#endif - -#include "Evas_private.h" -#include "Evas.h" - -#include - -#ifndef SPANS_COMMON -#define SPANS_COMMON(x1, w1, x2, w2) \ -(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1))))) -#define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \ -((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh)))) -#endif - -typedef struct _evas_x11_image Evas_X11_Image; -typedef struct _evas_x11_font Evas_X11_Font; -typedef struct _evas_x11_gradient Evas_X11_Graident; -typedef struct _evas_x11_color Evas_X11_Color; -typedef struct _evas_x11_glyph Evas_X11_Glyph; - -typedef struct _evas_x11_drawable Evas_X11_Drawable; -typedef struct _evas_x11_update Evas_X11_Update; - -struct _evas_x11_drawable -{ - Display *disp; - Window win; - GC gc; - int depth; - Evas_List tmp_images; -}; - -struct _evas_x11_update -{ - Pixmap p; - int x, y, w, h; -}; - -struct _evas_x11_image -{ - GC gc; - Display *disp; - Window win; - int pw, ph, pr, pg, pb, pa; - Pixmap pmap; - Pixmap mask; - int w, h; - int has_alpha; - char *file; - Imlib_Image image; - int references; -}; - -struct _evas_x11_glyph -{ - int glyph_id; - TT_Glyph glyph; - - TT_Glyph_Metrics metrics; - - int pw, ph; - Pixmap pmap; -}; - -struct _evas_x11_font -{ - char *font; - int size; - - Display *disp; - - TT_Engine engine; - TT_Face face; - TT_Instance instance; - TT_Face_Properties properties; - TT_CharMap char_map; - TT_Instance_Metrics metrics; - - Evas_List glyphs[256]; - - int ascent; - int descent; - int max_descent; - int max_ascent; - - int mem_use; - - int references; -}; - -struct _evas_x11_gradient -{ - Evas_List colors; -}; - -struct _evas_x11_color -{ - int r, g, b, a; - int dist; -}; - -/***************/ -/* image stuff */ -/***************/ -Evas_X11_Image *__evas_x11_image_new_from_file(Display *disp, char *file); -void __evas_x11_image_free(Evas_X11_Image *im); -void __evas_x11_image_cache_empty(Display *disp); -void __evas_x11_image_cache_set_size(Display *disp, int size); -int __evas_x11_image_cache_get_size(Display *disp); -int __evas_x11_image_get_width(Evas_X11_Image *im); -int __evas_x11_image_get_height(Evas_X11_Image *im); -void __evas_x11_image_set_borders(Evas_X11_Image *im, int left, int right, int top, int bottom); -void __evas_x11_image_set_smooth_scaling(int on); -void __evas_x11_image_draw(Evas_X11_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int cr, int cg, int cb, int ca); - -/********/ -/* text */ -/********/ -Evas_X11_Font *__evas_x11_text_font_new(Display *disp, char *font, int size); -void __evas_x11_text_font_free(Evas_X11_Font *fn); -int __evas_x11_text_font_get_ascent(Evas_X11_Font *fn); -int __evas_x11_text_font_get_descent(Evas_X11_Font *fn); -int __evas_x11_text_font_get_max_ascent(Evas_X11_Font *fn); -int __evas_x11_text_font_get_max_descent(Evas_X11_Font *fn); -void __evas_x11_text_font_get_advances(Evas_X11_Font *fn, char *text, int *advance_horiz, int *advance_vert); -int __evas_x11_text_font_get_first_inset(Evas_X11_Font *fn, char *text); -void __evas_x11_text_font_add_path(char *path); -void __evas_x11_text_font_del_path(char *path); -char **__evas_x11_text_font_list_paths(int *count); -void __evas_x11_text_cache_empty(Display *disp); -void __evas_x11_text_cache_set_size(Display *disp, int size); -int __evas_x11_text_cache_get_size(Display *disp); -void __evas_x11_text_get_size(Evas_X11_Font *fn, char *text, int *w, int *h); -int __evas_x11_text_get_character_at_pos(Evas_X11_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch); -void __evas_x11_text_get_character_number(Evas_X11_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch); -void __evas_x11_text_draw(Evas_X11_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a); - -/**************/ -/* rectangles */ -/**************/ - -void __evas_x11_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a); - -/*********/ -/* lines */ -/*********/ - -void __evas_x11_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a); - -/*************/ -/* gradients */ -/*************/ -Evas_X11_Graident *__evas_x11_gradient_new(Display *disp); -void __evas_x11_gradient_free(Evas_X11_Graident *gr); -void __evas_x11_gradient_color_add(Evas_X11_Graident *gr, int r, int g, int b, int a, int dist); -void __evas_x11_gradient_draw(Evas_X11_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle); - -/************/ -/* polygons */ -/************/ -void __evas_x11_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a); - -/***********/ -/* drawing */ -/***********/ -void __evas_x11_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a); -void __evas_x11_init(Display *disp, int screen, int colors); -void __evas_x11_set_vis_cmap(Visual *vis, Colormap cmap); -int __evas_x11_capable(Display *disp); -void __evas_x11_flush_draw(Display *disp, Imlib_Image dstim, Window win); -void __evas_x11_sync(Display *disp); -Visual *__evas_x11_get_visual(Display *disp, int screen); -XVisualInfo *__evas_x11_get_visual_info(Display *disp, int screen); -Colormap __evas_x11_get_colormap(Display *disp, int screen); -void __evas_x11_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h); - diff --git a/legacy/evas/test/.cvsignore b/legacy/evas/test/.cvsignore deleted file mode 100644 index 3b9e7ab374..0000000000 --- a/legacy/evas/test/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.icons -Makefile -Makefile.in -evas_test -evas_test_old -.libs -.deps diff --git a/legacy/evas/test/Makefile.am b/legacy/evas/test/Makefile.am deleted file mode 100644 index 6091a95393..0000000000 --- a/legacy/evas/test/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -CFLAGS_X = @x_cflags@ -CFLAGS_EXTRA = -I$(includedir) -I$(top_srcdir) -I$(top_srcdir)/src -I/usr/local/include - -CFLAGS_ALL = $(CFLAGS_X) $(CFLAGS_EXTRA) - -SUBDIRS = fnt img - -INCLUDES = $(CFLAGS_ALL) \ - -DLIBDIR=\"$(libdir)\" \ - -DBINDIR=\"$(bindir)\" \ - -DDATADIR=\"$(datadir)\" - -bin_PROGRAMS = evas_test evas_test_old - -evas_test_DEPENDENCIES = $(top_builddir)/src/libevas.la - -evas_test_SOURCES = evas_test.c - -evas_test_LDFLAGS = -static - -evas_test_LDADD = $(top_builddir)/src/libevas.la - -evas_test_old_DEPENDENCIES = $(top_builddir)/src/libevas.la - -evas_test_old_SOURCES = evas_test_old.c - -evas_test_old_LDFLAGS = -static - -evas_test_old_LDADD = $(top_builddir)/src/libevas.la diff --git a/legacy/evas/test/evas_test.c b/legacy/evas/test/evas_test.c deleted file mode 100644 index 5c105f0452..0000000000 --- a/legacy/evas/test/evas_test.c +++ /dev/null @@ -1,1629 +0,0 @@ -#include "../src/Evas.h" -#include -#include -#include -#include -#include -#include -#include - -/* defines */ -#define IMGDIR DATADIR"/evas/img/" -#define FNTDIR DATADIR"/evas/fnt/" - -#ifndef SPANS_COMMON -#define SPANS_COMMON(x1, w1, x2, w2) \ -(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1))))) -#define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \ -((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh)))) -#endif - -/* global variables */ -Display *display = NULL; -Window win_base = 0, win_control = 0, win_view = 0; -Visual *vis_control = NULL, *vis_view = NULL; -Colormap cmap_control = 0, cmap_view = 0; -Evas evas_control = NULL, evas_view = NULL; -int wait_for_events = 1; - -Evas_Object -o_logo, o_logo_shadow, o_logo_impress, -o_software, o_hardware, o_x11, -o_box1, o_box2, o_box3, -o_brush, o_paint, -o_bubble1, o_shadow1, o_bubble2, o_shadow2, o_bubble3, o_shadow3, -o_fps, o_avg_fps; -int mouse_x, mouse_y; -int framecount = -1; -double last_time = 0; -unsigned long long totalframes = 0; -double totaltime = 0; - -/* prototypes */ -double get_time (void); -void setup (void); -void setup_controls (void); -void setup_view (Evas_Render_Method method); -void animate (double val); -void handle_events (void); - -void mouse_down (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); -void mouse_up (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); -void mouse_move (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); -void mouse_in (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); -void mouse_out (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); - -typedef struct _textblock TextBlock; -typedef struct _imageblock ImageBlock; -typedef struct _codeblock CodeBlock; - -struct _textblock -{ - double time1, time2, time3, time4; - char *text; - Evas_Object o_text, o_shadow; -}; - -struct _imageblock -{ - double time1, time2, time3, time4; - double x, y; - char *file; - Evas_Object o_image; -}; - -struct _codeblock -{ - double time1, time2, time3, time4; - void (*function) (double v, double val, int no); -}; - - -static void -fn_rect(double v, double val, int no) -{ - static Evas_Object o_fn_rects[8] = - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; - static int init = 0; - static int colors[] = - { - 255, 255, 255, 200, - 0, 0, 0, 100, - 200, 30, 30, 200, - 240, 230, 40, 220, - 30, 50, 200, 160, - 50, 220, 60, 100, - 220, 110, 30, 240, - 200, 60, 220, 80 - }; - static double coords[8 * 4]; - static double last_val = 0; - int i; - - if (no) - { - if (last_val != val) - { - for (i = 0; i < 8; i++) - { - if (o_fn_rects[i]) - evas_del_object(evas_view, o_fn_rects[i]); - o_fn_rects[i] = NULL; - } - } - return; - } - if (!init) - { - init = 1; - for (i = 0; i < 8; i++) - { - coords[(i * 4) + 0] = ((1024 - 128) / 2) + ((rand() % 500) - 250); - coords[(i * 4) + 1] = ((768) / 2) + ((rand() % 200) - 0); - coords[(i * 4) + 2] = 30 + (rand() % 300); - coords[(i * 4) + 3] = 20 + (rand() % 180); - } - } - for (i = 0; i < 8; i++) - { - double alpha; - - if (v < 1) - alpha = v; - else if (v < 2) - alpha = 1; - else alpha = (3 - v); - if (!o_fn_rects[i]) - { - o_fn_rects[i] = evas_add_rectangle(evas_view); - evas_set_layer(evas_view, o_fn_rects[i], 99); - } - evas_set_color(evas_view, o_fn_rects[i], - colors[(i * 4) + 0], - colors[(i * 4) + 1], - colors[(i * 4) + 2], - (double)colors[(i * 4) + 3] * alpha); - evas_move(evas_view, o_fn_rects[i], - coords[(i * 4) + 0] + (50 * cos((val * 2.7) + 3.4 + i)), - coords[(i * 4) + 1] + (20 * sin((val * 3.6) + 1.2 + i))); - evas_resize(evas_view, o_fn_rects[i], - coords[(i * 4) + 2], coords[(i * 4) + 3]); - evas_show(evas_view, o_fn_rects[i]); - } - last_val = val; -} - -static void -fn_line(double v, double val, int no) -{ - static Evas_Object o_fn_lines[64]; - static int init = 0; - static int colors[64 * 4]; - static double coords[64 * 4]; - static double last_val = 0; - int i; - - if (!init) - { - init = 1; - for (i = 0; i < 64; i++) - { - o_fn_lines[i] = NULL; - coords[(i * 4) + 0] = ((1024 - 128) / 2) + ((rand() % 500) - 250); - coords[(i * 4) + 1] = ((768) / 2) + ((rand() % 200) - 0); - coords[(i * 4) + 2] = ((1024 - 128) / 2) + ((rand() % 500) - 250); - coords[(i * 4) + 3] = ((768) / 2) + ((rand() % 200) - 0); - colors[(i * 4) + 0] = rand() % 255; - colors[(i * 4) + 1] = rand() % 255; - colors[(i * 4) + 2] = rand() % 255; - colors[(i * 4) + 3] = rand() % 255; - } - } - if (no) - { - if (last_val != val) - { - for (i = 0; i < 64; i++) - { - if (o_fn_lines[i]) - evas_del_object(evas_view, o_fn_lines[i]); - o_fn_lines[i] = NULL; - } - } - return; - } - for (i = 0; i < 64; i++) - { - double alpha; - - if (v < 1) - alpha = v; - else if (v < 2) - alpha = 1; - else alpha = (3 - v); - if (!o_fn_lines[i]) - { - o_fn_lines[i] = evas_add_line(evas_view); - evas_set_layer(evas_view, o_fn_lines[i], 99); - } - evas_set_color(evas_view, o_fn_lines[i], - colors[(i * 4) + 0], - colors[(i * 4) + 1], - colors[(i * 4) + 2], - (double)colors[(i * 4) + 3] * alpha); - evas_set_line_xy(evas_view, o_fn_lines[i], - coords[(i * 4) + 0] + (50 * cos((val * 2.7) + 3.4 + i)), - coords[(i * 4) + 1] + (20 * sin((val * 3.6) + 1.2 + i)), - coords[(i * 4) + 2] + (50 * cos((val * 4.2) + 1.7 + i)), - coords[(i * 4) + 3] + (20 * sin((val * 1.3) + 2.1 + i))); - evas_show(evas_view, o_fn_lines[i]); - } - last_val = val; -} - -static void -fn_poly(double v, double val, int no) -{ - static Evas_Object o_fn_polys[4] = - {NULL, NULL, NULL, NULL}; - static int colors[] = - { - 255, 255, 255, 200, - 0, 0, 0, 100, - 200, 30, 30, 160, - 40, 160, 240, 100 - }; - static double coords[] = - { - 200, 300, - 350, 340, - 320, 500, - 120, 400, - - 500, 400, - 600, 600, - 300, 550, - 330, 447, - - 740, 160, - 800, 300, - 400, 400, - 630, 200, - - 420, 200, - 666, 444, - 333, 300, - 100, 233 - }; - static double last_val = 0; - int i; - - if (no) - { - if (last_val != val) - { - for (i = 0; i < 4; i++) - { - if (o_fn_polys[i]) - evas_del_object(evas_view, o_fn_polys[i]); - o_fn_polys[i] = NULL; - } - } - return; - } - for (i = 0; i < 4; i++) - { - double alpha; - - if (v < 1) - alpha = v; - else if (v < 2) - alpha = 1; - else alpha = (3 - v); - if (!o_fn_polys[i]) - { - int j; - - o_fn_polys[i] = evas_add_poly(evas_view); - for (j = 0; j < 4; j++) - evas_add_point(evas_view, o_fn_polys[i], - coords[(((i * 4) + j) * 2) + 0], - coords[(((i * 4) + j) * 2) + 1]); - evas_set_layer(evas_view, o_fn_polys[i], 99); - } - evas_set_color(evas_view, o_fn_polys[i], - colors[(i * 4) + 0], - colors[(i * 4) + 1], - colors[(i * 4) + 2], - (double)colors[(i * 4) + 3] * alpha); - evas_move(evas_view, o_fn_polys[i], - coords[(i * 4) + 0] + (50 * cos((val * 2.7) + 3.4 + i)), - coords[(i * 4) + 1] + (20 * sin((val * 3.6) + 1.2 + i))); - evas_show(evas_view, o_fn_polys[i]); - } - last_val = val; -} - -static void -fn_text(double v, double val, int no) -{ - static Evas_Object o_fn_strings[8] = - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; - static int colors[] = - { - 255, 255, 255, 200, - 0, 0, 0, 160, - 200, 30, 30, 200, - 40, 160, 240, 220, - 30, 50, 200, 255, - 50, 220, 60, 160, - 220, 110, 30, 240, - 200, 60, 220, 180 - }; - static char *strings[] = - { - "Anti Aliased Text", - "In any color you want", - "With alpha blending too", - "What more could you ask for?", - "Evas", - "Rancid cheese", - "Enlightenment", - "Linux" - }; - static char *fonts[] = - { - "notepad", - "grunge", - "morpheus", - "cinema", - "andover", - "grunge", - "morpheus", - "notepad" - }; - static int sizes[] = - { - 16, - 28, - 34, - 24, - 48, - 8, - 20, - 34 - }; - static double coords[] = - { - 200, 300, - 350, 340, - 320, 500, - 120, 400, - 500, 450, - 600, 600, - 300, 550, - 330, 447 - }; - static double last_val = 0; - int i; - - if (no) - { - if (last_val != val) - { - for (i = 0; i < 8; i++) - { - if (o_fn_strings[i]) - evas_del_object(evas_view, o_fn_strings[i]); - o_fn_strings[i] = NULL; - } - } - return; - } - for (i = 0; i < 8; i++) - { - double alpha; - - if (v < 1) - alpha = v; - else if (v < 2) - alpha = 1; - else alpha = (3 - v); - if (!o_fn_strings[i]) - { - o_fn_strings[i] = evas_add_text(evas_view, fonts[i], sizes[i], strings[i]); - evas_set_layer(evas_view, o_fn_strings[i], 99); - } - evas_set_color(evas_view, o_fn_strings[i], - colors[(i * 4) + 0], - colors[(i * 4) + 1], - colors[(i * 4) + 2], - (double)colors[(i * 4) + 3] * alpha); - evas_move(evas_view, o_fn_strings[i], - coords[(i * 2) + 0] + (50 * cos((val * 2.7) + 3.4 + i)), - coords[(i * 2) + 1] + (20 * sin((val * 3.6) + 1.2 + i))); - evas_show(evas_view, o_fn_strings[i]); - } - last_val = val; -} - -static void -fn_grad(double v, double val, int no) -{ - static Evas_Object o_fn_grads[8] = - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; - static double last_val = 0; - static double coords[8 * 4]; - static int colors[8 * 4 * 4]; - static int init = 0; - int i; - - if (no) - { - if (last_val != val) - { - for (i = 0; i < 8; i++) - { - if (o_fn_grads[i]) - evas_del_object(evas_view, o_fn_grads[i]); - o_fn_grads[i] = NULL; - } - } - return; - } - if (!init) - { - init = 1; - - for (i = 0; i < 8; i++) - { - int j; - - coords[(i * 4) + 0] = ((1024 - 128) / 2) + ((rand() % 500) - 250); - coords[(i * 4) + 1] = ((768) / 2) + ((rand() % 200) - 0); - coords[(i * 4) + 2] = 30 + (rand() % 300); - coords[(i * 4) + 3] = 20 + (rand() % 180); - for (j = 0; j < 4; j++) - { - colors[(i * 4 * 4) + (j * 4) + 0] = rand() & 0xff; - colors[(i * 4 * 4) + (j * 4) + 1] = rand() & 0xff; - colors[(i * 4 * 4) + (j * 4) + 2] = rand() & 0xff; - colors[(i * 4 * 4) + (j * 4) + 3] = ((rand() & 0xff) * (3 - j)) / 3; - } - } - } - for (i = 0; i < 8; i++) - { - double alpha; - - if (v < 1) - alpha = v; - else if (v < 2) - alpha = 1; - else alpha = (3 - v); - if (!o_fn_grads[i]) - { - o_fn_grads[i] = evas_add_gradient_box(evas_view); - evas_set_layer(evas_view, o_fn_grads[i], 99); - } - { - Evas_Gradient grad; - int j; - - grad = evas_gradient_new(); - for (j = 0; j < 4; j++) - evas_gradient_add_color(grad, - colors[(i * 4 * 4) + (j * 4) + 0], - colors[(i * 4 * 4) + (j * 4) + 1], - colors[(i * 4 * 4) + (j * 4) + 2], - (double)colors[(i * 4 * 4) + (j * 4) + 3] * alpha, - 8); - evas_set_gradient(evas_view, o_fn_grads[i], grad); - evas_gradient_free(grad); - } - evas_move(evas_view, o_fn_grads[i], - coords[(i * 4) + 0] + (50 * cos((val * 2.7) + 3.4 + i)), - coords[(i * 4) + 1] + (20 * sin((val * 3.6) + 1.2 + i))); - evas_resize(evas_view, o_fn_grads[i], - coords[(i * 4) + 2], coords[(i * 4) + 3]); - evas_set_angle(evas_view, o_fn_grads[i], (val + (double)i) * 60); - evas_show(evas_view, o_fn_grads[i]); - } - last_val = val; -} - -static void -fn_image(double v, double val, int no) -{ - static Evas_Object o_fn_images[16]; - static double last_val = 0; - static int init = 0; - static double coords[16 * 2]; - - int i; - - if (!init) - { - init = 1; - - for (i = 0; i < 16; i++) - { - o_fn_images[i] = NULL; - coords[(i * 2) + 0] = ((1024 - 128) / 2) + ((rand() % 500) - 250); - coords[(i * 2) + 1] = ((768) / 2) + ((rand() % 200) - 0); - } - } - if (no) - { - if (last_val != val) - { - for (i = 0; i < 16; i++) - { - if (o_fn_images[i]) - evas_del_object(evas_view, o_fn_images[i]); - o_fn_images[i] = NULL; - } - } - return; - } - for (i = 0; i < 16; i++) - { - double alpha, a1; - - if (v < 1) - alpha = v; - else if (v < 2) - alpha = 1; - else alpha = (3 - v); - a1 = 1.0 - alpha; - if (!o_fn_images[i]) - { - char buf[4096]; - - sprintf(buf, IMGDIR"evas_test_image_%i.png", i); - o_fn_images[i] = evas_add_image_from_file(evas_view, buf); - evas_set_layer(evas_view, o_fn_images[i], 99); - } - evas_set_color(evas_view, o_fn_images[i], 255, 255, 255, 255.0 * alpha); - evas_move(evas_view, o_fn_images[i], - coords[(i * 2) + 0] + - ((50 + (a1 * a1 * a1 * a1 * 400)) * - cos((val * 2.7) + 3.4 + i)), - coords[(i * 2) + 1] + - ((20 + (a1 * a1 * a1 * a1 * 400)) * - sin((val * 3.6) + 1.2 + i))); - evas_show(evas_view, o_fn_images[i]); - } - - last_val = val; -} - - -static double codes_loop = 180; -static CodeBlock codes[] = -{ - { 128.0, 2.0, 4.0, 6.0, fn_rect}, - { 132.0, 2.0, 4.0, 6.0, fn_line}, - { 136.0, 2.0, 4.0, 6.0, fn_poly}, - { 140.0, 2.0, 4.0, 6.0, fn_text}, - { 144.0, 2.0, 4.0, 6.0, fn_grad}, - { 148.0, 2.0, 4.0, 6.0, fn_image}, - { 164.0, 4.0, 12.0, 16.0, fn_rect}, - { 164.0, 4.0, 12.0, 16.0, fn_line}, - { 164.0, 4.0, 12.0, 16.0, fn_poly}, - { 164.0, 4.0, 12.0, 16.0, fn_text}, - { 164.0, 4.0, 12.0, 16.0, fn_grad}, - { 164.0, 4.0, 12.0, 16.0, fn_image} -}; -static double texts_loop = 180; -static TextBlock texts[] = -{ - { 10.0, 2.0, 4.0, 6.0, "What are the 7 Wonders of the world?", NULL, NULL}, - { 14.0, 2.0, 4.0, 6.0, "The Temple of Artemis at Ephesus ...", NULL, NULL}, - { 18.0, 2.0, 4.0, 6.0, "The Colossus of Rhodes ...", NULL, NULL}, - { 22.0, 2.0, 4.0, 6.0, "The Hanging Gardens of Babylon ...", NULL, NULL}, - { 26.0, 4.0, 4.0, 6.0, "The Mausoleum at Halicarnassus ...", NULL, NULL}, - { 30.0, 2.0, 4.0, 6.0, "The Lighthouse at Alexandria ...", NULL, NULL}, - { 34.0, 2.0, 4.0, 6.0, "The Great Pyramids at Giza ...", NULL, NULL}, - { 38.0, 2.0, 4.0, 6.0, "The Statue of Zeus at Olympia ...", NULL, NULL}, - - { 46.0, 2.0, 4.0, 6.0, "Is there an 8th wonder?", NULL, NULL}, - - { 52.0, 2.0, 4.0, 6.0, "Yes ...", NULL, NULL}, - { 60.0, 2.0, 8.0, 12.0, "Rancid Cheese", NULL, NULL}, - - { 76.0, 2.0, 4.0, 6.0, "But for those who prefer to code ...", NULL, NULL}, - { 80.0, 2.0, 4.0, 6.0, "There is ...", NULL, NULL}, - { 87.0, 2.0, 6.0, 8.0, "E ", NULL, NULL}, - { 87.5, 2.0, 6.0, 8.0, " V ", NULL, NULL}, - { 88.0, 2.0, 6.0, 8.0, " A ", NULL, NULL}, - { 88.5, 2.0, 6.0, 8.0, " S", NULL, NULL}, - - { 100.0, 2.0, 4.0, 6.0, "Evas is a Canvas ...", NULL, NULL}, - { 104.0, 2.0, 4.0, 6.0, "That supports Anti-Aliasing ...", NULL, NULL}, - { 108.0, 2.0, 4.0, 6.0, "Alpha Blending ...", NULL, NULL}, - { 112.0, 2.0, 4.0, 6.0, "Intel MMX Assembly ...", NULL, NULL}, - { 116.0, 2.0, 4.0, 6.0, "Hardware Acceleration ...", NULL, NULL}, - { 120.0, 2.0, 4.0, 6.0, "For all objects.", NULL, NULL}, - { 124.0, 2.0, 4.0, 6.0, "Evas supports ...", NULL, NULL}, - { 128.0, 2.0, 4.0, 6.0, "Rectangles ...", NULL, NULL}, - { 132.0, 2.0, 4.0, 6.0, "Lines ...", NULL, NULL}, - { 136.0, 2.0, 4.0, 6.0, "Polygons ...", NULL, NULL}, - { 140.0, 2.0, 4.0, 6.0, "Truetype Text ...", NULL, NULL}, - { 144.0, 2.0, 4.0, 6.0, "Gradients ...", NULL, NULL}, - { 148.0, 2.0, 4.0, 6.0, "Images ...", NULL, NULL}, - { 152.0, 2.0, 4.0, 6.0, "And they can all be layered ...", NULL, NULL}, - { 156.0, 2.0, 4.0, 6.0, "Moved and Resized ...", NULL, NULL}, - { 160.0, 2.0, 4.0, 6.0, "Faded in and out ...", NULL, NULL}, - { 164.0, 2.0, 4.0, 6.0, "And much much more ...", NULL, NULL}, -}; -static double images_loop = 180; -static ImageBlock images[] = -{ - { 14.0, 2.0, 4.0, 6.0, 300, 100, IMGDIR"evas_test_wonder_1.png", NULL}, - { 18.0, 2.0, 4.0, 6.0, 100, 200, IMGDIR"evas_test_wonder_2.png", NULL}, - { 22.0, 2.0, 4.0, 6.0, 500, 500, IMGDIR"evas_test_wonder_3.png", NULL}, - { 26.0, 2.0, 4.0, 6.0, 200, 350, IMGDIR"evas_test_wonder_4.png", NULL}, - { 30.0, 2.0, 4.0, 6.0, 400, 0, IMGDIR"evas_test_wonder_5.png", NULL}, - { 34.0, 2.0, 4.0, 6.0, 150, 400, IMGDIR"evas_test_wonder_6.png", NULL}, - { 38.0, 2.0, 4.0, 6.0, 600, 25, IMGDIR"evas_test_wonder_7.png", NULL}, - { 60.0, 2.0, 8.0, 12.0, 400, 100, IMGDIR"evas_test_cheese.png", NULL}, - { 100.0, 2.0, 4.0, 6.0, 300, 50, IMGDIR"evas_test_canvas.png", NULL}, - { 104.0, 2.0, 4.0, 6.0, 500, 420, IMGDIR"evas_test_anti_alias.png", NULL}, - { 108.0, 2.0, 4.0, 6.0, 200, 220, IMGDIR"evas_test_alpha1.png", NULL}, - { 109.0, 2.0, 4.0, 6.0, 200, 220, IMGDIR"evas_test_alpha2.png", NULL}, - { 112.0, 2.0, 4.0, 6.0, 300, 100, IMGDIR"evas_test_mmx.png", NULL}, - { 116.0, 2.0, 4.0, 6.0, 400, 200, IMGDIR"evas_test_hardware.png", NULL} -}; - -/* functions */ -double -get_time(void) -{ - struct timeval timev; - - gettimeofday(&timev, NULL); - return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000); -} - -void -obscure(Evas e) -{ - Display *disp; - Window win, root, parent, *children, www, prev_win; - int x, y, w, h, wx, wy, ww, wh; - unsigned int i, j, num, dummy; - - return; - evas_clear_obscured_rects(e); - win = evas_get_window(e); - disp = evas_get_display(e); - evas_get_drawable_size(e, &ww, &wh); - children = NULL; - XGrabServer(disp); - XQueryTree(disp, win, &root, &parent, &children, &num); - XTranslateCoordinates(disp, win, root, 0, 0, &wx, &wy, &www); - do - { - for (i = 0; i < num; i++) - { - XWindowAttributes att; - - XGetWindowAttributes(disp, children[i], &att); - w = att.width; - h = att.height; - if ((att.map_state != IsUnmapped) && - (att.class == InputOutput)) - { - XRectangle *rect; - int r_num, ord; - int ok; - - ok = 1; - rect = XShapeGetRectangles(disp, children[i], ShapeBounding, - &r_num, &ord); - if (rect) - { - if ((r_num == 1) && - (rect[0].x == 0) && (rect[0].y == 0) && - (rect[0].width == w) && (rect[0].height == h)) - ok = 1; - else - ok = 0; - XFree(rect); - } - if (ok) - { - XTranslateCoordinates(disp, children[i], root, 0, 0, &x, &y, &www); - if (win == evas_get_window(e)) - { - evas_add_obscured_rect(e, x - wx, y - wy, w, h); - } - else if (children[i] != prev_win) - { - int isbelow; - - isbelow = 0; - for (j = i + 1; j < num; j++) - if (children[j] == prev_win) isbelow = 1; - if (!isbelow) - { - evas_add_obscured_rect(e, x - wx, y - wy, w, h); - } - } - } - } - } - prev_win = win; - if (children) XFree(children); - if (win == root) break; - win = parent; - children = NULL; - parent = 0; - XQueryTree(disp, win, &root, &parent, &children, &num); - } - while (1); - XUngrabServer(disp); - XSync(disp, False); -} - -void -set_blank_pointer(Display *d, Window w) -{ - Cursor c; - XColor cl; - Pixmap p, m; - GC gc; - XGCValues gcv; - - p = XCreatePixmap(d, w, 1, 1, 1); - m = XCreatePixmap(d, w, 1, 1, 1); - gc = XCreateGC(d, m, 0, &gcv); - XSetForeground(d, gc, 0); - XDrawPoint(d, m, gc, 0, 0); - XFreeGC(d, gc); - c = XCreatePixmapCursor(d, p, m, &cl, &cl, 0, 0); - XDefineCursor(d, w, c); - XFreeCursor(d, c); - XFreePixmap(d, p); - XFreePixmap(d, m); -} - -void -setup(void) -{ - XSetWindowAttributes att; - XSizeHints hnt; - XClassHint *xch; - - display = XOpenDisplay(NULL); - - att.background_pixel = 0; - att.colormap = cmap_control; - att.border_pixel = 0; - att.event_mask = 0; - win_base = XCreateWindow(display, - RootWindow(display, DefaultScreen(display)), - 0, 0, 1024, 768, 0, - DefaultDepth(display, DefaultScreen(display)), - InputOutput, - DefaultVisual(display, DefaultScreen(display)), - CWColormap | CWBorderPixel | CWEventMask | CWBackPixel, - &att); - set_blank_pointer(display, win_base); - XStoreName(display, win_base, "Evas Test Program"); - hnt.flags = USSize | PSize | PMinSize | PMaxSize; - hnt.width = 1024; - hnt.height = 768; - hnt.min_width = 1024; - hnt.max_width = 1024; - hnt.min_height = 768; - hnt.max_height = 768; - XSetWMNormalHints(display, win_base, &hnt); - xch = XAllocClassHint(); - xch->res_name = "Main"; - xch->res_class = "Evas_Test"; - XSetClassHint(display, win_base, xch); - XFree(xch); - - evas_control = evas_new_all(display, win_base, 0, 0, 128,768, - RENDER_METHOD_ALPHA_SOFTWARE, 216, - 4 * 1024 * 1024, 8 * 1024 * 1024, - FNTDIR); - win_control = evas_get_window(evas_control); - - XSelectInput(display, win_control, ButtonPressMask | - ButtonReleaseMask | PointerMotionMask | ExposureMask | - EnterWindowMask | LeaveWindowMask | VisibilityChangeMask); - - XMapWindow(display, win_control); - XMapWindow(display, win_base); - - setup_controls(); - setup_view(RENDER_METHOD_ALPHA_SOFTWARE); -} - -void -setup_controls(void) -{ - Evas_Object o; - Evas e; - double ascent, descent; - - e = evas_control; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_control_bg.png"); - evas_move(e, o, 0, 0); - evas_resize(e, o, 128, 768); - evas_set_image_fill(e, o, 0, 0, 128, 768); - evas_set_layer(e, o, -999); - evas_show(e, o); - - o = evas_add_image_from_file(e, IMGDIR"evas_test_control_selection1.png"); - evas_set_image_border(e, o, 3, 3, 3, 3); - evas_show(e, o); - o_box1 = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_control_selection1.png"); - evas_set_image_border(e, o, 3, 3, 3, 3); - evas_show(e, o); - o_box2 = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_control_selection1.png"); - evas_set_image_border(e, o, 3, 3, 3, 3); - evas_show(e, o); - o_box3 = o; - - o = evas_add_text(e, "andover", 28, "Software"); - evas_set_color(e, o, 0, 0, 0, 160); - evas_move(e, o, 8, 44); - evas_show(e, o); - evas_text_get_max_ascent_descent(e, o, &ascent, &descent); - evas_callback_add(e, o, CALLBACK_MOUSE_DOWN, mouse_down, NULL); - evas_callback_add(e, o, CALLBACK_MOUSE_UP, mouse_up, NULL); - evas_callback_add(e, o, CALLBACK_MOUSE_IN, mouse_in, NULL); - evas_callback_add(e, o, CALLBACK_MOUSE_OUT, mouse_out, NULL); - o_software = o; - evas_move(e, o_box1, 4, 42); - evas_resize(e, o_box1, 114, ascent - descent + 4); - evas_set_image_fill(e, o_box1, 0, 0, 114, ascent - descent + 4); - - o = evas_add_text(e, "andover", 28, "Hardware"); - evas_set_color(e, o, 0, 0, 0, 160); - evas_move(e, o, 8, 44 + 8 + (ascent - descent)); - evas_show(e, o); - evas_text_get_max_ascent_descent(e, o, &ascent, &descent); - evas_callback_add(e, o, CALLBACK_MOUSE_DOWN, mouse_down, NULL); - evas_callback_add(e, o, CALLBACK_MOUSE_UP, mouse_up, NULL); - evas_callback_add(e, o, CALLBACK_MOUSE_IN, mouse_in, NULL); - evas_callback_add(e, o, CALLBACK_MOUSE_OUT, mouse_out, NULL); - o_hardware = o; - evas_move(e, o_box2, 4, 42 + 8 + (ascent - descent)); - evas_resize(e, o_box2, 114, ascent - descent + 4); - evas_set_image_fill(e, o_box2, 0, 0, 114, ascent - descent + 4); - - o = evas_add_text(e, "andover", 28, "Basic X11"); - evas_set_color(e, o, 0, 0, 0, 160); - evas_move(e, o, 8, 44 + 16 + ((ascent - descent) * 2)); - evas_show(e, o); - evas_text_get_max_ascent_descent(e, o, &ascent, &descent); - evas_callback_add(e, o, CALLBACK_MOUSE_DOWN, mouse_down, NULL); - evas_callback_add(e, o, CALLBACK_MOUSE_UP, mouse_up, NULL); - evas_callback_add(e, o, CALLBACK_MOUSE_IN, mouse_in, NULL); - evas_callback_add(e, o, CALLBACK_MOUSE_OUT, mouse_out, NULL); - o_x11 = o; - evas_move(e, o_box3, 4, 42 + 16 + ((ascent - descent) * 2)); - evas_resize(e, o_box3, 114, ascent - descent + 4); - evas_set_image_fill(e, o_box3, 0, 0, 114, ascent - descent + 4); - - o = evas_add_image_from_file(e, IMGDIR"evas_test_pointer.png"); - evas_set_pass_events(e, o, 1); - evas_set_layer(e, o, 1000); - evas_object_set_name(e, o, "pointer"); -} - -void -setup_view(Evas_Render_Method method) -{ - XSetWindowAttributes att; - Evas_Object o; - Evas e; - int w, h, i; - double x, y; - - e = evas_new_all(display, win_base, 128, 0, 1024 - 128, 768, - method, 216, 4 * 1024 * 1024, 4 * 1024 * 1024, - FNTDIR); -/* - if (method == RENDER_METHOD_BASIC_HARDWARE) - evas_set_scale_smoothness(e, 0); - else - */ - evas_set_scale_smoothness(e, 1); - win_view = evas_get_window(e); - XSelectInput(display, win_view, ButtonPressMask | - ButtonReleaseMask | PointerMotionMask | ExposureMask | - EnterWindowMask | LeaveWindowMask | VisibilityChangeMask); - XMapWindow(display, win_view); - - for (i = 0; i < (sizeof(texts) / sizeof(TextBlock)); i++) texts[i].o_text = NULL; - for (i = 0; i < (sizeof(images) / sizeof(ImageBlock)); i++) images[i].o_image = NULL; - for (i = 0; i < (sizeof(codes) / sizeof(CodeBlock)); i++) codes[i].function(0, 0, 1); - if (evas_view) evas_free(evas_view); - evas_view = e; - - o = evas_add_text(e, "andover", 20, "FPS: ???"); - evas_set_color(e, o, 255, 255, 255, 140); - evas_move(e, o, 0, 0); - evas_show(e, o); - o_fps = o; - - o = evas_add_text(e, "andover", 20, "Total Average FPS: ???"); - evas_set_color(e, o, 255, 255, 255, 140); - evas_get_geometry(e, o, NULL, NULL, NULL, &y); - evas_move(e, o, 0, 768 - y); - evas_show(e, o); - o_avg_fps = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_bg.png"); - evas_move(e, o, 0, 0); - evas_resize(e, o, 1024 - 128, 768); - evas_set_layer(e, o, -999); - evas_show(e, o); - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_logo.png"); - evas_get_image_size(e, o, &w, &h); - x = (1024 - 128 - w) / 2; y = (768 - h) / 2; - evas_move(e, o, x, y); - evas_set_layer(e, o, 101); - o_logo = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_logo_impress.png"); - evas_get_image_size(e, o, &w, &h); - x = (1024 - 128 - w) / 2; y = (768 - h) / 2; - evas_move(e, o, x, y); - evas_set_layer(e, o, 98); - o_logo_impress = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_logo_shadow.png"); - evas_get_image_size(e, o, &w, &h); - x += 10; y += 10; - evas_move(e, o, x, y); - evas_set_layer(e, o, 100); - o_logo_shadow = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_logo_image_paint.png"); - evas_get_image_size(e, o, &w, &h); - x = (1024 - 128 - w) / 2; y = (768 - h) / 2; - evas_move(e, o, 0, 0); - evas_set_layer(e, o, 98); - o_paint = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_logo_image_brush.png"); - evas_get_image_size(e, o, &w, &h); - x = (1024 - 128 - w) / 2; y = (768 - h) / 2; - evas_move(e, o, 0, 0); - evas_set_layer(e, o, 99); - o_brush = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_bubble.png"); - evas_move(e, o, 0, 0); - evas_set_layer(e, o, 102); - o_bubble1 = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_bubble_shadow.png"); - evas_move(e, o, 0, 0); - evas_set_layer(e, o, 100); - o_shadow1 = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_bubble.png"); - evas_move(e, o, 0, 0); - evas_set_layer(e, o, 102); - o_bubble2 = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_bubble_shadow.png"); - evas_move(e, o, 0, 0); - evas_set_layer(e, o, 100); - o_shadow2 = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_bubble.png"); - evas_move(e, o, 0, 0); - evas_set_layer(e, o, 102); - o_bubble3 = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_view_bubble_shadow.png"); - evas_move(e, o, 0, 0); - evas_set_layer(e, o, 100); - o_shadow3 = o; - - o = evas_add_image_from_file(e, IMGDIR"evas_test_pointer.png"); - evas_set_pass_events(e, o, 1); - evas_set_layer(e, o, 1000); - evas_object_set_name(e, o, "pointer"); -} - -void -code(double val) -{ - int i; - - if (codes_loop > 0) - { - while (val > codes_loop) val -= codes_loop; - } - for (i = 0; i < (sizeof(codes) / sizeof(CodeBlock)); i++) - { - if ((val >= codes[i].time1) && (val <= (codes[i].time1 + codes[i].time4))) - { - double v; - - v = 0; - if (val <= (codes[i].time1 + codes[i].time2)) - v = ((val - codes[i].time1) / (codes[i].time2)); - else if (val <= (codes[i].time1 + codes[i].time3)) - v = 1 + ((val - codes[i].time1 - codes[i].time2) / (codes[i].time3 - codes[i].time2)); - else - v = 2.0 + ((val - codes[i].time1 - codes[i].time3) / (codes[i].time4 - codes[i].time3)); - codes[i].function(v, val, 0); - } - else - codes[i].function(0, val, 1); - } -} - -void -image(double val) -{ - int i; - - if (images_loop > 0) - { - while (val > images_loop) val -= images_loop; - } - for (i = 0; i < (sizeof(images) / sizeof(ImageBlock)); i++) - { - if (!images[i].o_image) - { - images[i].o_image = evas_add_image_from_file(evas_view, images[i].file); - evas_set_layer(evas_view, images[i].o_image, 97); - } - if ((val >= images[i].time1) && (val <= (images[i].time1 + images[i].time4))) - { - double tw, th, dx, dy, x, y; - double alpha, a1; - - alpha = 255; - if (val <= (images[i].time1 + images[i].time2)) - alpha = ((val - images[i].time1) / - (images[i].time2)); - else if (val <= (images[i].time1 + images[i].time3)) - alpha = 1; - else - alpha = 1.0 - ((val - images[i].time1 - images[i].time3) / - (images[i].time4 - images[i].time3)); - a1 = 1 - alpha; - dx = (a1 * a1 * a1 * a1) * 500 * sin(val * 2.3); - dy = (a1 * a1 * a1 * a1) * 600 * cos(val * 3.7); - evas_move(evas_view, images[i].o_image, images[i].x, images[i].y); - evas_set_color(evas_view, images[i].o_image, 255, 255, 255, 255 * alpha); - evas_show(evas_view, images[i].o_image); - } - else - { - evas_hide(evas_view, images[i].o_image); - } - } -} - -void -text(double val) -{ - int i; - - if (texts_loop > 0) - { - while (val > texts_loop) val -= texts_loop; - } - for (i = 0; i < (sizeof(texts) / sizeof(TextBlock)); i++) - { - if (!texts[i].o_text) - { - texts[i].o_text = evas_add_text(evas_view, "andover", 64, texts[i].text); - texts[i].o_shadow = evas_add_text(evas_view, "andover", 64, texts[i].text); - evas_set_color(evas_view, texts[i].o_text, 255, 255, 255, 255); - evas_set_layer(evas_view, texts[i].o_text, 101); - evas_set_color(evas_view, texts[i].o_shadow, 0, 0, 0, 128); - evas_set_layer(evas_view, texts[i].o_shadow, 100); - } - if ((val >= texts[i].time1) && (val <= (texts[i].time1 + texts[i].time4))) - { - double tw, th, dx, dy, x, y; - double alpha, a1; - - alpha = 255; - if (val <= (texts[i].time1 + texts[i].time2)) - alpha = ((val - texts[i].time1) / - (texts[i].time2)); - else if (val <= (texts[i].time1 + texts[i].time3)) - alpha = 1; - else - alpha = 1.0 - ((val - texts[i].time1 - texts[i].time3) / - (texts[i].time4 - texts[i].time3)); - a1 = 1 - alpha; - dx = (a1 * a1 * a1 * a1) * 500 * sin(val * 2.3); - dy = (a1 * a1 * a1 * a1) * 600 * cos(val * 3.7); - evas_get_geometry(evas_view, texts[i].o_text, NULL, NULL, &tw, &th); - x = ((1024 - 128 - tw) / 2) + dx; - y = ((768 - th) / 2) + dy; - evas_move(evas_view, texts[i].o_text, x, y); - evas_move(evas_view, texts[i].o_shadow, - x - ((mouse_x - (x + (tw / 2))) / 16), - y - ((mouse_y - (y + (th / 2))) / 16)); - evas_set_color(evas_view, texts[i].o_text, 255, 255, 255, 255 * alpha); - evas_set_color(evas_view, texts[i].o_shadow, 0, 0, 0, 255 * alpha / 2); - evas_show(evas_view, texts[i].o_text); - evas_show(evas_view, texts[i].o_shadow); - } - else - { - evas_hide(evas_view, texts[i].o_text); - evas_hide(evas_view, texts[i].o_shadow); - } - } -} - -void -animate(double val) -{ - double x, y, z, r; - int w, h; - Evas_Object o; - - framecount++; - if ((val - last_time) >= 2.0) - { - double fps; - char buf[256]; - - fps = (double)framecount / (val - last_time); - sprintf(buf, "FPS: %3.2f", fps); - printf("%s\n", buf); - evas_set_text(evas_view, o_fps, buf); - framecount = -1; - last_time = val; - } - o = evas_object_get_named(evas_view, "pointer"); - if (o) - { - evas_move(evas_view, o, mouse_x, mouse_y); - if (evas_pointer_in(evas_view) || evas_pointer_in(evas_control)) - evas_show(evas_view, o); - } - o = evas_object_get_named(evas_control, "pointer"); - if (o) - { - evas_move(evas_control, o, mouse_x + 128, mouse_y); - if (evas_pointer_in(evas_view) || evas_pointer_in(evas_control)) - evas_show(evas_control, o); - } - - evas_get_image_size(evas_view, o_logo, &w, &h); - if (val < 20) - { - x = ((1024 - 128) / 2) + ((((20 - val) * 256) / 20) * cos((val * 3.141592654 * 2 / 100) * 27)); - y = (768 / 2) + ((((20 - val) * 256) / 20) * sin((val * 3.141592654 * 2 / 100) * 16)); - } - else if (val < 30) - { - evas_set_color(evas_view, o_logo, 255, 255, 255, - (255 * (10 - (val - 20))) / 10); - evas_set_color(evas_view, o_logo_shadow, 255, 255, 255, - (255 * (10 - (val - 20))) / 10); - x = ((1024 - 128) / 2); - y = (768 / 2); -/* wait_for_events = 1;*/ - } - else if (val < 40) - { - evas_hide(evas_view, o_logo); - evas_hide(evas_view, o_logo_shadow); - } - else if (val < 70) - { - evas_hide(evas_view, o_logo); - evas_hide(evas_view, o_logo_shadow); - evas_set_color(evas_view, o_logo_impress, 255, 255, 255, - (255 * (val - 40)) / 60); - } - else - { - evas_set_color(evas_view, o_logo_impress, 255, 255, 255, - 128); - } - if (val < 30) - { - double w, h; - - evas_get_geometry(evas_view, o_logo_shadow, NULL, NULL, &w, &h); - evas_move(evas_view, o_logo, x - (w / 2), y - (h / 2)); - evas_move(evas_view, o_logo_shadow, - x - (w / 2) - ((mouse_x - (x + (w / 2))) / 16), - y - (h / 2) - ((mouse_y - (y + (h / 2))) / 16)); - } - r = 48; - z = ((2 + sin(val * 6 + (3.14159 * 0))) / 3) * 64; - x = (1024 - 128 - 32 - r) + (cos(val * 4 + (3.14159 * 0)) * r) - (z / 2); - y = (r + 32) + (sin(val * 6 + (3.14159 * 0)) * r) - (z / 2); - evas_resize(evas_view, o_bubble1, z, z); - evas_set_image_fill(evas_view, o_bubble1, 0, 0, z, z); - evas_move(evas_view, o_bubble1, x, y); - evas_resize(evas_view, o_shadow1, z, z); - evas_set_image_fill(evas_view, o_shadow1, 0, 0, z, z); - evas_move(evas_view, o_shadow1, - x - ((mouse_x - (x + (z / 2))) / 16) + (z / 2), - y - ((mouse_y - (y + (z / 2))) / 16) + (z / 2)); - z = ((2 + sin(val * 6 + (3.14159 * 0.66))) / 3) * 64; - x = (1024 - 128 - 32 - r) + (cos(val * 4 + (3.14159 * 0.66)) * r) - (z / 2); - y = (r + 32) + (sin(val * 6 + (3.14159 * 0.66)) * r) - (z / 2); - evas_resize(evas_view, o_bubble2, z, z); - evas_set_image_fill(evas_view, o_bubble2, 0, 0, z, z); - evas_move(evas_view, o_bubble2, x, y); - evas_resize(evas_view, o_shadow2, z, z); - evas_set_image_fill(evas_view, o_shadow2, 0, 0, z, z); - evas_move(evas_view, o_shadow2, - x - ((mouse_x - (x + (z / 2))) / 16) + (z / 2), - y - ((mouse_y - (y + (z / 2))) / 16) + (z / 2)); - z = ((2 + sin(val * 6 + (3.14159 * 1.33))) / 3) * 64; - x = (1024 - 128 - 32 - r) + (cos(val * 4 + (3.14159 * 1.33)) * r) - (z / 2); - y = (r + 32) + (sin(val * 6 + (3.14159 * 1.33)) * r) - (z / 2); - evas_resize(evas_view, o_bubble3, z, z); - evas_set_image_fill(evas_view, o_bubble3, 0, 0, z, z); - evas_move(evas_view, o_bubble3, x, y); - evas_resize(evas_view, o_shadow3, z, z); - evas_set_image_fill(evas_view, o_shadow3, 0, 0, z, z); - evas_move(evas_view, o_shadow3, - x - ((mouse_x - (x + (z / 2))) / 16) + (z / 2), - y - ((mouse_y - (y + (z / 2))) / 16) + (z / 2)); - if (val < 8) - { - evas_get_image_size(evas_view, o_paint, &w, &h); - x = (1024 - 128 - w) / 2; y = (768 - h) / 2; - evas_move(evas_view, o_paint, x, y); - } - if (val < 5) - { - double brush_x[500], brush_y[500]; - int i; - const double points[15][2] = - { - { 10, -18}, - {-18, 15}, - { 25, -13}, - { 15, 20}, - { 30, 5}, - { 34, 17}, - { 38, 15}, - { 38, 27}, - { 45, 16}, - { 48, 23}, - { 55, 23}, - { 56, 31}, - { 63, 33}, - { 100, 50}, - { 150, 75} - }; - - evas_set_color(evas_view, o_paint, 255, 255, 255, (val * 255) / 5); - evas_get_image_size(evas_view, o_brush, &w, &h); - x = ((1024 - 128) - w) / 2; - y = (768 - h) / 2; - - for (i = 0; i < 500; i++) - { - int j; - double a; - - j = (i * 13) / 500; - a = (double)(((double)i * 13) / 500) - (double)j; - a = 0.5 + (sin((a - 0.5) * 3.141592654) / 2); - brush_x[i] = ((1.0 - a) * points[j][0]) + (a * points[j + 1][0]); - brush_y[i] = ((1.0 - a) * points[j][1]) + (a * points[j + 1][1]); - } - - x += brush_x[(int)(val * 100)]; - y += brush_y[(int)(val * 100)]; - - evas_move(evas_view, o_brush, x, y); - if (val > 4) - evas_set_color(evas_view, o_brush, 255, 255, 255, (1 - (val - 4)) * 255); - } - else if (val < 8) - { - evas_get_image_size(evas_view, o_brush, &w, &h); - x = ((1024 - 128) - w) / 2; - y = (768 - h) / 2; - evas_move(evas_view, o_brush, x, y); - evas_set_color(evas_view, o_paint, 255, 255, 255, 255); - evas_set_color(evas_view, o_brush, 255, 255, 255, ((val - 5) * 255) / 3); - } - else if (val < 15) - { - double a; - - evas_get_image_size(evas_view, o_brush, &w, &h); - x = ((1024 - 128) - w) / 2; - y = (768 - h) / 2; - a = (7 - (val - 8)) / 7; - a = 0.5 + (sin((a - 0.5) * 3.141592654) / 2); - x *= a; - y *= a; - evas_set_color(evas_view, o_brush, 255, 255, 255, 255); - evas_move(evas_view, o_brush, x, y); - evas_move(evas_view, o_paint, x, y); - } - if (val < 30) - { - evas_show(evas_view, o_logo); - evas_show(evas_view, o_logo_shadow); - } - if (val > 40) - { - evas_show(evas_view, o_logo_impress); - } - evas_show(evas_view, o_paint); - evas_show(evas_view, o_brush); - evas_show(evas_view, o_bubble1); - evas_show(evas_view, o_shadow1); - evas_show(evas_view, o_bubble2); - evas_show(evas_view, o_shadow2); - evas_show(evas_view, o_bubble3); - evas_show(evas_view, o_shadow3); - - text(val); - image(val); - code(val); -} - -void -handle_events(void) -{ - double val, t1, t2; - - val = 0.0; - t1 = get_time(); - wait_for_events = 0; - for (;;) - { - XEvent ev; - Evas e = NULL; - int had_expose; - - had_expose = 0; - /* input events */ - do - { - int event_ok; - event_ok = 0; - if (wait_for_events) - { - XNextEvent(display, &ev); - event_ok = 1; - } - else - { - if (XPending(display)) - { - XNextEvent(display, &ev); - event_ok = 1; - } - XSync(display, False); - } - if (event_ok) - { - if (ev.xany.window == win_control) e = evas_control; - else if (ev.xany.window == win_view) e = evas_view; - if (e) - { - switch(ev.type) - { - case ButtonPress: - evas_event_button_down(e, ev.xbutton.x, ev.xbutton.y, ev.xbutton.button); - break; - case ButtonRelease: - evas_event_button_up(e, ev.xbutton.x, ev.xbutton.y, ev.xbutton.button); - break; - case MotionNotify: - if (e == evas_view) - { - mouse_x = ev.xmotion.x; - mouse_y = ev.xmotion.y; - } - else if (e == evas_control) - { - mouse_x = ev.xmotion.x - 128; - mouse_y = ev.xmotion.y; - } - evas_event_move(e, ev.xmotion.x, ev.xmotion.y); - break; - case Expose: - had_expose = 1; - evas_update_rect(e, ev.xexpose.x, ev.xexpose.y, ev.xexpose.width, ev.xexpose.height); - break; - case VisibilityNotify: -/* - if (ev.xvisibility.state == VisibilityUnobscured) - { - evas_clear_obscured_rects(e); - } - else if (ev.xvisibility.state == VisibilityFullyObscured) - { - int w, h; - - evas_get_drawable_size(e, &w, &h); - evas_clear_obscured_rects(e); - evas_add_obscured_rect(e, 0, 0, w, h); - } - else if (ev.xvisibility.state == VisibilityPartiallyObscured) - { - obscure(e); - } - */ - break; - case EnterNotify: - if (e == evas_view) - { - mouse_x = ev.xcrossing.x; - mouse_y = ev.xcrossing.y; - } - else if (e == evas_control) - { - mouse_x = ev.xcrossing.x - 128; - mouse_y = ev.xcrossing.y; - } - evas_event_move(e, ev.xmotion.x, ev.xmotion.y); - if (e == evas_view) - { - Evas_Object o; - - o = evas_object_get_named(evas_view, "pointer"); - if (o) evas_show(evas_view, o); - } - if (e == evas_control) - { - Evas_Object o; - - o = evas_object_get_named(evas_control, "pointer"); - if (o) evas_show(evas_control, o); - } - if (e == evas_view) - evas_event_enter(evas_view); - else if (e == evas_control) - evas_event_enter(evas_control); - break; - case LeaveNotify: - { - XEvent ev_next; - - if (XCheckTypedEvent(display, EnterNotify, &ev_next)) - { - XPutBackEvent(display, &ev_next); - } - else - { - if (e == evas_view) - { - Evas_Object o; - - o = evas_object_get_named(evas_view, "pointer"); - if (o) evas_hide(evas_view, o); - } - if (e == evas_control) - { - Evas_Object o; - - o = evas_object_get_named(evas_control, "pointer"); - if (o) evas_hide(evas_control, o); - } - } - } - if (e == evas_view) - evas_event_leave(evas_view); - else if (e == evas_control) - evas_event_leave(evas_control); - break; - default: - break; - } - } - } - } - while (XPending(display)); - /* stuff to do outside events */ - animate(val); - if (had_expose) - { -/* obscure(evas_control);*/ - obscure(evas_view); - } - /* display any changes */ - evas_render(evas_control); - evas_render(evas_view); - totalframes++; - /* caluclate time taken since the last render */ - t2 = get_time(); - val += t2 - t1; - totaltime += t2 - t1; - t1 = t2; - if (totaltime > texts_loop) - { - double fps; - char buf[256]; - - fps = (double)totalframes / totaltime; - sprintf(buf, "Total Average FPS: %3.2f", fps); - evas_set_text(evas_view, o_avg_fps, buf); - printf("Total Average FPS: %3.2f\n", fps); - totalframes = 0; - totaltime = 0; - } - } -} - -/* callbacks */ -void -mouse_down (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) -{ - if ((_e == evas_control) && - ((_o == o_software) || (_o == o_hardware) || (_o == o_x11))) - { - double w, h; - - evas_set_color(_e, _o, 255, 255, 255, 255); - if (_o == o_software) - { - evas_get_geometry(_e, o_box1, NULL, NULL, &w, &h); - evas_set_image_file(_e, o_box1, IMGDIR"evas_test_control_selection2.png"); - evas_resize(_e, o_box1, w, h); - evas_set_image_fill(_e, o_box1, 0, 0, w, h); - } - else if (_o == o_hardware) - { - evas_get_geometry(_e, o_box2, NULL, NULL, &w, &h); - evas_set_image_file(_e, o_box2, IMGDIR"evas_test_control_selection2.png"); - evas_resize(_e, o_box2, w, h); - evas_set_image_fill(_e, o_box2, 0, 0, w, h); - } - else if (_o == o_x11) - { - evas_get_geometry(_e, o_box3, NULL, NULL, &w, &h); - evas_set_image_file(_e, o_box3, IMGDIR"evas_test_control_selection2.png"); - evas_resize(_e, o_box3, w, h); - evas_set_image_fill(_e, o_box3, 0, 0, w, h); - } - } -} - -void -mouse_up (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) -{ - if ((_e == evas_control) && - ((_o == o_software) || (_o == o_hardware) || (_o == o_x11))) - { - double w, h; - - evas_set_color(_e, _o, 0, 0, 0, 255); - if (_o == o_software) - { - evas_get_geometry(_e, o_box1, NULL, NULL, &w, &h); - evas_set_image_file(_e, o_box1, IMGDIR"evas_test_control_selection1.png"); - evas_resize(_e, o_box1, w, h); - evas_set_image_fill(_e, o_box1, 0, 0, w, h); - setup_view(RENDER_METHOD_ALPHA_SOFTWARE); - } - else if (_o == o_hardware) - { - evas_get_geometry(_e, o_box2, NULL, NULL, &w, &h); - evas_set_image_file(_e, o_box2, IMGDIR"evas_test_control_selection1.png"); - evas_resize(_e, o_box2, w, h); - evas_set_image_fill(_e, o_box2, 0, 0, w, h); - setup_view(RENDER_METHOD_3D_HARDWARE); - } - else if (_o == o_x11) - { - evas_get_geometry(_e, o_box3, NULL, NULL, &w, &h); - evas_set_image_file(_e, o_box3, IMGDIR"evas_test_control_selection1.png"); - evas_resize(_e, o_box3, w, h); - evas_set_image_fill(_e, o_box3, 0, 0, w, h); - setup_view(RENDER_METHOD_BASIC_HARDWARE); - } - } -} - -void -mouse_move (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) -{ -} - -void -mouse_in (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) -{ - if ((_e == evas_control) && - ((_o == o_software) || (_o == o_hardware) || (_o == o_x11))) - evas_set_color(_e, _o, 0, 0, 0, 255); -} - -void -mouse_out (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) -{ - if ((_e == evas_control) && - ((_o == o_software) || (_o == o_hardware) || (_o == o_x11))) - evas_set_color(_e, _o, 0, 0, 0, 160); -} - -/* Mr. main */ -int -main(int argc, char **argv) -{ - setup(); - handle_events(); -} diff --git a/legacy/evas/test/evas_test_old.c b/legacy/evas/test/evas_test_old.c deleted file mode 100644 index 9ceac7e469..0000000000 --- a/legacy/evas/test/evas_test_old.c +++ /dev/null @@ -1,436 +0,0 @@ -#include "../src/Evas.h" -#include -#include -#include -#include -#include - -#define IMGDIR DATADIR"/evas/img/" -#define FNTDIR DATADIR"/evas/fnt/" - -double get_time(void); - -double -get_time(void) -{ - struct timeval timev; - - gettimeofday(&timev, NULL); - return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000); -} - - -/* callbacks for logo object */ - -void -mouse_down (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) -{ - evas_put_data(_e, _o, "clicked", (void *)1); - evas_put_data(_e, _o, "x", (void *)_x); - evas_put_data(_e, _o, "y", (void *)_y); - evas_set_layer(_e, _o, 200); -} - -void -mouse_up (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) -{ - evas_remove_data(_e, _o, "clicked"); - evas_set_layer(_e, _o, 50); -} - -void -mouse_move (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) -{ - if (evas_get_data(_e, _o, "clicked")) - { - double ox, oy; - int x, y; - - evas_get_geometry(_e, _o, &ox, &oy, NULL, NULL); - x = evas_get_data(_e, _o, "x"); - y = evas_get_data(_e, _o, "y"); - evas_put_data(_e, _o, "x", (void *)_x); - evas_put_data(_e, _o, "y", (void *)_y); - evas_move(_e, _o, ox + _x - x, oy + _y - y); - } -} - -void -mouse_in (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) -{ -} - -void -mouse_out (void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) -{ -} - -/* done with callbacks */ - - -int -main(int argc, char **argv) -{ - Imlib_Image buffer = NULL; - Display *d; - Visual *vis; - Colormap cmap; - Window win; - int win_w, win_h; - int i, a, w, h, m; - Evas e; - Evas_Object o[128], o_rect, o_line, o_grad, o_fps, o_text, o_poly; - Evas_Gradient grad; - int down; - double t0, t1, t2; - char *save_file = NULL; - char *imgs[8] = - { - IMGDIR"mush.png", - IMGDIR"book.png", - IMGDIR"bulb.png", - IMGDIR"term.png", - IMGDIR"calc.png", - IMGDIR"worlds.png", - IMGDIR"spider.png", - IMGDIR"mouse.png" - }; - - win_w = 640; win_h = 480; - e = evas_new(); - for (i = 1; i < argc; i++) - { - if ((!strcmp(argv[i], "-x")) && (i < (argc - 1))) - { - i++; - win_w = atoi(argv[i]); - } - else if ((!strcmp(argv[i], "-y")) && (i < (argc - 1))) - { - i++; - win_h = atoi(argv[i]); - } - else if ((!strcmp(argv[i], "-m")) && (i < (argc - 1))) - { - i++; - if (!strcmp(argv[i], "x11")) - evas_set_output_method(e, RENDER_METHOD_BASIC_HARDWARE); - else if (!strcmp(argv[i], "render")) - evas_set_output_method(e, RENDER_METHOD_ALPHA_HARDWARE); - else if (!strcmp(argv[i], "soft")) - evas_set_output_method(e, RENDER_METHOD_ALPHA_SOFTWARE); - else if (!strcmp(argv[i], "hard")) - evas_set_output_method(e, RENDER_METHOD_3D_HARDWARE); - else if (!strcmp(argv[i], "buf")) - { - DATA32 *data; - - buffer = imlib_create_image(win_w, win_h); - imlib_context_set_image(buffer); - evas_set_output_method(e, RENDER_METHOD_IMAGE); - evas_set_output_image(e, buffer); - } - } - else if ((!strcmp(argv[i], "-c")) && (i < (argc - 1))) - { - i++; - evas_set_output_colors(e, atoi(argv[i])); - } - else if ((!strcmp(argv[i], "-s")) && (i < (argc - 1))) - { - i++; - evas_set_scale_smoothness(e, atoi(argv[i])); - } - else if ((!strcmp(argv[i], "-v")) && (i < (argc - 1))) - { - i++; - save_file = argv[i]; - } - else - { - printf("Usage:\n"); - printf(" %s [options]\n", argv[0]); - printf("Where options is one or more of:\n"); - printf(" -x width - width of window in pixels\n"); - printf(" -y height - height of window in pixels\n"); - printf(" -m [x11 | soft | hard | buf] - rendering mode\n"); - printf(" -c colors - maximum colors allocated\n"); - printf(" -s [1 | 0] - smooth scaling / rendering\n"); - printf(" -v file.png - save buffer to file.png\n"); - printf("\n"); - printf("Examples:\n"); - printf(" %s -x 640 -y 480 -m soft - run test in 640x480 in software mode\n", argv[0]); - printf(" %s -x 800 -y 600 -m x11 - run test in 800x600 in X11 mode\n", argv[0]); - printf(" %s -x 1024 -y 768 -m hard - run test in 1024x768 in OpenGL mode\n", argv[0]); - printf(" %s -x 640 -y 480 -m soft -s 0 - run test in 640x480 in software mode, no smooth scaling\n", argv[0]); - exit(0); - } - } - - d = XOpenDisplay(NULL); - vis = evas_get_optimal_visual(e, d); - cmap = evas_get_optimal_colormap(e, d); - - { - XSetWindowAttributes att; - - att.colormap = cmap; - att.border_pixel = 0; - att.event_mask = 0; - - win = XCreateWindow(d, - RootWindow(d, DefaultScreen(d)), - 0, 0, win_w, win_h, 0, - imlib_get_visual_depth(d, vis), - InputOutput, - vis, - CWColormap | CWBorderPixel | CWEventMask, - &att); - XSelectInput(d, win, ButtonPressMask | ButtonReleaseMask | - PointerMotionMask | ExposureMask); - XMapWindow(d, win); - XSync(d, False); - } - evas_font_add_path(e, FNTDIR); - evas_set_output(e, d, win, vis, cmap); - evas_set_output_size(e, win_w, win_h); - evas_set_output_viewport(e, 0, 0, win_w, win_h); - - evas_set_font_cache(e, 512 * 1024); - evas_set_image_cache(e, 1 * 1024 * 1024); - - o[0] = evas_add_image_from_file(e, IMGDIR"sky001.png"); - evas_show(e, o[0]); - o[1] = evas_add_image_from_file(e, IMGDIR"logo001.png"); - evas_callback_add(e, o[1], CALLBACK_MOUSE_DOWN, mouse_down, NULL); - evas_callback_add(e, o[1], CALLBACK_MOUSE_UP, mouse_up, NULL); - evas_callback_add(e, o[1], CALLBACK_MOUSE_MOVE, mouse_move, NULL); - evas_callback_add(e, o[1], CALLBACK_MOUSE_IN, mouse_in, NULL); - evas_callback_add(e, o[1], CALLBACK_MOUSE_OUT, mouse_out, NULL); - w /= 2; - h /= 2; - evas_show(e, o[1]); - - o_rect = evas_add_rectangle(e); - evas_show(e, o_rect); - evas_move(e, o_rect, 100, 80); - evas_resize(e, o_rect, 120, 120); - evas_set_color(e, o_rect, rand()&0xff, rand()&0xff, rand()&0xff, 200); - evas_set_layer(e, o_rect, 180); - evas_callback_add(e, o_rect, CALLBACK_MOUSE_DOWN, mouse_down, NULL); - evas_callback_add(e, o_rect, CALLBACK_MOUSE_UP, mouse_up, NULL); - evas_callback_add(e, o_rect, CALLBACK_MOUSE_MOVE, mouse_move, NULL); - evas_callback_add(e, o_rect, CALLBACK_MOUSE_IN, mouse_in, NULL); - evas_callback_add(e, o_rect, CALLBACK_MOUSE_OUT, mouse_out, NULL); - - o_rect = evas_add_rectangle(e); - evas_show(e, o_rect); - evas_move(e, o_rect, 200, 100); - evas_resize(e, o_rect, 300, 200); - evas_set_color(e, o_rect, rand()&0xff, rand()&0xff, rand()&0xff, 200); - evas_set_layer(e, o_rect, 150); - - for (i = 2 ; i < 120; i++) - { - o[i] = evas_add_image_from_file(e, IMGDIR"mush.png"); - evas_show(e, o[i]); - evas_set_layer(e, o[i], 100); - evas_callback_add(e, o[i], CALLBACK_MOUSE_DOWN, mouse_down, NULL); - evas_callback_add(e, o[i], CALLBACK_MOUSE_UP, mouse_up, NULL); - evas_callback_add(e, o[i], CALLBACK_MOUSE_MOVE, mouse_move, NULL); - evas_callback_add(e, o[i], CALLBACK_MOUSE_IN, mouse_in, NULL); - evas_callback_add(e, o[i], CALLBACK_MOUSE_OUT, mouse_out, NULL); - evas_set_clip(e, o[i], o_rect); - } - for (i = 120; i < 128; i++) - { - o[i] = evas_add_text(e, "notepad", 16, imgs[i & 0x7]); - evas_set_color(e, o[i], rand()&0xff, rand()&0xff, rand()&0xff, 255); - evas_show(e, o[i]); - evas_set_layer(e, o[i], 100); - evas_callback_add(e, o[i], CALLBACK_MOUSE_DOWN, mouse_down, NULL); - evas_callback_add(e, o[i], CALLBACK_MOUSE_UP, mouse_up, NULL); - evas_callback_add(e, o[i], CALLBACK_MOUSE_MOVE, mouse_move, NULL); - evas_callback_add(e, o[i], CALLBACK_MOUSE_IN, mouse_in, NULL); - evas_callback_add(e, o[i], CALLBACK_MOUSE_OUT, mouse_out, NULL); - } - - o_poly = evas_add_poly(e); - evas_show(e, o_poly); - evas_add_point(e, o_poly, 100, 100); - evas_add_point(e, o_poly, 200, 150); - evas_add_point(e, o_poly, 300, 80); - evas_add_point(e, o_poly, 500, 150); - evas_add_point(e, o_poly, 200, 120); - evas_add_point(e, o_poly, 55, 190); - evas_add_point(e, o_poly, 130, 110); - evas_set_color(e, o_poly, rand()&0xff, rand()&0xff, rand()&0xff, 180); - evas_set_layer(e, o_poly, 150); - evas_callback_add(e, o_poly, CALLBACK_MOUSE_DOWN, mouse_down, NULL); - evas_callback_add(e, o_poly, CALLBACK_MOUSE_UP, mouse_up, NULL); - evas_callback_add(e, o_poly, CALLBACK_MOUSE_MOVE, mouse_move, NULL); - evas_callback_add(e, o_poly, CALLBACK_MOUSE_IN, mouse_in, NULL); - evas_callback_add(e, o_poly, CALLBACK_MOUSE_OUT, mouse_out, NULL); - - o_line = evas_add_line(e); - evas_show(e, o_line); - evas_set_line_xy(e, o_line, 10, 20, 100, 50); - evas_set_color(e, o_line, rand()&0xff, rand()&0xff, rand()&0xff, 140); - evas_set_layer(e, o_rect, 150); - evas_callback_add(e, o_line, CALLBACK_MOUSE_DOWN, mouse_down, NULL); - evas_callback_add(e, o_line, CALLBACK_MOUSE_UP, mouse_up, NULL); - evas_callback_add(e, o_line, CALLBACK_MOUSE_MOVE, mouse_move, NULL); - evas_callback_add(e, o_line, CALLBACK_MOUSE_IN, mouse_in, NULL); - evas_callback_add(e, o_line, CALLBACK_MOUSE_OUT, mouse_out, NULL); - - o_grad = evas_add_gradient_box(e); - evas_show(e, o_grad); - evas_move(e, o_grad, 300, 50); - evas_resize(e, o_grad, 300, 300); - evas_set_layer(e, o_grad, 150); - grad = evas_gradient_new(); - evas_gradient_add_color(grad, 255, 255, 255, 255, 8); - evas_gradient_add_color(grad, 255, 255, 0, 200, 8); - evas_gradient_add_color(grad, 255, 0 , 0, 150, 8); - evas_gradient_add_color(grad, 0 , 0 , 0, 0, 8); - evas_set_gradient(e, o_grad, grad); - evas_callback_add(e, o_grad, CALLBACK_MOUSE_DOWN, mouse_down, NULL); - evas_callback_add(e, o_grad, CALLBACK_MOUSE_UP, mouse_up, NULL); - evas_callback_add(e, o_grad, CALLBACK_MOUSE_MOVE, mouse_move, NULL); - evas_callback_add(e, o_grad, CALLBACK_MOUSE_IN, mouse_in, NULL); - evas_callback_add(e, o_grad, CALLBACK_MOUSE_OUT, mouse_out, NULL); -/* evas_set_clip(e, o_grad, o_rect);*/ - - o_text = evas_add_text(e, "grunge", 14, "Click and Drag Objects..."); - evas_set_color(e, o_text, 0, 0, 0, 160); - evas_move(e, o_text, 30, 60); - evas_show(e, o_text); - evas_set_layer(e, o_text, 200); - evas_callback_add(e, o_text, CALLBACK_MOUSE_DOWN, mouse_down, NULL); - evas_callback_add(e, o_text, CALLBACK_MOUSE_UP, mouse_up, NULL); - evas_callback_add(e, o_text, CALLBACK_MOUSE_MOVE, mouse_move, NULL); - evas_callback_add(e, o_text, CALLBACK_MOUSE_IN, mouse_in, NULL); - evas_callback_add(e, o_text, CALLBACK_MOUSE_OUT, mouse_out, NULL); - - o_fps = evas_add_text(e, "morpheus", 16, "FPS..."); - evas_set_color(e, o_fps, 255, 255, 255, 140); - evas_move(e, o_fps, win_w, win_h); - evas_show(e, o_fps); - evas_set_layer(e, o_fps, 500); - - evas_raise(e, o[1]); - evas_move(e, o[0], 0, 0); - evas_resize(e, o[0], win_w, win_h); - evas_set_image_fill(e, o[0], 0, 0, win_w, win_h); - a = 0; - down = 0; - t0 = t1 = get_time(); - m = 0; - for (;;) - { - double x, y; - XEvent ev; - - while (XPending(d)) -/* do*/ - { - XNextEvent(d, &ev); - switch(ev.type) - { - case ButtonPress: - { - int button, mouse_x, mouse_y; - - down = 1; - button = ev.xbutton.button; - mouse_x = ev.xbutton.x; - mouse_y = ev.xbutton.y; - evas_event_button_down(e, mouse_x, mouse_y, button); - } - break; - case ButtonRelease: - { - int button, mouse_x, mouse_y; - - down = 0; - button = ev.xbutton.button; - if (button == 3) - { - t2 = get_time() - t0; - printf("Avg FPS: %3.3f\n", a / t2); - evas_free(e); - exit(0); - } - mouse_x = ev.xbutton.x; - mouse_y = ev.xbutton.y; - evas_event_button_up(e, mouse_x, mouse_y, button); - } - break; - case MotionNotify: - { - int mouse_x, mouse_y; - - mouse_x = ev.xmotion.x; - mouse_y = ev.xmotion.y; - evas_event_move(e, mouse_x, mouse_y); - } - break; - case Expose: - { - evas_update_rect(e, ev.xexpose.x, ev.xexpose.y, ev.xexpose.width, ev.xexpose.height); - } - break; - default: - break; - } - } -/* while (XPending(d));*/ - for (i = 2; i < 128; i++) - { - int j, k; - double ww, hh; - - if (!evas_get_data(e, o[i], "clicked")) - { - j = (i * 50) + i; - k = (i * -60) - (i * 2); - x = (win_w + (cos((double)(a + j) * 2 * 3.141592654 / 1000) * (win_h - 100))) / 2; - y = (win_h + (sin((double)(a + k) * 2 * 3.141592654 / 1000) * (win_h - 100))) / 2; - if (i < 100) - evas_set_image_file(e, o[i], imgs[(i) & 0x7]); - evas_move(e, o[i], x, y); -/* - ww = ((1.2 + cos((double)(a + j + m) * 2 * 3.141592654 / 1000)) * 48); - hh = ww; - evas_resize(e, o[i], ww, hh); - evas_set_image_fill(e, o[i], 0, 0, ww, hh); - evas_set_color(e, o[i], 255, 255, 255, - (((1.0 + cos((double)(a + j) * 2 * 3 * 3.141592654 / 1000)) / 2) * 255)); - */ - } - } - evas_set_angle(e, o_grad, (double)a * 360 / 1000); - evas_render(e); - if ((save_file) && (buffer)) - { - imlib_context_set_image(buffer); - imlib_image_set_format("png"); - imlib_save_image(save_file); - } - a++; - m++; - if ((a % 25) == 0) - { - char buf[64]; - double gw, gh; - - t2 = get_time() - t1; - t1 = get_time(); - sprintf(buf, "FPS: %3.1f", 25 / t2); - printf("%s\n", buf); - evas_set_text(e, o_fps, buf); - evas_get_geometry(e, o_fps, NULL, NULL, &gw, &gh); - evas_move(e, o_fps, win_w - gw, win_h - gh); - } - } -} diff --git a/legacy/evas/test/fnt/.cvsignore b/legacy/evas/test/fnt/.cvsignore deleted file mode 100644 index 3dda72986f..0000000000 --- a/legacy/evas/test/fnt/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile.in -Makefile diff --git a/legacy/evas/test/fnt/Makefile.am b/legacy/evas/test/fnt/Makefile.am deleted file mode 100644 index 9289ef44ef..0000000000 --- a/legacy/evas/test/fnt/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -EXTRA_DIST = \ -andover.ttf \ -cinema.ttf \ -grunge.ttf \ -morpheus.ttf \ -notepad.ttf -evasdir = $(datadir)/evas/fnt -evas_DATA = \ -andover.ttf \ -cinema.ttf \ -grunge.ttf \ -morpheus.ttf \ -notepad.ttf diff --git a/legacy/evas/test/fnt/andover.ttf b/legacy/evas/test/fnt/andover.ttf deleted file mode 100644 index 28006b4ae6..0000000000 Binary files a/legacy/evas/test/fnt/andover.ttf and /dev/null differ diff --git a/legacy/evas/test/fnt/cinema.ttf b/legacy/evas/test/fnt/cinema.ttf deleted file mode 100644 index 469f3d4401..0000000000 Binary files a/legacy/evas/test/fnt/cinema.ttf and /dev/null differ diff --git a/legacy/evas/test/fnt/grunge.ttf b/legacy/evas/test/fnt/grunge.ttf deleted file mode 100644 index 34d1021843..0000000000 Binary files a/legacy/evas/test/fnt/grunge.ttf and /dev/null differ diff --git a/legacy/evas/test/fnt/morpheus.ttf b/legacy/evas/test/fnt/morpheus.ttf deleted file mode 100644 index ee4c740d68..0000000000 Binary files a/legacy/evas/test/fnt/morpheus.ttf and /dev/null differ diff --git a/legacy/evas/test/fnt/notepad.ttf b/legacy/evas/test/fnt/notepad.ttf deleted file mode 100644 index f24ad4b05b..0000000000 Binary files a/legacy/evas/test/fnt/notepad.ttf and /dev/null differ diff --git a/legacy/evas/test/img/.cvsignore b/legacy/evas/test/img/.cvsignore deleted file mode 100644 index 3dda72986f..0000000000 --- a/legacy/evas/test/img/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile.in -Makefile diff --git a/legacy/evas/test/img/Makefile.am b/legacy/evas/test/img/Makefile.am deleted file mode 100644 index 604233269a..0000000000 --- a/legacy/evas/test/img/Makefile.am +++ /dev/null @@ -1,111 +0,0 @@ -EXTRA_DIST = \ -book.png \ -bulb.png \ -calc.png \ -evas_icon.png \ -evas_test_alpha1.png \ -evas_test_alpha2.png \ -evas_test_anti_alias.png \ -evas_test_canvas.png \ -evas_test_cheese.png \ -evas_test_control_bg.png \ -evas_test_control_selection1.png \ -evas_test_control_selection2.png \ -evas_test_image_0.png \ -evas_test_image_1.png \ -evas_test_image_10.png \ -evas_test_image_11.png \ -evas_test_image_12.png \ -evas_test_image_13.png \ -evas_test_image_14.png \ -evas_test_image_15.png \ -evas_test_image_2.png \ -evas_test_image_3.png \ -evas_test_image_4.png \ -evas_test_image_5.png \ -evas_test_image_6.png \ -evas_test_image_7.png \ -evas_test_image_8.png \ -evas_test_image_9.png \ -evas_test_mmx.png \ -evas_test_pointer.png \ -evas_test_pointer_big.png \ -evas_test_view_bg.png \ -evas_test_view_bubble.png \ -evas_test_view_bubble_shadow.png \ -evas_test_view_logo.png \ -evas_test_view_logo_image.png \ -evas_test_view_logo_image_brush.png \ -evas_test_view_logo_image_paint.png \ -evas_test_view_logo_impress.png \ -evas_test_view_logo_shadow.png \ -evas_test_wonder_1.png \ -evas_test_wonder_2.png \ -evas_test_wonder_3.png \ -evas_test_wonder_4.png \ -evas_test_wonder_5.png \ -evas_test_wonder_6.png \ -evas_test_wonder_7.png \ -logo001.png \ -mouse.png \ -mush.png \ -sky001.png \ -spider.png \ -term.png \ -worlds.png -evasdir = $(datadir)/evas/img -evas_DATA = \ -book.png \ -bulb.png \ -calc.png \ -evas_icon.png \ -evas_test_alpha1.png \ -evas_test_alpha2.png \ -evas_test_anti_alias.png \ -evas_test_canvas.png \ -evas_test_cheese.png \ -evas_test_control_bg.png \ -evas_test_control_selection1.png \ -evas_test_control_selection2.png \ -evas_test_image_0.png \ -evas_test_image_1.png \ -evas_test_image_10.png \ -evas_test_image_11.png \ -evas_test_image_12.png \ -evas_test_image_13.png \ -evas_test_image_14.png \ -evas_test_image_15.png \ -evas_test_image_2.png \ -evas_test_image_3.png \ -evas_test_image_4.png \ -evas_test_image_5.png \ -evas_test_image_6.png \ -evas_test_image_7.png \ -evas_test_image_8.png \ -evas_test_image_9.png \ -evas_test_mmx.png \ -evas_test_pointer.png \ -evas_test_pointer_big.png \ -evas_test_view_bg.png \ -evas_test_view_bubble.png \ -evas_test_view_bubble_shadow.png \ -evas_test_view_logo.png \ -evas_test_view_logo_image.png \ -evas_test_view_logo_image_brush.png \ -evas_test_view_logo_image_paint.png \ -evas_test_view_logo_impress.png \ -evas_test_view_logo_shadow.png \ -evas_test_wonder_1.png \ -evas_test_wonder_2.png \ -evas_test_wonder_3.png \ -evas_test_wonder_4.png \ -evas_test_wonder_5.png \ -evas_test_wonder_6.png \ -evas_test_wonder_7.png \ -logo001.png \ -mouse.png \ -mush.png \ -sky001.png \ -spider.png \ -term.png \ -worlds.png diff --git a/legacy/evas/test/img/book.png b/legacy/evas/test/img/book.png deleted file mode 100644 index 07c1e9acb8..0000000000 Binary files a/legacy/evas/test/img/book.png and /dev/null differ diff --git a/legacy/evas/test/img/bulb.png b/legacy/evas/test/img/bulb.png deleted file mode 100644 index 757e599d29..0000000000 Binary files a/legacy/evas/test/img/bulb.png and /dev/null differ diff --git a/legacy/evas/test/img/calc.png b/legacy/evas/test/img/calc.png deleted file mode 100644 index 812237b3ac..0000000000 Binary files a/legacy/evas/test/img/calc.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_icon.png b/legacy/evas/test/img/evas_icon.png deleted file mode 100644 index 7a8ae8c951..0000000000 Binary files a/legacy/evas/test/img/evas_icon.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_alpha1.png b/legacy/evas/test/img/evas_test_alpha1.png deleted file mode 100644 index 5b4f385aed..0000000000 Binary files a/legacy/evas/test/img/evas_test_alpha1.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_alpha2.png b/legacy/evas/test/img/evas_test_alpha2.png deleted file mode 100644 index c9056d431e..0000000000 Binary files a/legacy/evas/test/img/evas_test_alpha2.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_anti_alias.png b/legacy/evas/test/img/evas_test_anti_alias.png deleted file mode 100644 index bf0719af4c..0000000000 Binary files a/legacy/evas/test/img/evas_test_anti_alias.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_canvas.png b/legacy/evas/test/img/evas_test_canvas.png deleted file mode 100644 index 694ad6cc18..0000000000 Binary files a/legacy/evas/test/img/evas_test_canvas.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_cheese.png b/legacy/evas/test/img/evas_test_cheese.png deleted file mode 100644 index 0f379d5bca..0000000000 Binary files a/legacy/evas/test/img/evas_test_cheese.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_control_bg.png b/legacy/evas/test/img/evas_test_control_bg.png deleted file mode 100644 index 01e47a0e44..0000000000 Binary files a/legacy/evas/test/img/evas_test_control_bg.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_control_selection1.png b/legacy/evas/test/img/evas_test_control_selection1.png deleted file mode 100644 index eae571e533..0000000000 Binary files a/legacy/evas/test/img/evas_test_control_selection1.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_control_selection2.png b/legacy/evas/test/img/evas_test_control_selection2.png deleted file mode 100644 index 63c17ca72f..0000000000 Binary files a/legacy/evas/test/img/evas_test_control_selection2.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_0.png b/legacy/evas/test/img/evas_test_image_0.png deleted file mode 100644 index ecf6b064d1..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_0.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_1.png b/legacy/evas/test/img/evas_test_image_1.png deleted file mode 100644 index 34d4671d3c..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_1.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_10.png b/legacy/evas/test/img/evas_test_image_10.png deleted file mode 100644 index 8ef955e75d..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_10.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_11.png b/legacy/evas/test/img/evas_test_image_11.png deleted file mode 100644 index 502c3869be..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_11.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_12.png b/legacy/evas/test/img/evas_test_image_12.png deleted file mode 100644 index 533e84515c..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_12.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_13.png b/legacy/evas/test/img/evas_test_image_13.png deleted file mode 100644 index c245e9a40b..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_13.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_14.png b/legacy/evas/test/img/evas_test_image_14.png deleted file mode 100644 index b6f964afc4..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_14.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_15.png b/legacy/evas/test/img/evas_test_image_15.png deleted file mode 100644 index 6c078391e2..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_15.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_2.png b/legacy/evas/test/img/evas_test_image_2.png deleted file mode 100644 index 57d3027d95..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_2.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_3.png b/legacy/evas/test/img/evas_test_image_3.png deleted file mode 100644 index 512e6c64b3..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_3.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_4.png b/legacy/evas/test/img/evas_test_image_4.png deleted file mode 100644 index 8c2729a6f6..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_4.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_5.png b/legacy/evas/test/img/evas_test_image_5.png deleted file mode 100644 index d4347a3176..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_5.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_6.png b/legacy/evas/test/img/evas_test_image_6.png deleted file mode 100644 index 9c750abd0f..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_6.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_7.png b/legacy/evas/test/img/evas_test_image_7.png deleted file mode 100644 index 7e48541676..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_7.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_8.png b/legacy/evas/test/img/evas_test_image_8.png deleted file mode 100644 index e13bc77900..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_8.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_image_9.png b/legacy/evas/test/img/evas_test_image_9.png deleted file mode 100644 index 857d9bdc6b..0000000000 Binary files a/legacy/evas/test/img/evas_test_image_9.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_mmx.png b/legacy/evas/test/img/evas_test_mmx.png deleted file mode 100644 index 3d2bd6a8a3..0000000000 Binary files a/legacy/evas/test/img/evas_test_mmx.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_pointer.png b/legacy/evas/test/img/evas_test_pointer.png deleted file mode 100644 index 50bfdc727c..0000000000 Binary files a/legacy/evas/test/img/evas_test_pointer.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_pointer_big.png b/legacy/evas/test/img/evas_test_pointer_big.png deleted file mode 100644 index cbc71203ac..0000000000 Binary files a/legacy/evas/test/img/evas_test_pointer_big.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_view_bg.png b/legacy/evas/test/img/evas_test_view_bg.png deleted file mode 100644 index 38724039cd..0000000000 Binary files a/legacy/evas/test/img/evas_test_view_bg.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_view_bubble.png b/legacy/evas/test/img/evas_test_view_bubble.png deleted file mode 100644 index dfb71b7e78..0000000000 Binary files a/legacy/evas/test/img/evas_test_view_bubble.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_view_bubble_shadow.png b/legacy/evas/test/img/evas_test_view_bubble_shadow.png deleted file mode 100644 index b66c1e624d..0000000000 Binary files a/legacy/evas/test/img/evas_test_view_bubble_shadow.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_view_logo.png b/legacy/evas/test/img/evas_test_view_logo.png deleted file mode 100644 index 98f0637f3b..0000000000 Binary files a/legacy/evas/test/img/evas_test_view_logo.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_view_logo_image.png b/legacy/evas/test/img/evas_test_view_logo_image.png deleted file mode 100644 index fd30a2fb6a..0000000000 Binary files a/legacy/evas/test/img/evas_test_view_logo_image.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_view_logo_image_brush.png b/legacy/evas/test/img/evas_test_view_logo_image_brush.png deleted file mode 100644 index ef254687a3..0000000000 Binary files a/legacy/evas/test/img/evas_test_view_logo_image_brush.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_view_logo_image_paint.png b/legacy/evas/test/img/evas_test_view_logo_image_paint.png deleted file mode 100644 index 2d9745d1e2..0000000000 Binary files a/legacy/evas/test/img/evas_test_view_logo_image_paint.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_view_logo_impress.png b/legacy/evas/test/img/evas_test_view_logo_impress.png deleted file mode 100644 index 1daa26862b..0000000000 Binary files a/legacy/evas/test/img/evas_test_view_logo_impress.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_view_logo_shadow.png b/legacy/evas/test/img/evas_test_view_logo_shadow.png deleted file mode 100644 index f55eb52f06..0000000000 Binary files a/legacy/evas/test/img/evas_test_view_logo_shadow.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_wonder_1.png b/legacy/evas/test/img/evas_test_wonder_1.png deleted file mode 100644 index 297644e63f..0000000000 Binary files a/legacy/evas/test/img/evas_test_wonder_1.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_wonder_2.png b/legacy/evas/test/img/evas_test_wonder_2.png deleted file mode 100644 index 7d4146519d..0000000000 Binary files a/legacy/evas/test/img/evas_test_wonder_2.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_wonder_3.png b/legacy/evas/test/img/evas_test_wonder_3.png deleted file mode 100644 index ccb6902582..0000000000 Binary files a/legacy/evas/test/img/evas_test_wonder_3.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_wonder_4.png b/legacy/evas/test/img/evas_test_wonder_4.png deleted file mode 100644 index 80e50c7d1c..0000000000 Binary files a/legacy/evas/test/img/evas_test_wonder_4.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_wonder_5.png b/legacy/evas/test/img/evas_test_wonder_5.png deleted file mode 100644 index 5f3a05c76c..0000000000 Binary files a/legacy/evas/test/img/evas_test_wonder_5.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_wonder_6.png b/legacy/evas/test/img/evas_test_wonder_6.png deleted file mode 100644 index b2fb38864a..0000000000 Binary files a/legacy/evas/test/img/evas_test_wonder_6.png and /dev/null differ diff --git a/legacy/evas/test/img/evas_test_wonder_7.png b/legacy/evas/test/img/evas_test_wonder_7.png deleted file mode 100644 index 891e152103..0000000000 Binary files a/legacy/evas/test/img/evas_test_wonder_7.png and /dev/null differ diff --git a/legacy/evas/test/img/logo001.png b/legacy/evas/test/img/logo001.png deleted file mode 100644 index edf519b494..0000000000 Binary files a/legacy/evas/test/img/logo001.png and /dev/null differ diff --git a/legacy/evas/test/img/mouse.png b/legacy/evas/test/img/mouse.png deleted file mode 100644 index 9a32d03701..0000000000 Binary files a/legacy/evas/test/img/mouse.png and /dev/null differ diff --git a/legacy/evas/test/img/mush.png b/legacy/evas/test/img/mush.png deleted file mode 100644 index 0a4b0d04e6..0000000000 Binary files a/legacy/evas/test/img/mush.png and /dev/null differ diff --git a/legacy/evas/test/img/sky001.png b/legacy/evas/test/img/sky001.png deleted file mode 100644 index 9a02404ac2..0000000000 Binary files a/legacy/evas/test/img/sky001.png and /dev/null differ diff --git a/legacy/evas/test/img/spider.png b/legacy/evas/test/img/spider.png deleted file mode 100644 index e44c96f233..0000000000 Binary files a/legacy/evas/test/img/spider.png and /dev/null differ diff --git a/legacy/evas/test/img/term.png b/legacy/evas/test/img/term.png deleted file mode 100644 index 6b5627b5f4..0000000000 Binary files a/legacy/evas/test/img/term.png and /dev/null differ diff --git a/legacy/evas/test/img/worlds.png b/legacy/evas/test/img/worlds.png deleted file mode 100644 index 01c061151f..0000000000 Binary files a/legacy/evas/test/img/worlds.png and /dev/null differ