From ff6b740089f292f1d2a50e9b9c7e48893f0b5dd6 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Mon, 10 Oct 2011 14:15:32 +0900 Subject: [PATCH] Revert "Rollback to previous package. evas_1.0.0.001+svn.62695slp2+build31" This reverts commit 4ca2f74e83954c6359e76c14135b63fb09899cf1. Conflicts: debian/changelog --- .gitignore | 19 + AUTHORS | 4 + COPYING | 2 +- ChangeLog | 10 + Makefile.am | 2 +- README.in | 6 + configure.ac | 95 +- debian/SVN_REV | 2 - debian/_original/changelog | 11 - debian/_original/compat | 1 - debian/_original/control | 105 -- debian/_original/copyright | 38 - debian/_original/libevas-dev.install | 4 - debian/_original/libevas-doc.dirs | 1 - debian/_original/libevas-doc.doc-base | 10 - debian/_original/libevas-engines-extras.install | 2 - debian/_original/libevas-engines.install | 4 - debian/_original/libevas-svn-01.install | 3 - debian/_original/libevas-svn-01.shlibs | 1 - debian/_original/rules | 81 - debian/changelog | 8 + debian/control | 51 +- debian/rules | 10 +- evas.spec.in | 2 +- m4/ac_attribute.m4 | 47 - m4/evas_check_engine.m4 | 36 + m4/lt~obsolete.m4 | 92 -- src/lib/Evas.h | 145 +- src/lib/cache/evas_cache_image.c | 36 +- src/lib/canvas/Makefile.am | 1 + src/lib/canvas/evas_callbacks.c | 2 +- src/lib/canvas/evas_events.c | 78 +- src/lib/canvas/evas_font_dir.c | 6 +- src/lib/canvas/evas_main.c | 53 +- src/lib/canvas/evas_map.c | 8 +- src/lib/canvas/evas_name.c | 8 +- src/lib/canvas/evas_object_grid.c | 18 +- src/lib/canvas/evas_object_image.c | 255 +++- src/lib/canvas/evas_object_main.c | 99 +- src/lib/canvas/evas_object_smart.c | 120 +- src/lib/canvas/evas_object_textblock.c | 60 +- src/lib/canvas/evas_render.c | 224 ++- src/lib/engines/common/Makefile.am | 3 + src/lib/engines/common/evas_convert_colorspace.c | 86 ++ src/lib/engines/common/evas_convert_colorspace.h | 9 +- src/lib/engines/common/evas_convert_yuv.c | 301 ++++ src/lib/engines/common/evas_convert_yuv.h | 8 +- src/lib/engines/common/evas_cpu.c | 27 +- src/lib/engines/common/evas_font_ot.c | 4 +- src/lib/engines/common/evas_image_data.c | 49 +- src/lib/engines/common/evas_image_main.c | 14 + src/lib/engines/common/evas_op_blend/Makefile.am | 34 +- src/lib/engines/common/evas_op_blend_main_.c | 53 +- src/lib/file/evas_module.c | 26 + src/lib/include/evas_blend_ops.h | 201 ++- src/lib/include/evas_common.h | 11 +- src/lib/include/evas_options.h | 7 +- src/lib/include/evas_private.h | 106 +- src/modules/engines/Makefile.am | 5 +- src/modules/engines/gl_common/Makefile.am | 10 +- src/modules/engines/gl_common/evas_gl_common.h | 120 +- src/modules/engines/gl_common/evas_gl_context.c | 1575 ++++++++------------ src/modules/engines/gl_common/evas_gl_font.c | 6 +- src/modules/engines/gl_common/evas_gl_image.c | 143 +- src/modules/engines/gl_common/evas_gl_shader.c | 402 ++--- src/modules/engines/gl_common/evas_gl_texture.c | 621 +++++++- .../engines/gl_common/shader/filter_blur.shd | 2 +- .../engines/gl_common/shader/filter_blur_bgra.shd | 2 +- .../gl_common/shader/filter_blur_bgra_nomul.shd | 2 +- .../engines/gl_common/shader/filter_blur_nomul.shd | 2 +- .../engines/gl_common/shader/filter_blur_vert.shd | 2 +- .../engines/gl_common/shader/filter_greyscale.shd | 2 +- .../gl_common/shader/filter_greyscale_bgra.shd | 2 +- .../shader/filter_greyscale_bgra_nomul.shd | 2 +- .../gl_common/shader/filter_greyscale_nomul.shd | 2 +- .../engines/gl_common/shader/filter_invert.shd | 2 +- .../gl_common/shader/filter_invert_bgra.shd | 2 +- .../gl_common/shader/filter_invert_bgra_nomul.shd | 2 +- .../gl_common/shader/filter_invert_nomul.shd | 2 +- .../engines/gl_common/shader/filter_sepia.shd | 2 +- .../engines/gl_common/shader/filter_sepia_bgra.shd | 2 +- .../gl_common/shader/filter_sepia_bgra_nomul.shd | 2 +- .../gl_common/shader/filter_sepia_nomul.shd | 2 +- src/modules/engines/gl_common/shader/font_frag.h | 2 +- src/modules/engines/gl_common/shader/font_frag.shd | 2 +- .../engines/gl_common/shader/img_bgra_frag.h | 2 +- .../engines/gl_common/shader/img_bgra_frag.shd | 2 +- .../engines/gl_common/shader/img_bgra_nomul_frag.h | 2 +- .../gl_common/shader/img_bgra_nomul_frag.shd | 2 +- .../engines/gl_common/shader/img_bgra_nomul_vert.h | 2 +- .../gl_common/shader/img_bgra_nomul_vert.shd | 2 +- .../engines/gl_common/shader/img_bgra_vert.h | 2 +- .../engines/gl_common/shader/img_bgra_vert.shd | 2 +- src/modules/engines/gl_common/shader/img_frag.h | 2 +- src/modules/engines/gl_common/shader/img_frag.shd | 2 +- .../engines/gl_common/shader/img_mask_frag.h | 2 +- .../engines/gl_common/shader/img_mask_frag.shd | 2 +- .../engines/gl_common/shader/img_mask_vert.h | 2 +- .../engines/gl_common/shader/img_mask_vert.shd | 2 +- .../engines/gl_common/shader/img_nomul_frag.h | 2 +- .../engines/gl_common/shader/img_nomul_frag.shd | 2 +- .../engines/gl_common/shader/img_nomul_vert.h | 2 +- .../engines/gl_common/shader/img_nomul_vert.shd | 2 +- src/modules/engines/gl_common/shader/img_vert.h | 2 +- src/modules/engines/gl_common/shader/img_vert.shd | 2 +- src/modules/engines/gl_common/shader/rect_frag.h | 2 +- src/modules/engines/gl_common/shader/rect_frag.shd | 2 +- src/modules/engines/gl_common/shader/rect_vert.h | 2 +- src/modules/engines/gl_common/shader/rect_vert.shd | 2 +- src/modules/engines/gl_common/shader/tex_frag.h | 2 +- src/modules/engines/gl_common/shader/tex_frag.shd | 2 +- .../engines/gl_common/shader/tex_nomul_frag.h | 2 +- .../engines/gl_common/shader/tex_nomul_frag.shd | 2 +- .../engines/gl_common/shader/tex_nomul_vert.h | 2 +- .../engines/gl_common/shader/tex_nomul_vert.shd | 2 +- src/modules/engines/gl_common/shader/tex_vert.h | 2 +- src/modules/engines/gl_common/shader/tex_vert.shd | 2 +- src/modules/engines/gl_common/shader/yuv_frag.h | 2 +- src/modules/engines/gl_common/shader/yuv_frag.shd | 2 +- .../engines/gl_common/shader/yuv_nomul_frag.h | 2 +- .../engines/gl_common/shader/yuv_nomul_frag.shd | 2 +- .../engines/gl_common/shader/yuv_nomul_vert.h | 2 +- .../engines/gl_common/shader/yuv_nomul_vert.shd | 2 +- src/modules/engines/gl_common/shader/yuv_vert.h | 2 +- src/modules/engines/gl_common/shader/yuv_vert.shd | 2 +- src/modules/engines/gl_sdl/evas_engine.c | 24 +- src/modules/engines/gl_x11/evas_engine.c | 49 +- src/modules/engines/software_16_sdl/evas_engine.c | 84 +- src/modules/engines/software_generic/evas_engine.c | 4 + src/modules/engines/software_sdl/evas_engine.c | 37 +- src/modules/engines/software_x11/Makefile.am | 5 +- src/modules/engines/software_x11/evas_engine.c | 9 +- .../loaders/generic/evas_image_load_generic.c | 17 +- src/modules/loaders/gif/evas_image_load_gif.c | 2 +- src/modules/loaders/jpeg/evas_image_load_jpeg.c | 556 ++++--- src/tests/evas_test_textblock.c | 8 + 136 files changed, 3978 insertions(+), 2516 deletions(-) delete mode 100644 debian/SVN_REV delete mode 100644 debian/_original/changelog delete mode 100644 debian/_original/compat delete mode 100644 debian/_original/control delete mode 100644 debian/_original/copyright delete mode 100644 debian/_original/libevas-dev.install delete mode 100644 debian/_original/libevas-doc.dirs delete mode 100644 debian/_original/libevas-doc.doc-base delete mode 100644 debian/_original/libevas-engines-extras.install delete mode 100644 debian/_original/libevas-engines.install delete mode 100644 debian/_original/libevas-svn-01.install delete mode 100644 debian/_original/libevas-svn-01.shlibs delete mode 100755 debian/_original/rules delete mode 100644 m4/ac_attribute.m4 delete mode 100644 m4/lt~obsolete.m4 diff --git a/.gitignore b/.gitignore index 189adf8..4fbea18 100755 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,22 @@ src/bin/evas_cserve_tool *.gcov src/tests/evas_suite coverage +/config.guess.cdbs-orig +/config.sub.cdbs-orig +/debian/files +/debian/*.debhelper.log +/debian/*.substvars +/debian/libevas-dbg/ +/debian/libevas-dev/ +/debian/libevas-doc/ +/debian/*.debhelper +/debian/libevas-engines-extras/ +/debian/libevas-engines/ +/debian/libevas/ +/debian/stamp-* +/debian/tmp/ +/doc/html/ +/doc/latex/ +/doc/man/ +/*-doc.tar.bz2 +/*-doc.tar.bz2.cdbs-config_list diff --git a/AUTHORS b/AUTHORS index be07a99..ebae05f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -27,3 +27,7 @@ Thierry el Borgi Shilpa Singh ChunEon Park Christopher 'devilhorns' Michael +Seungsoo Woo +Youness Alaoui +Jim Kukunas +EunMi Lee diff --git a/COPYING b/COPYING index 61a2b02..8ba7688 100644 --- a/COPYING +++ b/COPYING @@ -1,6 +1,6 @@ Copyright notice for Evas: -Copyright (C) 2000-2010 Carsten Haitzler and various contributors (see AUTHORS) +Copyright (C) 2000-2011 Carsten Haitzler and various contributors (see AUTHORS) All rights reserved. diff --git a/ChangeLog b/ChangeLog index bb57011..30d7a93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -465,3 +465,13 @@ 2011-08-17 Tom Hacohen (TAsn) * Callbacks: Added priority support to callbacks. + +2011-08-23 Cedric Bail + + * Fix evas_object_image_data_convert. + * Add YUV 601 input format to evas_object_image_data_convert. + +2011-08-29 Cedric Bail + + * Add colorspaces NV12 and MT12 (64 * 32 macro block tiled + format, see Linux videodev documentation for more information). diff --git a/Makefile.am b/Makefile.am index 71a0c76..5f40421 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,7 +48,7 @@ evas-software-16-wince.pc.in \ evas-software-sdl.pc.in \ evas.spec.in \ evas.spec \ -m4/ac_attribute.m4 \ +m4/efl_attribute.m4 \ m4/efl_coverage.m4 \ m4/efl_doxygen.m4 \ m4/efl_fnmatch.m4 \ diff --git a/README.in b/README.in index 36b2d95..22face7 100644 --- a/README.in +++ b/README.in @@ -416,6 +416,12 @@ ALTIVEC asm routines yet. :) arm owners will also have to rely on the c fallback routines as i haven't managed to come up with any arm assembly that actually can beat the c code (when compiled with all optimizations) in speed. +--enable-cpu-sse3 + +this enables sse3 optimizations available in the Intel Pentium4, Core, Xeon, +and Atom processors, as well as the AMD Athlon64, Phenom, Opteron, and Turion +processors. + --enable-cpu-neon diff --git a/configure.ac b/configure.ac index e3c4a88..04df91b 100644 --- a/configure.ac +++ b/configure.ac @@ -77,7 +77,7 @@ AC_CANONICAL_BUILD AC_CANONICAL_HOST case "$host_os" in - mingw32ce* | cegcc*) + mingw32ce*) MODULE_ARCH="$host_os-$host_cpu" ;; *) @@ -103,6 +103,7 @@ want_evas_engine_software_8_x11="no" want_evas_engine_software_16_x11="no" want_evas_engine_software_16_ddraw="no" want_evas_engine_software_16_wince="no" +want_evas_engine_software_16_sdl="no" want_evas_engine_gl_xlib="no" want_evas_engine_gl_xcb="no" want_evas_engine_gl_sdl="no" @@ -129,7 +130,7 @@ want_evas_image_loader_generic="yes" want_evas_font_loader_eet="yes" case "$host_os" in - mingw32ce* | cegcc*) + mingw32ce*) want_fontconfig="no" want_evas_engine_software_16_wince="yes" want_evas_image_loader_edb="no" @@ -223,7 +224,7 @@ EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"]) # Evil library for compilation on Windows CE case "$host_os" in - mingw* | cegcc*) + mingw*) PKG_CHECK_MODULES([EVIL], [evil]) AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed]) requirement_evas="evil ${requirement_evas}" @@ -262,7 +263,7 @@ AC_ARG_ENABLE([fontconfig], if test "x${want_fontconfig}" = "xyes" -o "x${want_fontconfig}" = "xauto" ; then PKG_CHECK_MODULES([FONTCONFIG], - [fontconfig], + [fontconfig >= 2.5.0], [ have_fontconfig="yes" AC_DEFINE(HAVE_FONTCONFIG, 1, [have fontconfig searching capabilities]) @@ -422,11 +423,12 @@ fi ### Checks for header files AC_HEADER_STDC AC_CHECK_HEADERS([unistd.h stdint.h sys/param.h netinet/in.h]) - EFL_CHECK_PATH_MAX ### Checks for types +AC_CHECK_TYPES([struct sigaction], [], [], + [[#include ]]) ### Checks for structures @@ -435,12 +437,14 @@ EFL_CHECK_PATH_MAX ### Checks for compiler characteristics AC_C_CONST AC_C_BIGENDIAN -AC_C___ATTRIBUTE__ AM_PROG_CC_STDC +EFL_ATTRIBUTE_UNUSED +EFL_ATTRIBUTE_VECTOR +EFL_ATTRIBUTE_ALWAYS_INLINE WIN32_CPPFLAGS="" case "$host_os" in - mingw32ce* | cegcc*) + mingw32ce*) WIN32_CPPFLAGS="-D_WIN32_WCE=0x0420" ;; mingw*) @@ -450,18 +454,13 @@ esac AC_SUBST(WIN32_CPPFLAGS) WIN32_CFLAGS="" -case "${host_os}" in - cegcc*) - WIN32_CFLAGS="-mwin32" - ;; -esac AC_SUBST(WIN32_CFLAGS) ### Checks for linker characteristics lt_enable_auto_import="" case "${host_os}" in - mingw* | cegcc*) + mingw*) AC_DEFINE(EFL_EVAS_BUILD, 1, [Define to mention that evas is built]) lt_enable_auto_import="-Wl,--enable-auto-import" ;; @@ -472,6 +471,7 @@ AC_SUBST(lt_enable_auto_import) ### Checks for library functions AC_ISC_POSIX +AC_CHECK_FUNCS([siglongjmp]) # alloca AC_FUNC_ALLOCA @@ -482,7 +482,7 @@ EFL_CHECK_FNMATCH([], [AC_MSG_ERROR([Cannot find fnmatch()])]) # dlopen dlopen_libs="" case "$host_os" in - mingw32ce* | cegcc*) + mingw32ce*) # managed by evil AC_DEFINE(HAVE_DLADDR) ;; @@ -681,6 +681,8 @@ EVAS_CHECK_ENGINE([software-16-ddraw], [${want_evas_engine_software_16_ddraw}], EVAS_CHECK_ENGINE([software-16-wince], [${want_evas_engine_software_16_wince}], [no], [Software Windows CE 16 bits]) +EVAS_CHECK_ENGINE([software-16-sdl], [${want_evas_engine_software_16_sdl}], [no], [Software SDL 16 bits]) + # SDL primitive sdl_primitive="no" @@ -875,7 +877,7 @@ have_evas_engine_software_16="no" if test "x$have_evas_engine_software_16_x11" = "xyes" -o "x$have_evas_engine_software_16_x11" = "xstatic"; then have_evas_engine_software_16="yes" fi -if test "x$have_evas_engine_software_sdl" = "xyes" -o "x$have_evas_engine_software_sdl" = "xstatic"; then +if test "x$have_evas_engine_software_16_sdl" = "xyes" -o "x$have_evas_engine_software_16_sdl" = "xstatic"; then have_evas_engine_software_16="yes" fi if test "x$have_evas_engine_software_16_ddraw" = "xyes" -o "x$have_evas_engine_software_16_ddraw" = "xstatic"; then @@ -939,7 +941,7 @@ dnl Windows has no sigsetjmp function, nor equivalent. dnl So we disable the jpeg saver. dnl TODO: must find a workaround case "$host_os" in - mingw* | cegcc*) + mingw*) ;; *) if test "x${have_evas_image_loader_jpeg}" = "xyes" ; then @@ -1219,6 +1221,64 @@ AC_ARG_ENABLE(cpu-sse, ) ####################################### +## SSE3 +build_cpu_sse3="no" +case $host_cpu in + i*86) + build_cpu_sse3="yes" + ;; + x86_64) + build_cpu_sse3="yes" + ;; + amd64) + build_cpu_sse3="yes" + ;; +esac +AC_MSG_CHECKING(whether to build sse3 code) +AC_ARG_ENABLE(cpu-sse3, + AS_HELP_STRING([--enable-cpu-sse3], [enable sse3 code]), + [ + if test "x$enableval" = "xyes" ; then + AC_MSG_RESULT(yes) + AC_DEFINE(BUILD_SSE3, 1, [Build SSE3 Code]) + build_cpu_sse3="yes" + else + AC_MSG_RESULT(no) + build_cpu_sse3="no" + fi + ], + [ + AC_MSG_RESULT($build_cpu_sse3) + if test "x$build_cpu_sse3" = "xyes" ; then + AC_DEFINE(BUILD_SSE3, 1, [Build SSE3 Code]) + fi + ] +) + + +# as a big warning flag to anyone doing stuff like this... +# NEVER EVER EVER EVER put **OPTIMIZATION** flags in +# build flags in makefiles (from configure or anywhere else) +# EVER as this screws your ability to build 1 binary and +# cover ALL x86 arch's. This is the HEIGHT of WRONG. If the +# person building choses to add optimization flags themselves +# and decide the minimum baseline cpu arch is X then that's +# their business, but NEVER should it be done here. NEVER. +# I now have to do this due to the way this sse3 code was done - using +# intrinsics and "functions" (opcodes) and types that only compile *IF* +# you compile with -msse3. this ALSO tries to optimize REGULAR c code +# with sse3 asm.. and this breaks things so badly. so... sse3 will be +# off until further notice for 32bit x86. +EVAS_SSE3_CFLAGS=" " +if test "x$build_cpu_sse3" = "xyes" ; then + EVAS_SSE3_CFLAGS="-msse3 " +# CFLAGS="${CFLAGS} ${EVAS_SSE3_CFLAGS}" +fi + +AC_SUBST(CFLAGS) +AC_SUBST(EVAS_SSE3_CFLAGS) + +####################################### ## ALTIVEC build_cpu_altivec="no" case $host_cpu in @@ -1846,7 +1906,7 @@ echo " Software 16bit ............: $have_evas_engine_software_16" echo " Software 16bit X11.........: $have_evas_engine_software_16_x11" echo " Software 16bit Directdraw..: $have_evas_engine_software_16_ddraw" echo " Software 16bit WinCE.......: $have_evas_engine_software_16_wince" -echo " Software 16bit SDL.........: $have_evas_engine_software_sdl (primitive: $sdl_primitive)" +echo " Software 16bit SDL.........: $have_evas_engine_software_16_sdl (primitive: $sdl_primitive)" echo echo "Image Loaders:" echo " BMP.....................: $have_evas_image_loader_bmp" @@ -1882,6 +1942,7 @@ echo "CPU Specific Extensions:" echo " Fallback C Code.........: $build_cpu_c" echo " MMX.....................: $build_cpu_mmx" echo " SSE.....................: $build_cpu_sse" +echo " SSE3....................: $build_cpu_sse3" echo " ALTIVEC.................: $build_cpu_altivec" echo " NEON....................: $build_cpu_neon" echo " Thread Support..........: $build_pthreads" diff --git a/debian/SVN_REV b/debian/SVN_REV deleted file mode 100644 index a2ab89a..0000000 --- a/debian/SVN_REV +++ /dev/null @@ -1,2 +0,0 @@ -Revision 51480 -Last Changed Rev 51458 diff --git a/debian/_original/changelog b/debian/_original/changelog deleted file mode 100644 index ec9bbae..0000000 --- a/debian/_original/changelog +++ /dev/null @@ -1,11 +0,0 @@ -evas (0.9.9.060+svnYYYYMMDD-1) unstable; urgency=low - - * Clean up changelog - - -- quaker Thu, 22 Apr 2009 18:27:21 +0100 - -evas (0.9.9.050+svnYYYYMMDD-1) unstable; urgency=low - - * Clean up changelog - - -- quaker Tue, 21 Apr 2009 19:13:59 +0100 diff --git a/debian/_original/compat b/debian/_original/compat deleted file mode 100644 index 1e8b314..0000000 --- a/debian/_original/compat +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/debian/_original/control b/debian/_original/control deleted file mode 100644 index 7f53495..0000000 --- a/debian/_original/control +++ /dev/null @@ -1,105 +0,0 @@ -Source: evas -Section: libs -Priority: optional -Maintainer: Debian Pkg-e Team -Uploaders: Albin Tonnerre , - Niv Sardi , Xavier Oswald , - Jan Lübbe , - Nikita V. Youshchenko -Build-Depends: debhelper (>= 6), cdbs, libeet-dev (>= 1.1.0), libeina-dev (>= 0.0.2.060+svnYYYYMMDD), - libfreetype6-dev, libpng12-dev | libpng-dev, libx11-dev, libxrender-dev, - x11proto-xext-dev, zlib1g, libjpeg62-dev, libtiff4-dev, libgif-dev, - libfontconfig1-dev, libglu1-mesa-dev, mesa-common-dev, libxpm-dev, - librsvg2-dev, doxygen, pkg-config, libtool -Standards-Version: 3.8.1 -Homepage: http://www.enlightenment.org - -Package: libevas-svn-01 -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libevas-engines (>= 0.9.9.060+svnYYYYMMDD) -Provides: libevas0 -Conflicts: libevas0 -Description: Enlightenment DR17 advanced canvas library - Evas is an advanced canvas library, providing six engines for rendering: X11, - OpenGL (hardware accelerated), DirectFB, the framebuffer, Microsoft Windows - and Qtopia. - . - Due to its simple API, evas can be developed with rapidly, and cleanly. - . - This package contains the core library and a set of image loaders and/or savers - for various formats: eet, gif, jpeg, png, svg, tiff and xpm - -Package: libevas-doc -Architecture: all -Section: doc -Depends: ${misc:Depends} -Enhances: libevas-dev -Description: Evas API Documentation - Evas is an advanced canvas library, providing six engines for rendering: X11, - OpenGL (hardware accelerated), DirectFB, the framebuffer, Microsoft Windows - and Qtopia. - Due to its simple API, evas can be developed with rapidly, and cleanly. - . - This package provides development documentation (html and manpages) for the - Evas library. - -Package: libevas-dev -Section: libdevel -Architecture: any -Depends: ${misc:Depends}, libevas-svn-01 (= ${binary:Version}), libjpeg62-dev, libx11-dev, - libfreetype6-dev, libfontconfig1-dev, libeet-dev, pkg-config, libeina-dev (>= 0.0.2.060+svnYYYYMMDD) -Suggests: libevas-doc -Description: Enlightenment DR17 advanced canvas library development files - Evas is an advanced canvas library, providing six engines for rendering: X11, - OpenGL (hardware accelerated), DirectFB, the framebuffer, Microsoft Windows - and Qtopia. - . - Due to its simple API, evas can be developed with rapidly, and cleanly. - . - This package provides headers and static libraries required to develop against - evas. - -Package: libevas-dbg -Architecture: any -Section: debug -Depends: ${misc:Depends}, libevas-svn-01 (= ${binary:Version}) -Priority: extra -Description: enlightenment advanced canvas library - Evas is an advanced canvas library, providing six engines for rendering: X11, - OpenGL (hardware accelerated), DirectFB, the framebuffer, Microsoft Windows - and Qtopia. - . - This package contains unstripped shared libraries. It is provided primarily - to provide a backtrace with names in a debugger, this makes it somewhat - easier to interpret core dumps. The libraries are installed in - /usr/lib/debug and are automatically used by gdb. - -Package: libevas-engines -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Conflicts: libevas-0.9.9.050a-engines -Description: Evas module providingg the framebuffer render engine - Evas is an advanced canvas library, providing six engines for rendering: X11, - OpenGL (hardware accelerated), DirectFB, the framebuffer, Microsoft Windows - and Qtopia. - Due to its simple API, evas can be developed with rapidly, and cleanly. - . - This package contains the following Evas engine modules: - - buffer - - software/genenric - - software/X11 - - xrender/X11 - -Package: libevas-engines-extras -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libevas-engines -Conflicts: libevas-0.9.9.050a-engines-extras -Description: Evas module providing the Xrender engine - Evas is an advanced canvas library, providing six engines for rendering: X11, - OpenGL (hardware accelerated), DirectFB, the framebuffer, Microsoft Windows - and Qtopia. - Due to its simple API, evas can be developed with rapidly, and cleanly. - . - This package contains some extra Evas engine modules: - - GL/X11 - - Framebuffer diff --git a/debian/_original/copyright b/debian/_original/copyright deleted file mode 100644 index 3353e50..0000000 --- a/debian/_original/copyright +++ /dev/null @@ -1,38 +0,0 @@ -This package was debianized by Debian Pkg-e Team -Sat, 07 Jul 2007 09:29:10 +0000. - -It was downloaded from http://download.enlightenment.org/ - -Upstream Authors: - - Enlightenment team - -Copyright: - - Copyright (C) 2000 Carsten Haitzler and various contributors (see AUTHORS) - src/modules/engines/fb/evas_fb.h: Copyright (c) 1999 - Carsten Haitzler - src/modules/engines/fb/evas_fb_main.c: Copyright (c) 1999 - Carsten Haitzler - -License: - - 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. - -On Debian systems, the complete text of the BSD License can be found -in `/usr/share/common-licenses/BSD'. diff --git a/debian/_original/libevas-dev.install b/debian/_original/libevas-dev.install deleted file mode 100644 index b2b373c..0000000 --- a/debian/_original/libevas-dev.install +++ /dev/null @@ -1,4 +0,0 @@ -debian/tmp/usr/include/* -debian/tmp/usr/lib/lib*.a -debian/tmp/usr/lib/pkgconfig/* -debian/tmp/usr/lib/libevas.so diff --git a/debian/_original/libevas-doc.dirs b/debian/_original/libevas-doc.dirs deleted file mode 100644 index fc70dc0..0000000 --- a/debian/_original/libevas-doc.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/share/doc/libevas-doc diff --git a/debian/_original/libevas-doc.doc-base b/debian/_original/libevas-doc.doc-base deleted file mode 100644 index 397f3dd..0000000 --- a/debian/_original/libevas-doc.doc-base +++ /dev/null @@ -1,10 +0,0 @@ -Document: evas -Title: Evas Guide -Author: Carsten Haitzler -Abstract: This document describes Evas API - and provides sample C code. -Section: Programming/C - -Format: HTML -Index: /usr/share/doc/libevas-doc/html/index.html -Files: /usr/share/doc/libevas-doc/html/*.html diff --git a/debian/_original/libevas-engines-extras.install b/debian/_original/libevas-engines-extras.install deleted file mode 100644 index 45a5936..0000000 --- a/debian/_original/libevas-engines-extras.install +++ /dev/null @@ -1,2 +0,0 @@ -debian/tmp/usr/lib/evas/modules/engines/fb/*/module.so -debian/tmp/usr/lib/evas/modules/engines/gl_x11/*/module.so diff --git a/debian/_original/libevas-engines.install b/debian/_original/libevas-engines.install deleted file mode 100644 index 7a83942..0000000 --- a/debian/_original/libevas-engines.install +++ /dev/null @@ -1,4 +0,0 @@ -debian/tmp/usr/lib/evas/modules/engines/buffer/*/module.so -debian/tmp/usr/lib/evas/modules/engines/software_generic/*/module.so -debian/tmp/usr/lib/evas/modules/engines/software_x11/*/module.so -debian/tmp/usr/lib/evas/modules/engines/xrender_x11/*/module.so diff --git a/debian/_original/libevas-svn-01.install b/debian/_original/libevas-svn-01.install deleted file mode 100644 index 4fb48cb..0000000 --- a/debian/_original/libevas-svn-01.install +++ /dev/null @@ -1,3 +0,0 @@ -debian/tmp/usr/lib/libevas-*.so.* -debian/tmp/usr/lib/evas/modules/loaders/*/*/*.so -debian/tmp/usr/lib/evas/modules/savers/*/*/*.so diff --git a/debian/_original/libevas-svn-01.shlibs b/debian/_original/libevas-svn-01.shlibs deleted file mode 100644 index d095002..0000000 --- a/debian/_original/libevas-svn-01.shlibs +++ /dev/null @@ -1 +0,0 @@ -libevas-ver-pre-svn-01 0 libevas-svn-01 (>= 0.9.9.060+svnYYYYMMDD) diff --git a/debian/_original/rules b/debian/_original/rules deleted file mode 100755 index 382ac9e..0000000 --- a/debian/_original/rules +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/make -f - -include /usr/share/cdbs/1/class/autotools.mk -include /usr/share/cdbs/1/rules/debhelper.mk - -DEB_CONFIGURE_SCRIPT := ./autogen.sh -DEB_MAKE_CLEAN_TARGET := distclean -CFLAGS += -fvisibility=hidden -ffast-math -LDFLAGS += -fvisibility=hidden - -DEB_DH_STRIP_ARGS := --dbg-package=libevas-dbg - -ifeq (hppa,$(DEB_HOST_ARCH)) - arch_flags += --disable-pthreads -else - arch_flags += --enable-pthreads -endif - -ifeq (amd64,$(DEB_HOST_ARCH)) - arch_flags += --enable-cpu-sse -endif - -DEB_CONFIGURE_EXTRA_FLAGS := --enable-strict \ - --enable-fontconfig \ - --enable-software-x11 \ - --enable-fb \ - --enable-buffer \ - --enable-gl-x11 \ - --enable-xrender-x11 \ - --enable-image-loader-gif \ - --enable-image-loader-png \ - --enable-image-loader-jpeg \ - --enable-image-loader-eet \ - --enable-font-loader-eet \ - --enable-image-loader-tiff \ - --enable-image-loader-xpm \ - --enable-image-loader-svg \ - --enable-scale-sample \ - --enable-scale-smooth \ - --enable-convert-yuv \ - --enable-small-dither-mask \ - --enable-convert-8-rgb-332 \ - --enable-convert-8-rgb-666 \ - --enable-convert-8-rgb-232 \ - --enable-convert-8-rgb-222 \ - --enable-convert-8-rgb-221 \ - --enable-convert-8-rgb-121 \ - --enable-convert-8-rgb-111 \ - --enable-convert-16-rgb-565 \ - --enable-convert-16-bgr-565 \ - --enable-convert-16-rgb-555 \ - --enable-convert-16-rgb-444 \ - --enable-convert-16-rgb-ipq \ - --enable-convert-16-rgb-rot-0 \ - --enable-convert-16-rgb-rot-180 \ - --enable-convert-16-rgb-rot-270 \ - --enable-convert-16-rgb-rot-90 \ - --enable-convert-24-rgb-888 \ - --enable-convert-24-bgr-888 \ - --enable-convert-32-rgb-8888 \ - --enable-convert-32-rgbx-8888 \ - --enable-convert-32-bgr-8888 \ - --enable-convert-32-bgrx-8888 \ - --enable-convert-32-rgb-rot-0 \ - --enable-convert-32-rgb-rot-180 \ - --enable-convert-32-rgb-rot-270 \ - --enable-convert-32-rgb-rot-90 \ - --disable-image-loader-edb \ - --enable-doc \ - --disable-rpath $(arch_flags) - -build/libevas-doc:: - cd $(DEB_SRCDIR)/doc && make doc - -install/libevas-doc:: - mkdir -p debian/libevas-doc/usr/share/doc/libevas-doc - cp -R $(DEB_SRCDIR)/doc/html debian/libevas-doc/usr/share/doc/libevas-doc/ - -clean:: - [ ! -f Makefile ] || make distclean - rm -f evas-*.tar.bz2 evas-*.cdbs-config_list diff --git a/debian/changelog b/debian/changelog index ae7557c..b482229 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +evas (1.0.0.001+svn.63811slp2+build01) unstable; urgency=low + + * Merge with upstream + * Git: 165.213.180.234:/slp/pkgs/e/evas + * Tag: evas_1.0.0.001+svn.63811slp2+build01 + + -- Mike McCormack Wed, 05 Oct 2011 14:39:09 +0900 + evas (1.0.0.001+svn.62695slp2+build32) unstable; urgency=low * Package Upload. diff --git a/debian/control b/debian/control index 9a52c28..2315d22 100755 --- a/debian/control +++ b/debian/control @@ -1,18 +1,45 @@ Source: evas Section: libs Priority: optional -Maintainer: Jaehwan Kim , Sangjin Lee , Doyoun Kang , YoungHoon Jung , Myungjae Lee , Juyung Seo , Gwanglim Lee , Jeonghyun Yun , Seokjae Jeong , MyoungWoon Kim , ChunEon Park , Hyoyoung Chang , WooHyun Jung , Gwangyeong Mun , Jiyoun Park , Shinwoo Kim -Original-Maintainer: Debian Pkg-e Team -Uploaders: Albin Tonnerre , - Niv Sardi , Xavier Oswald , - Jan Lübbe , - Nikita V. Youshchenko -Build-Depends: debhelper (>= 6), cdbs, libeet-dev (>= 1.1.0), libeina-dev (>= 0.0.2.060+svn20100304), - libfreetype6-dev, libpng12-dev | libpng-dev, libx11-dev, libxrender-dev, - x11proto-xext-dev, zlib1g, libjpeg7-dev, - libfontconfig1-dev, libxpm-dev, - doxygen, pkg-config, libtool, libxext-dev, opengl-es-dev, libfribidi-dev, libharfbuzz-dev, - libgif-dev, libsm-dev +Maintainer: Jaehwan Kim , + Sangjin Lee , + Doyoun Kang , + YoungHoon Jung , + Myungjae Lee , + Juyung Seo , + Gwanglim Lee , + Jeonghyun Yun , + Seokjae Jeong , + MyoungWoon Kim , + ChunEon Park , + Hyoyoung Chang , + WooHyun Jung , + Gwangyeong Mun , + Jiyoun Park , + Shinwoo Kim , + Mike McCormack +Build-Depends: debhelper (>= 6), + cdbs, + libeet-dev (>= 1.1.0), + libeina-dev (>= 0.0.2.060+svn20100304), + libfreetype6-dev, + libpng12-dev | libpng-dev, + libx11-dev, + libxrender-dev, + x11proto-xext-dev, + zlib1g, + libjpeg7-dev, + libfontconfig1-dev, + libxpm-dev, + doxygen, + pkg-config, + libtool, + libxext-dev, + opengl-es-dev, + libfribidi-dev, + libharfbuzz-dev, + libgif-dev, + libsm-dev Standards-Version: 3.8.1 Homepage: http://www.enlightenment.org diff --git a/debian/rules b/debian/rules index e5c965e..9e1280a 100755 --- a/debian/rules +++ b/debian/rules @@ -43,8 +43,8 @@ DEB_CONFIGURE_EXTRA_FLAGS := --disable-image-loader-svg \ --enable-gl-flavor-gles \ --enable-gles-variety-sgx -build/libevas-doc:: - cd $(DEB_SRCDIR)/doc && make doc +#build/libevas-doc:: +# cd $(DEB_SRCDIR)/doc && make doc install:: ifeq (i386,$(DEB_HOST_ARCH)) @@ -53,9 +53,9 @@ else cp -f $(DEB_SRCDIR)/debian/libevas-engines-extras.install.default $(DEB_SRCDIR)/debian/libevas-engines-extras.install endif -install/libevas-doc:: - mkdir -p debian/libevas-doc/usr/share/doc/libevas-doc - cp -R $(DEB_SRCDIR)/doc/html debian/libevas-doc/usr/share/doc/libevas-doc/ +#install/libevas-doc:: +# mkdir -p debian/libevas-doc/usr/share/doc/libevas-doc +# cp -R $(DEB_SRCDIR)/doc/html debian/libevas-doc/usr/share/doc/libevas-doc/ clean:: [ ! -f Makefile ] || make distclean diff --git a/evas.spec.in b/evas.spec.in index 11a1aee..988e2dd 100644 --- a/evas.spec.in +++ b/evas.spec.in @@ -376,7 +376,7 @@ Software SDL X11 rendering engine module for Evas %package module_engine_software_xcb Summary: Software XCB X11 rendering engine module for Evas Group: System Environment/Libraries -BuildRequires: xcb-devel +BuildRequires: libxcb-devel Requires: evas-module_engine_software_generic Requires: evas %description module_engine_software_xcb diff --git a/m4/ac_attribute.m4 b/m4/ac_attribute.m4 deleted file mode 100644 index 23479a9..0000000 --- a/m4/ac_attribute.m4 +++ /dev/null @@ -1,47 +0,0 @@ -dnl Copyright (C) 2004-2008 Kim Woelders -dnl Copyright (C) 2008 Vincent Torri -dnl That code is public domain and can be freely used or copied. -dnl Originally snatched from somewhere... - -dnl Macro for checking if the compiler supports __attribute__ - -dnl Usage: AC_C___ATTRIBUTE__ -dnl call AC_DEFINE for HAVE___ATTRIBUTE__ and __UNUSED__ -dnl if the compiler supports __attribute__, HAVE___ATTRIBUTE__ is -dnl defined to 1 and __UNUSED__ is defined to __attribute__((unused)) -dnl otherwise, HAVE___ATTRIBUTE__ is not defined and __UNUSED__ is -dnl defined to nothing. - -AC_DEFUN([AC_C___ATTRIBUTE__], -[ - -AC_MSG_CHECKING([for __attribute__]) - -AC_CACHE_VAL([ac_cv___attribute__], - [AC_TRY_COMPILE( - [ -#include - -int func(int x); -int foo(int x __attribute__ ((unused))) -{ - exit(1); -} - ], - [], - [ac_cv___attribute__="yes"], - [ac_cv___attribute__="no"] - )]) - -AC_MSG_RESULT($ac_cv___attribute__) - -if test "x${ac_cv___attribute__}" = "xyes" ; then - AC_DEFINE([HAVE___ATTRIBUTE__], [1], [Define to 1 if your compiler has __attribute__]) - AC_DEFINE([__UNUSED__], [__attribute__((unused))], [Macro declaring a function argument to be unused]) - else - AC_DEFINE([__UNUSED__], [], [Macro declaring a function argument to be unused]) -fi - -]) - -dnl End of ac_attribute.m4 diff --git a/m4/evas_check_engine.m4 b/m4/evas_check_engine.m4 index e884403..5d3c450 100644 --- a/m4/evas_check_engine.m4 +++ b/m4/evas_check_engine.m4 @@ -446,6 +446,42 @@ fi ]) + +dnl use: EVAS_CHECK_ENGINE_DEP_SOFTWARE_16_SDL(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) + +AC_DEFUN([EVAS_CHECK_ENGINE_DEP_SOFTWARE_16_SDL], +[ + +requirement="" +have_dep="no" +evas_engine_[]$1[]_cflags="" +evas_engine_[]$1[]_libs="" + +PKG_CHECK_MODULES([SDL], + [sdl >= 1.2.0], + [ + have_dep="yes" + requirement="sdl" + evas_engine_[]$1[]_cflags="${SDL_CFLAGS}" + evas_engine_[]$1[]_libs="${SDL_LIBS}" + ] +) + +AC_SUBST([evas_engine_$1_cflags]) +AC_SUBST([evas_engine_$1_libs]) + +if test "x$3" = "xstatic" ; then + requirement_evas="${requirement} ${requirement_evas}" +fi + +if test "x${have_dep}" = "xyes" ; then + m4_default([$4], [:]) +else + m4_default([$5], [:]) +fi + +]) + dnl use: EVAS_CHECK_ENGINE_DEP_GL_SDL(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_SDL], diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 deleted file mode 100644 index 637bb20..0000000 --- a/m4/lt~obsolete.m4 +++ /dev/null @@ -1,92 +0,0 @@ -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 4 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) diff --git a/src/lib/Evas.h b/src/lib/Evas.h index 6af9873..a1d536a 100644 --- a/src/lib/Evas.h +++ b/src/lib/Evas.h @@ -296,6 +296,8 @@ Recommended reading: @author Myoungwoon Roy Kim(roy_kim) @author Thierry el Borgi @author ChunEon Park +@author Christopher 'devilhorns' Michael +@author Seungsoo Woo Please contact to get in contact with the developers and maintainers. @@ -428,6 +430,7 @@ typedef enum _Evas_Callback_Type * More Evas object event types - see evas_object_event_callback_add(): */ EVAS_CALLBACK_IMAGE_UNLOADED, /**< Image data has been unloaded (by some mechanims in Evas that throw out original image data) */ + EVAS_CALLBACK_TOUCH, /**< Touch Event */ EVAS_CALLBACK_LAST /**< kept as last element/sentinel -- not really an event */ } Evas_Callback_Type; /**< The types of events triggering a callback */ @@ -486,6 +489,29 @@ typedef enum _Evas_Event_Flags } Evas_Event_Flags; /**< Flags for Events */ /** + * State of Evas_Coord_Touch_Point + */ +typedef enum _Evas_Touch_Point_State +{ + EVAS_TOUCH_POINT_DOWN, /**< Touch point is pressed down */ + EVAS_TOUCH_POINT_UP, /**< Touch point is released */ + EVAS_TOUCH_POINT_MOVE, /**< Touch point is moved */ + EVAS_TOUCH_POINT_STILL, /**< Touch point is not moved after pressed */ + EVAS_TOUCH_POINT_CANCEL /**< Touch point is calcelled */ +} Evas_Touch_Point_State; + +/** + * Types for Evas_Touch_Event + */ +typedef enum _Evas_Event_Touch_Type +{ + EVAS_EVENT_TOUCH_BEGIN, /**< Begin touch event with pressed new touch point */ + EVAS_EVENT_TOUCH_END, /**< End touch event with released touch point */ + EVAS_EVENT_TOUCH_MOVE, /**< Any touch point in the touch_points list is moved */ + EVAS_EVENT_TOUCH_CANCEL /**< Touch event is cancelled */ +} Evas_Event_Touch_Type; + +/** * Flags for Font Hinting * @ingroup Evas_Font_Group */ @@ -508,7 +534,9 @@ typedef enum _Evas_Colorspace EVAS_COLORSPACE_YCBCR422P709_PL,/**< YCbCr 4:2:2 Planar, ITU.BT-709 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */ EVAS_COLORSPACE_RGB565_A5P, /**< 16bit rgb565 + Alpha plane at end - 5 bits of the 8 being used per alpha byte */ EVAS_COLORSPACE_GRY8, /**< 8bit grayscale */ - EVAS_COLORSPACE_YCBCR422601_PL /**< YCbCr 4:2:2, ITU.BT-601 specifications. The data poitned to is just an array of row pointer, pointing to line of Y,Cb,Y,Cr bytes */ + EVAS_COLORSPACE_YCBCR422601_PL, /**< YCbCr 4:2:2, ITU.BT-601 specifications. The data poitned to is just an array of row pointer, pointing to line of Y,Cb,Y,Cr bytes */ + EVAS_COLORSPACE_YCBCR420NV12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb,Cr rows. */ + EVAS_COLORSPACE_YCBCR420TM12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of tiled row pointer, pointing to the Y rows, then the Cb,Cr rows. */ } Evas_Colorspace; /**< Colorspaces for pixel data supported by Evas */ /** @@ -530,6 +558,7 @@ typedef struct _Evas_Point Evas_Point; /**< integer point */ typedef struct _Evas_Coord_Point Evas_Coord_Point; /**< Evas_Coord point */ typedef struct _Evas_Coord_Precision_Point Evas_Coord_Precision_Point; /**< Evas_Coord point with sub-pixel precision */ +typedef struct _Evas_Coord_Touch_Point Evas_Coord_Touch_Point; /**< Evas_Coord point with touch type and id */ typedef struct _Evas_Position Evas_Position; /**< associates given point in Canvas and Output */ typedef struct _Evas_Precision_Position Evas_Precision_Position; /**< associates given point in Canvas and Output, with sub-pixel precision */ @@ -589,6 +618,17 @@ typedef struct _Evas_Modifier Evas_Modifier; /**< An opaque type containin typedef struct _Evas_Lock Evas_Lock; /**< An opaque type containing information on which lock keys are registered in an Evas canvas */ typedef struct _Evas_Smart Evas_Smart; /**< An Evas Smart Object handle */ typedef struct _Evas_Native_Surface Evas_Native_Surface; /**< A generic datatype for engine specific native surface information */ + + /** + * @typedef Evas_Video_Surface + * + * A generic datatype for video specific surface information + * @see evas_object_image_video_surface_set + * @see evas_object_image_video_surface_get + * @since 1.1.0 + */ +typedef struct _Evas_Video_Surface Evas_Video_Surface; + typedef unsigned long long Evas_Modifier_Mask; /**< An Evas modifier mask type */ typedef int Evas_Coord; @@ -619,6 +659,13 @@ struct _Evas_Coord_Precision_Point double xsub, ysub; }; +struct _Evas_Coord_Touch_Point +{ + Evas_Coord x, y; + int id; /**< id in order to distinguish each point */ + Evas_Touch_Point_State state; +}; + struct _Evas_Position { Evas_Point output; @@ -655,6 +702,7 @@ typedef struct _Evas_Event_Multi_Move Evas_Event_Multi_Move; /**< Event structur typedef struct _Evas_Event_Key_Down Evas_Event_Key_Down; /**< Event structure for #EVAS_CALLBACK_KEY_DOWN event callbacks */ typedef struct _Evas_Event_Key_Up Evas_Event_Key_Up; /**< Event structure for #EVAS_CALLBACK_KEY_UP event callbacks */ typedef struct _Evas_Event_Hold Evas_Event_Hold; /**< Event structure for #EVAS_CALLBACK_HOLD event callbacks */ +typedef struct _Evas_Event_Touch Evas_Event_Touch; /**< Event structure for #EVAS_CALLBACK_TOUCH event callbacks */ typedef enum _Evas_Load_Error { @@ -728,6 +776,30 @@ struct _Evas_Native_Surface } data; }; +/** + * @def EVAS_VIDEO_SURFACE_VERSION + * Magic version number to know what the video surf struct looks like + * @since 1.1.0 + */ +#define EVAS_VIDEO_SURFACE_VERSION 1 + +typedef void (*Evas_Video_Cb)(void *data, Evas_Object *obj, const Evas_Video_Surface *surface); +typedef void (*Evas_Video_Coord_Cb)(void *data, Evas_Object *obj, const Evas_Video_Surface *surface, Evas_Coord a, Evas_Coord b); + +struct _Evas_Video_Surface +{ + int version; + + Evas_Video_Coord_Cb move; /**< Move the video surface to this position */ + Evas_Video_Coord_Cb resize; /**< Resize the video surface to that size */ + Evas_Video_Cb show; /**< Show the video overlay surface */ + Evas_Video_Cb hide; /**< Hide the video overlay surface */ + Evas_Video_Cb update_pixels; /**< Please update the Evas_Object_Image pixels when called */ + + Evas_Object *parent; + void *data; +}; + #define EVAS_LAYER_MIN -32768 /**< bottom-most layer number */ #define EVAS_LAYER_MAX 32767 /**< top-most layer number */ @@ -991,6 +1063,14 @@ struct _Evas_Event_Hold /** Hold change event */ Evas_Device *dev; }; +struct _Evas_Event_Touch /** Touch event */ +{ + Eina_List *points; /**< Evas_Coord_Touch_Point list */ + Evas_Modifier *modifiers; + unsigned int timestamp; + Evas_Event_Touch_Type type; /**< Type for Evas_Event_Touch */ +}; + /** * How the mouse pointer should be handled by Evas. * @@ -1030,7 +1110,7 @@ typedef void (*Evas_Async_Events_Put_Cb)(void *target, Evas_Callback_Type t * @return The init counter value. * * This function initializes Evas and increments a counter of the - * number of calls to it. It returs the new counter's value. + * number of calls to it. It returns the new counter's value. * * @see evas_shutdown(). * @@ -3327,6 +3407,7 @@ EAPI Eina_Bool evas_object_visible_get (const Evas_Object *obj * @param a The alpha component of the given color. * * @see evas_object_color_get() (for an example) + * @note These color values are expected to be premultiplied by @p a. * * @ingroup Evas_Object_Group_Basic */ @@ -3347,8 +3428,9 @@ EAPI void evas_object_color_set (Evas_Object *obj, int * * Retrieves the “main” color's RGB component (and alpha channel) * values, which range from 0 to 255. For the alpha channel, - * which defines the object's transparency level, the former value - * means totally trasparent, while the latter means opaque. + * which defines the object's transparency level, 0 means totally + * trasparent, while 255 means opaque. These color values are + * premultiplied by the alpha value. * * Usually you’ll use this attribute for text and rectangle objects, * where the “main” color is their unique one. If set for objects @@ -7015,6 +7097,30 @@ EAPI void evas_object_image_native_surface_set (Evas_Obj EAPI Evas_Native_Surface *evas_object_image_native_surface_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; /** + * Set the video surface linked to a given image of the canvas + * + * @param obj The given canvas pointer. + * @param surf The new video surface. + * @since 1.1.0 + * + * This function link a video surface to a given canvas image. + * + */ +EAPI void evas_object_image_video_surface_set (Evas_Object *obj, Evas_Video_Surface *surf) EINA_ARG_NONNULL(1, 2); + +/** + * Get the video surface linekd to a given image of the canvas + * + * @param obj The given canvas pointer. + * @return The video surface of the given canvas image. + * @since 1.1.0 + * + * This function returns the video surface linked to a given canvas image. + * + */ +EAPI const Evas_Video_Surface *evas_object_image_video_surface_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; + +/** * Set the scale hint of a given image of the canvas. * * @param obj The given image object pointer. @@ -7205,7 +7311,7 @@ EAPI Eina_Bool evas_object_image_extension_can_load_fast_get(const char *file); * @endcode * * @see evas_object_image_animated_get() - * @see evas_object_image_animated_frame_num_get() + * @see evas_object_image_animated_frame_count_get() * @see evas_object_image_animated_loop_type_get() * @see evas_object_image_animated_loop_count_get() * @see evas_object_image_animated_frame_duration_get() @@ -7223,7 +7329,7 @@ EAPI Eina_Bool evas_object_image_animated_get(const Evas_Object *obj); * This returns total number of frames the image object supports (if animated) * * @see evas_object_image_animated_get() - * @see evas_object_image_animated_frame_num_get() + * @see evas_object_image_animated_frame_count_get() * @see evas_object_image_animated_loop_type_get() * @see evas_object_image_animated_loop_count_get() * @see evas_object_image_animated_frame_duration_get() @@ -7231,7 +7337,6 @@ EAPI Eina_Bool evas_object_image_animated_get(const Evas_Object *obj); * @since 1.1.0 */ EAPI int evas_object_image_animated_frame_count_get(const Evas_Object *obj); -EINA_DEPRECATED EAPI int evas_object_image_animated_frame_num_get(const Evas_Object *obj); /** * Get the kind of looping the image object does. @@ -7249,7 +7354,7 @@ EINA_DEPRECATED EAPI int evas_object_image_animated_frame_num_get(const Evas_Obj * The default type is EVAS_IMAGE_ANIMATED_HINT_LOOP. * * @see evas_object_image_animated_get() - * @see evas_object_image_animated_frame_num_get() + * @see evas_object_image_animated_frame_count_get() * @see evas_object_image_animated_loop_type_get() * @see evas_object_image_animated_loop_count_get() * @see evas_object_image_animated_frame_duration_get() @@ -7272,7 +7377,7 @@ EAPI Evas_Image_Animated_Loop_Hint evas_object_image_animated_loop_type_get(cons * the number of times it loops). * * @see evas_object_image_animated_get() - * @see evas_object_image_animated_frame_num_get() + * @see evas_object_image_animated_frame_count_get() * @see evas_object_image_animated_loop_type_get() * @see evas_object_image_animated_loop_count_get() * @see evas_object_image_animated_frame_duration_get() @@ -7296,7 +7401,7 @@ EAPI int evas_object_image_animated_loop_count_get(const Evas_Object *obj); * frame2's duration * * @see evas_object_image_animated_get() - * @see evas_object_image_animated_frame_num_get() + * @see evas_object_image_animated_frame_count_get() * @see evas_object_image_animated_loop_type_get() * @see evas_object_image_animated_loop_count_get() * @see evas_object_image_animated_frame_duration_get() @@ -7315,7 +7420,7 @@ EAPI double evas_object_image_animated_frame_duration_get(const Evas_Object *obj * frame. * * @see evas_object_image_animated_get() - * @see evas_object_image_animated_frame_num_get() + * @see evas_object_image_animated_frame_count_get() * @see evas_object_image_animated_loop_type_get() * @see evas_object_image_animated_loop_count_get() * @see evas_object_image_animated_frame_duration_get() @@ -9753,6 +9858,24 @@ EAPI void evas_object_smart_calculate (Evas_Object *obj) EINA EAPI void evas_smart_objects_calculate (Evas *e); /** + * This gets the internal counter that counts the number of smart calculations + * + * @param e The canvas to get the calculate counter from + * + * Whenever evas performs smart object calculations on the whole canvas + * it increments a counter by 1. This is the smart object calculate counter + * that this function returns the value of. It starts at the value of 0 and + * will increase (and eventually wrap around to negative values and so on) by + * 1 every time objects are calculated. You can use this counter to ensure + * you dont re-do calculations withint the same calculation generation/run + * if the calculations maybe cause self-feeding effects. + * + * @ingroup Evas_Smart_Object_Group + * @since 1.1 + */ +EAPI int evas_smart_objects_calculate_count_get (const Evas *e); + +/** * Moves all children objects of a given smart object relative to a * given offset. * diff --git a/src/lib/cache/evas_cache_image.c b/src/lib/cache/evas_cache_image.c index c6ab7bb..d52c64e 100755 --- a/src/lib/cache/evas_cache_image.c +++ b/src/lib/cache/evas_cache_image.c @@ -285,8 +285,8 @@ _evas_cache_image_entry_new(Evas_Cache_Image *cache, ie = cache->func.alloc(); if (!ie) { - *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; - return NULL; + *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + return NULL; } ie->cache = cache; if (hkey) ie->cache_key = eina_stringshare_add(hkey); @@ -326,8 +326,8 @@ _evas_cache_image_entry_new(Evas_Cache_Image *cache, static void _evas_cache_image_entry_surface_alloc__locked(Evas_Cache_Image *cache, - Image_Entry *ie, - unsigned int wmin, + Image_Entry *ie, + unsigned int wmin, unsigned int hmin) { if ((ie->allocated.w == wmin) && (ie->allocated.h == hmin)) return; @@ -461,6 +461,7 @@ _evas_cache_image_entry_preload_add(Image_Entry *ie, const void *target) Evas_Cache_Target *tg; if (ie->flags.preload_done) return 0; + tg = malloc(sizeof (Evas_Cache_Target)); if (!tg) return 0; @@ -641,8 +642,8 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache) eina_hash_foreach(cache->activ, _evas_cache_image_free_cb, &delete_list); while (delete_list) { - _evas_cache_image_entry_delete(cache, eina_list_data_get(delete_list)); - delete_list = eina_list_remove_list(delete_list, delete_list); + _evas_cache_image_entry_delete(cache, eina_list_data_get(delete_list)); + delete_list = eina_list_remove_list(delete_list, delete_list); } #ifdef BUILD_ASYNC_PRELOAD @@ -679,7 +680,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *ckey = "(null)"; char *hkey; Image_Entry *im; - Evas_Image_Load_Opts prevent = { 0, 0, 0, 0, { 0, 0, 0, 0 }, 0 }; + Evas_Image_Load_Opts prevent = { 0, 0.0, 0, 0, 0, { 0, 0, 0, 0 }, EINA_FALSE }; size_t size; int stat_done = 0, stat_failed = 0; size_t file_length; @@ -689,8 +690,8 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, if ((!file) || ((!file) && (!key))) { - *error = EVAS_LOAD_ERROR_GENERIC; - return NULL; + *error = EVAS_LOAD_ERROR_GENERIC; + return NULL; } /* generate hkey from file+key+load opts */ @@ -746,8 +747,9 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, if (lo->orientation) { hkey[size] = '/'; + size += 1; hkey[size] = 'o'; - size += 2; + size += 1; } } hkey[size] = '\0'; @@ -877,7 +879,7 @@ evas_cache_image_drop(Image_Entry *im) #ifdef EVAS_FRAME_QUEUING LKU(im->lock_references); #endif - + cache = im->cache; if (references == 0) @@ -891,8 +893,8 @@ evas_cache_image_drop(Image_Entry *im) LKU(im->ref_fq_del); return; } - LKU(im->ref_fq_add); - LKU(im->ref_fq_del); + LKU(im->ref_fq_add); + LKU(im->ref_fq_del); #endif #ifdef BUILD_ASYNC_PRELOAD @@ -1232,7 +1234,7 @@ evas_cache_image_unload_data(Image_Entry *im) #ifdef BUILD_ASYNC_PRELOAD LKU(im->lock); #endif - return; + return; } im->cache->func.destructor(im); #ifdef BUILD_ASYNC_PRELOAD @@ -1274,8 +1276,8 @@ evas_cache_image_preload_data(Image_Entry *im, const void *target) if ((im->flags.loaded) && (img->image.data)) { - evas_object_inform_call_image_preloaded((Evas_Object *)target); - return; + evas_object_inform_call_image_preloaded((Evas_Object *)target); + return; } im->flags.loaded = 0; if (!_evas_cache_image_entry_preload_add(im, target)) @@ -1348,7 +1350,7 @@ evas_cache_image_flush(Evas_Cache_Image *cache) { #ifdef CACHEDUMP _dump_cache(cache); -#endif +#endif if (cache->limit == (unsigned int)-1) return -1; while ((cache->lru) && (cache->limit < (unsigned int)cache->usage)) diff --git a/src/lib/canvas/Makefile.am b/src/lib/canvas/Makefile.am index 32dadc3..fd32990 100644 --- a/src/lib/canvas/Makefile.am +++ b/src/lib/canvas/Makefile.am @@ -51,6 +51,7 @@ evas_smart.c \ evas_stack.c \ evas_async_events.c \ evas_stats.c \ +evas_touch_events.c \ evas_map.c \ evas_gl.c diff --git a/src/lib/canvas/evas_callbacks.c b/src/lib/canvas/evas_callbacks.c index 33b93bc..f87adaa 100644 --- a/src/lib/canvas/evas_callbacks.c +++ b/src/lib/canvas/evas_callbacks.c @@ -249,7 +249,7 @@ evas_object_event_callback_call(Evas_Object *obj, Evas_Callback_Type type, void if (!obj->no_propagate) { if ((obj->smart.parent) && (type != EVAS_CALLBACK_FREE) && - (type <= EVAS_CALLBACK_KEY_UP)) + ((type <= EVAS_CALLBACK_KEY_UP) || (type == EVAS_CALLBACK_TOUCH))) evas_object_event_callback_call(obj->smart.parent, type, event_info); } } diff --git a/src/lib/canvas/evas_events.c b/src/lib/canvas/evas_events.c index eff4fa1..33b5015 100644 --- a/src/lib/canvas/evas_events.c +++ b/src/lib/canvas/evas_events.c @@ -5,10 +5,10 @@ static void _evas_event_havemap_adjust(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Eina_Bool mouse_grabbed) { if (obj->smart.parent) - _evas_event_havemap_adjust(obj->smart.parent, x, y, mouse_grabbed); + _evas_event_havemap_adjust(obj->smart.parent, x, y, mouse_grabbed); if ((!obj->cur.map) || (!obj->cur.map->count == 4) || (!obj->cur.usemap)) - return; + return; if (obj->cur.map) { @@ -140,7 +140,7 @@ evas_event_list_copy(Eina_List *list) const void *data; EINA_LIST_FOREACH(list, l, data) - new_l = eina_list_append(new_l, data); + new_l = eina_list_append(new_l, data); return new_l; } /* public functions */ @@ -270,6 +270,9 @@ evas_event_feed_mouse_down(Evas *e, int b, Evas_Button_Flags flags, unsigned int e->last_mouse_down_counter++; _evas_post_event_callback_call(e); _evas_unwalk(e); + + /* process mouse down for touch */ + _evas_event_touch_down(e, e->pointer.x, e->pointer.y, 0, timestamp); } static int @@ -309,7 +312,7 @@ _post_up_handle(Evas *e, unsigned int timestamp, const void *data) { obj->mouse_in = 0; if (e->events_frozen <= 0) - evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev); + evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev); } } if (e->delete_me) break; @@ -346,7 +349,7 @@ _post_up_handle(Evas *e, unsigned int timestamp, const void *data) { obj_itr->mouse_in = 1; if (e->events_frozen <= 0) - evas_object_event_callback_call(obj_itr, EVAS_CALLBACK_MOUSE_IN, &ev_in); + evas_object_event_callback_call(obj_itr, EVAS_CALLBACK_MOUSE_IN, &ev_in); } } if (e->delete_me) break; @@ -372,7 +375,7 @@ _post_up_handle(Evas *e, unsigned int timestamp, const void *data) eina_list_free(ins); } if (e->pointer.inside) - evas_event_feed_mouse_move(e, e->pointer.x, e->pointer.y, timestamp, data); + evas_event_feed_mouse_move(e, e->pointer.x, e->pointer.y, timestamp, data); return post_called; } @@ -445,16 +448,19 @@ evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags, unsigned int t ERR("BUG? e->pointer.mouse_grabbed (=%d) < 0!", e->pointer.mouse_grabbed); } - /* don't need this anymore - havent actually triggered this for a long - * time and this also doesn't account for multitouch, so leave here if we - * ever find bugs again so we can turn it on, but otherwise.. dont use this - if ((e->pointer.button == 0) && (e->pointer.mouse_grabbed != 0)) - { - INF("restore to 0 grabs (from %i)", e->pointer.mouse_grabbed); - e->pointer.mouse_grabbed = 0; - } - */ +/* don't need this anymore - havent actually triggered this for a long + * time and this also doesn't account for multitouch, so leave here if we + * ever find bugs again so we can turn it on, but otherwise.. dont use this + if ((e->pointer.button == 0) && (e->pointer.mouse_grabbed != 0)) + { + INF("restore to 0 grabs (from %i)", e->pointer.mouse_grabbed); + e->pointer.mouse_grabbed = 0; + } + */ _evas_unwalk(e); + + /* process mouse up for touch */ + _evas_event_touch_up(e, e->pointer.x, e->pointer.y, 0, timestamp); } EAPI void @@ -527,7 +533,7 @@ EAPI void evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const void *data) { int px, py; - //// Evas_Coord pcx, pcy; +//// Evas_Coord pcx, pcy; MAGIC_CHECK(e, Evas, MAGIC_EVAS); return; @@ -535,18 +541,18 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const px = e->pointer.x; py = e->pointer.y; - //// pcx = e->pointer.canvas_x; - //// pcy = e->pointer.canvas_y; +//// pcx = e->pointer.canvas_x; +//// pcy = e->pointer.canvas_y; if (e->events_frozen > 0) return; e->last_timestamp = timestamp; e->pointer.x = x; e->pointer.y = y; - //// e->pointer.canvas_x = x; - //// e->pointer.canvas_y = y; - //// e->pointer.canvas_x = evas_coord_screen_x_to_world(e, x); - //// e->pointer.canvas_y = evas_coord_screen_y_to_world(e, y); +//// e->pointer.canvas_x = x; +//// e->pointer.canvas_y = y; +//// e->pointer.canvas_x = evas_coord_screen_x_to_world(e, x); +//// e->pointer.canvas_y = evas_coord_screen_y_to_world(e, y); if ((!e->pointer.inside) && (e->pointer.mouse_grabbed == 0)) return; _evas_walk(e); /* if our mouse button is grabbed to any objects */ @@ -634,7 +640,7 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const if (!obj->delete_me) { if (e->events_frozen <= 0) - evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev); + evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev); } } } @@ -702,7 +708,7 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const // evas_object_clip_recalc(obj); if (evas_object_is_in_output_rect(obj, x, y, 1, 1) && ((evas_object_clippers_is_visible(obj)) || - (obj->mouse_grabbed)) && + (obj->mouse_grabbed)) && (eina_list_data_find(ins, obj)) && (!evas_event_passes_through(obj)) && (!obj->clip.clipees) && @@ -728,7 +734,7 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const ev2.canvas.y = e->pointer.y; _evas_event_havemap_adjust(obj, &ev2.canvas.x, &ev2.canvas.y, obj->mouse_grabbed); if (e->events_frozen <= 0) - evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev2); + evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev2); } } if (e->delete_me) break; @@ -771,6 +777,9 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const _evas_post_event_callback_call(e); } _evas_unwalk(e); + + /* process mouse move for touch */ + _evas_event_touch_move(e, e->pointer.x, e->pointer.y, 0, timestamp); } EAPI void @@ -818,7 +827,7 @@ evas_event_feed_mouse_in(Evas *e, unsigned int timestamp, const void *data) { obj->mouse_in = 1; if (e->events_frozen <= 0) - evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev); + evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev); } } if (e->delete_me) break; @@ -878,7 +887,7 @@ evas_event_feed_mouse_out(Evas *e, unsigned int timestamp, const void *data) if (!obj->delete_me) { if (e->events_frozen <= 0) - evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev); + evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev); } } if (e->delete_me) break; @@ -960,6 +969,9 @@ evas_event_feed_multi_down(Evas *e, if (copy) eina_list_free(copy); _evas_post_event_callback_call(e); _evas_unwalk(e); + + /* process multi down for touch */ + _evas_event_touch_down(e, x, y, d, timestamp); } EAPI void @@ -1028,8 +1040,11 @@ evas_event_feed_multi_up(Evas *e, } if (copy) copy = eina_list_free(copy); if ((e->pointer.mouse_grabbed == 0) && !_post_up_handle(e, timestamp, data)) - _evas_post_event_callback_call(e); + _evas_post_event_callback_call(e); _evas_unwalk(e); + + /* process multi up for touch */ + _evas_event_touch_up(e, x, y, d, timestamp); } EAPI void @@ -1141,7 +1156,7 @@ evas_event_feed_multi_move(Evas *e, // evas_object_clip_recalc(obj); if (evas_object_is_in_output_rect(obj, x, y, 1, 1) && ((evas_object_clippers_is_visible(obj)) || - (obj->mouse_grabbed)) && + (obj->mouse_grabbed)) && (eina_list_data_find(ins, obj)) && (!evas_event_passes_through(obj)) && (!obj->clip.clipees) && @@ -1178,6 +1193,9 @@ evas_event_feed_multi_move(Evas *e, _evas_post_event_callback_call(e); } _evas_unwalk(e); + + /* process multi move for touch */ + _evas_event_touch_move(e, x, y, d, timestamp); } EAPI void @@ -1519,7 +1537,7 @@ evas_event_refeed_event(Evas *e, void *event_copy, Evas_Callback_Type event_type { Evas_Event_Multi_Down *ev = event_copy; evas_event_feed_multi_down(e, ev->device, ev->canvas.x, ev->canvas.y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, ev->canvas.xsub, ev->canvas.ysub, ev->flags, ev->timestamp, ev->data); - break; + break; } case EVAS_CALLBACK_MULTI_UP: { diff --git a/src/lib/canvas/evas_font_dir.c b/src/lib/canvas/evas_font_dir.c index b8ae05f..5a6d50d 100644 --- a/src/lib/canvas/evas_font_dir.c +++ b/src/lib/canvas/evas_font_dir.c @@ -417,7 +417,7 @@ evas_font_desc_new(void) Evas_Font_Description *fdesc; fdesc = calloc(1, sizeof(*fdesc)); fdesc->ref = 1; - fdesc->new = EINA_TRUE; + fdesc->is_new = EINA_TRUE; return fdesc; } @@ -429,7 +429,7 @@ evas_font_desc_dup(const Evas_Font_Description *fdesc) new = evas_font_desc_new(); memcpy(new, fdesc, sizeof(*new)); new->ref = 1; - new->new = EINA_TRUE; + new->is_new = EINA_TRUE; new->name = eina_stringshare_ref(new->name); return new; @@ -499,7 +499,7 @@ evas_font_load(Evas *evas, Evas_Font_Description *fdesc, const char *source, Eva Font_Rend_Flags wanted_rend = 0; if (!fdesc) return NULL; - fdesc->new = EINA_FALSE; + fdesc->is_new = EINA_FALSE; if (fdesc->slant != EVAS_FONT_SLANT_NORMAL) wanted_rend |= FONT_REND_SLANT; diff --git a/src/lib/canvas/evas_main.c b/src/lib/canvas/evas_main.c index 54e0679..d3e4c8c 100644 --- a/src/lib/canvas/evas_main.c +++ b/src/lib/canvas/evas_main.c @@ -122,7 +122,7 @@ evas_new(void) e->name_hash = eina_hash_string_superfast_new(NULL); #define EVAS_ARRAY_SET(E, Array) \ - eina_array_step_set(&E->Array, sizeof (E->Array), 256); + eina_array_step_set(&E->Array, sizeof (E->Array), 4096); EVAS_ARRAY_SET(e, delete_objects); EVAS_ARRAY_SET(e, active_objects); @@ -143,6 +143,7 @@ EAPI void evas_free(Evas *e) { Eina_Rectangle *r; + Evas_Coord_Touch_Point *touch_point; Evas_Layer *lay; int i; int del; @@ -249,6 +250,11 @@ evas_free(Evas *e) eina_array_flush(&e->calculate_objects); eina_array_flush(&e->clip_changes); + EINA_LIST_FREE(e->touch_points, touch_point) + free(touch_point); + + eina_list_free(e->calc_list); + e->magic = 0; free(e); } @@ -458,50 +464,7 @@ evas_render_method_lookup(const char *name) EAPI Eina_List * evas_render_method_list(void) { - Eina_List *methods = NULL; - - /* FIXME: get from modules - this is currently coded-in */ -#ifdef BUILD_ENGINE_SOFTWARE_GDI - methods = eina_list_append(methods, "software_gdi"); -#endif -#ifdef BUILD_ENGINE_SOFTWARE_DDRAW - methods = eina_list_append(methods, "software_ddraw"); -#endif -#ifdef BUILD_ENGINE_SOFTWARE_16_DDRAW - methods = eina_list_append(methods, "software_16_ddraw"); -#endif -#ifdef BUILD_ENGINE_DIRECT3D - methods = eina_list_append(methods, "direct3d"); -#endif -#ifdef BUILD_ENGINE_SOFTWARE_16_WINCE - methods = eina_list_append(methods, "software_16_wince"); -#endif -#ifdef BUILD_ENGINE_SOFTWARE_X11 - methods = eina_list_append(methods, "software_x11"); -#endif -#ifdef BUILD_ENGINE_SOFTWARE_16_X11 - methods = eina_list_append(methods, "software_16_x11"); -#endif -#ifdef BUILD_ENGINE_GL_X11 - methods = eina_list_append(methods, "gl_x11"); -#endif -#ifdef BUILD_ENGINE_DIRECTFB - methods = eina_list_append(methods, "directfb"); -#endif -#ifdef BUILD_ENGINE_FB - methods = eina_list_append(methods, "fb"); -#endif -#ifdef BUILD_ENGINE_BUFFER - methods = eina_list_append(methods, "buffer"); -#endif -#ifdef BUILD_ENGINE_SOFTWARE_WIN32_GDI - methods = eina_list_append(methods, "software_win32_gdi"); -#endif -#ifdef BUILD_ENGINE_SOFTWARE_SDL - methods = eina_list_append(methods, "software_sdl"); -#endif - - return methods; + return evas_module_engine_list(); } EAPI void diff --git a/src/lib/canvas/evas_map.c b/src/lib/canvas/evas_map.c index ca34418..2ecf9c1 100644 --- a/src/lib/canvas/evas_map.c +++ b/src/lib/canvas/evas_map.c @@ -40,8 +40,10 @@ _evas_map_calc_map_geometry(Evas_Object *obj) Eina_Bool ch = EINA_FALSE; if (!obj->cur.map) return; - /* WARN: Do not merge below code to SLP until it is fixed. - It has an infinite loop bug. + + // WARN: Do not merge below code to SLP until it is fixed. + // It has an infinite loop bug. +#if 0 if (obj->prev.map) { // FIXME: this causes an infinite loop somewhere... hard to debug @@ -77,7 +79,7 @@ _evas_map_calc_map_geometry(Evas_Object *obj) } else ch = 1; - WARN: DO NOT REMOVE THIS COMMENT. LEAVE IT AS IS UNTIL FIXED. */ +#endif p = obj->cur.map->points; p_end = p + obj->cur.map->count; diff --git a/src/lib/canvas/evas_name.c b/src/lib/canvas/evas_name.c index ad3b71f..c42f941 100644 --- a/src/lib/canvas/evas_name.c +++ b/src/lib/canvas/evas_name.c @@ -9,14 +9,14 @@ evas_object_name_set(Evas_Object *obj, const char *name) MAGIC_CHECK_END(); if (obj->name) { - eina_hash_del(obj->layer->evas->name_hash, obj->name, obj); - free(obj->name); + eina_hash_del(obj->layer->evas->name_hash, obj->name, obj); + free(obj->name); } if (!name) obj->name = NULL; else { - obj->name = strdup(name); - eina_hash_add(obj->layer->evas->name_hash, obj->name, obj); + obj->name = strdup(name); + eina_hash_add(obj->layer->evas->name_hash, obj->name, obj); } } diff --git a/src/lib/canvas/evas_object_grid.c b/src/lib/canvas/evas_object_grid.c index 9b4a3c5..ac96f04 100644 --- a/src/lib/canvas/evas_object_grid.c +++ b/src/lib/canvas/evas_object_grid.c @@ -266,17 +266,11 @@ evas_object_grid_size_set(Evas_Object *o, int w, int h) EAPI void evas_object_grid_size_get(const Evas_Object *o, int *w, int *h) { + if (w) *w = 0; + if (h) *h = 0; EVAS_OBJECT_GRID_DATA_GET_OR_RETURN(o, priv); - if (priv) - { - if (w) *w = priv->size.w; - if (h) *h = priv->size.h; - } - else - { - if (w) *w = 0; - if (h) *h = 0; - } + if (w) *w = priv->size.w; + if (h) *h = priv->size.h; } EAPI Eina_Bool @@ -375,6 +369,10 @@ evas_object_grid_pack_get(Evas_Object *o, Evas_Object *child, int *x, int *y, in { Evas_Object_Grid_Option *opt; + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; EVAS_OBJECT_GRID_DATA_GET_OR_RETURN_VAL(o, priv, 0); opt = _evas_object_grid_option_get(child); if (!opt) return 0; diff --git a/src/lib/canvas/evas_object_image.c b/src/lib/canvas/evas_object_image.c index 5afd994..e976a3f 100644 --- a/src/lib/canvas/evas_object_image.c +++ b/src/lib/canvas/evas_object_image.c @@ -38,7 +38,7 @@ struct _Evas_Object_Image const char *file; const char *key; int frame; - int cspace; + Evas_Colorspace cspace; unsigned char smooth_scale : 1; unsigned char has_alpha :1; @@ -64,7 +64,9 @@ struct _Evas_Object_Image Evas_Object_Image_Pixels_Get_Cb get_pixels; void *get_pixels_data; } func; - + + Evas_Video_Surface video; + const char *tmpf; int tmpf_fd; @@ -78,6 +80,10 @@ struct _Evas_Object_Image unsigned char filled : 1; unsigned char proxyrendering : 1; unsigned char preloading : 1; + unsigned char video_rendering : 1; + unsigned char video_surface : 1; + unsigned char video_visible : 1; + unsigned char created : 1; }; /* private methods for image objects */ @@ -141,6 +147,20 @@ static const Evas_Object_Func object_func = EVAS_MEMPOOL(_mp_obj); +static void +_evas_object_image_cleanup(Evas_Object *obj, Evas_Object_Image *o) +{ + if ((o->preloading) && (o->engine_data)) + { + o->preloading = 0; + obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output, + o->engine_data, + obj); + } + if (o->tmpf) _cleanup_tmpf(obj); + if (o->cur.source) _proxy_unset(obj); +} + EAPI Evas_Object * evas_object_image_add(Evas *e) { @@ -398,16 +418,11 @@ evas_object_image_source_set(Evas_Object *obj, Evas_Object *src) if (src == obj) return EINA_FALSE; if (o->cur.source == src) return EINA_TRUE; - if (o->tmpf) _cleanup_tmpf(obj); + _evas_object_image_cleanup(obj, o); /* Kill the image if any */ if (o->cur.file || o->cur.key) evas_object_image_file_set(obj, NULL, NULL); - if (o->cur.source) - { - _proxy_unset(obj); - } - if (src) { _proxy_set(obj, src); @@ -708,20 +723,13 @@ evas_object_image_size_set(Evas_Object *obj, int w, int h) MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); return; MAGIC_CHECK_END(); - if ((o->preloading) && (o->engine_data)) - { - o->preloading = 0; - obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output, - o->engine_data, - obj); - } + _evas_object_image_cleanup(obj, o); if (w < 1) w = 1; if (h < 1) h = 1; if (w > 32768) return; if (h > 32768) return; if ((w == o->cur.image.w) && (h == o->cur.image.h)) return; - if (o->tmpf) _cleanup_tmpf(obj); o->cur.image.w = w; o->cur.image.h = h; if (o->engine_data) @@ -732,7 +740,7 @@ evas_object_image_size_set(Evas_Object *obj, int w, int h) o->engine_data = obj->layer->evas->engine.func->image_new_from_copied_data (obj->layer->evas->engine.data.output, w, h, NULL, o->cur.has_alpha, o->cur.cspace); - + if (o->engine_data) { if (obj->layer->evas->engine.func->image_scale_hint_set) @@ -836,7 +844,7 @@ evas_object_image_data_convert(Evas_Object *obj, Evas_Colorspace to_cspace) obj); } if (!o->engine_data) return NULL; - if (!o->cur.cspace == to_cspace) return NULL; + if (o->cur.cspace == to_cspace) return NULL; data = NULL; o->engine_data = obj->layer->evas->engine.func->image_data_get(obj->layer->evas->engine.data.output, o->engine_data, @@ -859,19 +867,12 @@ evas_object_image_data_set(Evas_Object *obj, void *data) MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); return; MAGIC_CHECK_END(); - if ((o->preloading) && (o->engine_data)) - { - o->preloading = 0; - obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output, - o->engine_data, - obj); - } + _evas_object_image_cleanup(obj, o); #ifdef EVAS_FRAME_QUEUING if (o->engine_data) evas_common_pipe_op_image_flush(o->engine_data); #endif p_data = o->engine_data; - if (o->tmpf) _cleanup_tmpf(obj); if (data) { if (o->engine_data) @@ -965,6 +966,10 @@ evas_object_image_data_get(const Evas_Object *obj, Eina_Bool for_writing) for_writing, &data, &o->load_error); + + /* if we fail to get engine_data, we have to return NULL */ + if (!o->engine_data) return NULL; + if (o->engine_data) { int stride = 0; @@ -1041,16 +1046,9 @@ evas_object_image_data_copy_set(Evas_Object *obj, void *data) MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); return; MAGIC_CHECK_END(); - if ((o->preloading) && (o->engine_data)) - { - o->preloading = 0; - obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output, - o->engine_data, - obj); - } + _evas_object_image_cleanup(obj, o); if ((o->cur.image.w <= 0) || (o->cur.image.h <= 0)) return; - if (o->tmpf) _cleanup_tmpf(obj); if (o->engine_data) obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output, o->engine_data); @@ -1323,16 +1321,8 @@ evas_object_image_pixels_import(Evas_Object *obj, Evas_Pixel_Import_Source *pixe MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); return 0; MAGIC_CHECK_END(); - - if ((o->preloading) && (o->engine_data)) - { - o->preloading = 0; - obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output, - o->engine_data, - obj); - } + _evas_object_image_cleanup(obj, o); if ((pixels->w != o->cur.image.w) || (pixels->h != o->cur.image.h)) return 0; - if (o->tmpf) _cleanup_tmpf(obj); switch (pixels->format) { #if 0 @@ -1665,14 +1655,7 @@ evas_object_image_colorspace_set(Evas_Object *obj, Evas_Colorspace cspace) return; MAGIC_CHECK_END(); - if ((o->preloading) && (o->engine_data)) - { - o->preloading = 0; - obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output, - o->engine_data, - obj); - } - if (o->tmpf) _cleanup_tmpf(obj); + _evas_object_image_cleanup(obj, o); #ifdef EVAS_FRAME_QUEUING if ((Evas_Colorspace)o->cur.cspace != cspace) { @@ -1704,7 +1687,7 @@ evas_object_image_colorspace_get(const Evas_Object *obj) } EAPI void -evas_object_image_native_surface_set(Evas_Object *obj, Evas_Native_Surface *surf) +evas_object_image_video_surface_set(Evas_Object *obj, Evas_Video_Surface *surf) { Evas_Object_Image *o; @@ -1715,15 +1698,73 @@ evas_object_image_native_surface_set(Evas_Object *obj, Evas_Native_Surface *surf MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); return; MAGIC_CHECK_END(); - if ((o->preloading) && (o->engine_data)) + _evas_object_image_cleanup(obj, o); + if (o->video_surface) { - o->preloading = 0; - obj->layer->evas->engine.func->image_data_preload_cancel(obj->layer->evas->engine.data.output, - o->engine_data, - obj); + o->video_surface = 0; + obj->layer->evas->video_objects = eina_list_remove(obj->layer->evas->video_objects, obj); } - if (o->tmpf) _cleanup_tmpf(obj); - if (o->cur.source) _proxy_unset(obj); + + if (surf) + { + fprintf(stderr, "video surface ?\n"); + if (surf->version != EVAS_VIDEO_SURFACE_VERSION) return ; + + if (!surf->update_pixels || + !surf->move || + !surf->resize || + !surf->hide || + !surf->show) + return ; + + o->created = EINA_TRUE; + o->video_surface = 1; + o->video = *surf; + + fprintf(stderr, "yes\n"); + obj->layer->evas->video_objects = eina_list_append(obj->layer->evas->video_objects, obj); + } + else + { + o->video_surface = 0; + o->video.update_pixels = NULL; + o->video.move = NULL; + o->video.resize = NULL; + o->video.hide = NULL; + o->video.show = NULL; + o->video.data = NULL; + } +} + +EAPI const Evas_Video_Surface * +evas_object_image_video_surface_get(const Evas_Object *obj) +{ + Evas_Object_Image *o; + + MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); + return NULL; + MAGIC_CHECK_END(); + o = (Evas_Object_Image *)(obj->object_data); + MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); + return NULL; + MAGIC_CHECK_END(); + if (!o->video_surface) return NULL; + return &o->video; +} + +EAPI void +evas_object_image_native_surface_set(Evas_Object *obj, Evas_Native_Surface *surf) +{ + Evas_Object_Image *o; + + MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); + return; + MAGIC_CHECK_END(); + o = (Evas_Object_Image *)(obj->object_data); + MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE); + return; + MAGIC_CHECK_END(); + _evas_object_image_cleanup(obj, o); if (!obj->layer->evas->engine.func->image_native_set) return; if ((surf) && ((surf->version < 2) || @@ -2643,6 +2684,11 @@ evas_object_image_free(Evas_Object *obj) obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output, o->engine_data); } + if (o->video_surface) + { + o->video_surface = 0; + obj->layer->evas->video_objects = eina_list_remove(obj->layer->evas->video_objects, obj); + } o->engine_data = NULL; o->magic = 0; EINA_LIST_FREE(o->pixel_updates, r) @@ -2670,6 +2716,29 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su return; } + /* We are displaying the overlay */ + if (o->video_visible) + { + fprintf(stderr, "overlay visible, make a hole\n"); + + /* Create a transparent rectangle */ + obj->layer->evas->engine.func->context_color_set(output, + context, + 0, 0, 0, 0); + obj->layer->evas->engine.func->context_multiplier_unset(output, + context); + obj->layer->evas->engine.func->context_render_op_set(output, context, + EVAS_RENDER_COPY); + obj->layer->evas->engine.func->rectangle_draw(output, + context, + surface, + obj->cur.geometry.x + x, + obj->cur.geometry.y + y, + obj->cur.geometry.w, + obj->cur.geometry.h); + + return ; + } obj->layer->evas->engine.func->context_color_set(output, context, @@ -2794,6 +2863,8 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su if (o->func.get_pixels) { o->func.get_pixels(o->func.get_pixels_data, obj); + if (o->engine_data != pixels) + pixels = o->engine_data; o->engine_data = obj->layer->evas->engine.func->image_dirty_region (obj->layer->evas->engine.data.output, o->engine_data, 0, 0, o->cur.image.w, o->cur.image.h); @@ -3626,7 +3697,33 @@ evas_object_image_data_convert_internal(Evas_Object_Image *o, void *data, Evas_C o->cur.has_alpha, to_cspace); break; + case EVAS_COLORSPACE_YCBCR422601_PL: + fprintf(stderr, "EVAS_COLORSPACE_YCBCR422601_PL:\n"); + out = evas_common_convert_yuv_422_601_to(data, + o->cur.image.w, + o->cur.image.h, + to_cspace); + break; + case EVAS_COLORSPACE_YCBCR422P601_PL: + out = evas_common_convert_yuv_422P_601_to(data, + o->cur.image.w, + o->cur.image.h, + to_cspace); + break; + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + out = evas_common_convert_yuv_420_601_to(data, + o->cur.image.w, + o->cur.image.h, + to_cspace); + break; + case EVAS_COLORSPACE_YCBCR420TM12601_PL: + out = evas_common_convert_yuv_420T_601_to(data, + o->cur.image.w, + o->cur.image.h, + to_cspace); + break; default: + fprintf(stderr, "unknow colorspace: %i\n", o->cur.cspace); break; } @@ -3672,4 +3769,44 @@ _evas_object_image_preloading_check(Evas_Object *obj) (obj->layer->evas->engine.data.output, o->engine_data); } +Evas_Object * +_evas_object_image_video_parent_get(Evas_Object *obj) +{ + Evas_Object_Image *o = (Evas_Object_Image *)(obj->object_data); + + return o->video_surface ? o->video.parent : NULL; +} + +void +_evas_object_image_video_overlay_show(Evas_Object *obj) +{ + Evas_Object_Image *o = (Evas_Object_Image *)(obj->object_data); + + if (obj->cur.cache.clip.x != obj->prev.cache.clip.x || + obj->cur.cache.clip.y != obj->prev.cache.clip.y || + o->created || !o->video_visible) + o->video.move(o->video.data, obj, &o->video, obj->cur.cache.clip.x, obj->cur.cache.clip.y); + if (obj->cur.cache.clip.w != obj->prev.cache.clip.w || + obj->cur.cache.clip.h != obj->prev.cache.clip.h || + o->created || !o->video_visible) + o->video.resize(o->video.data, obj, &o->video, obj->cur.cache.clip.w, obj->cur.cache.clip.h); + if (!o->video_visible || o->created) + o->video.show(o->video.data, obj, &o->video); + o->video_visible = EINA_TRUE; + o->created = EINA_FALSE; +} + +void +_evas_object_image_video_overlay_hide(Evas_Object *obj) +{ + Evas_Object_Image *o = (Evas_Object_Image *)(obj->object_data); + + if (o->video_visible || o->created) + o->video.hide(o->video.data, obj, &o->video); + if (evas_object_is_visible(obj)) + o->video.update_pixels(o->video.data, obj, &o->video); + o->video_visible = EINA_FALSE; + o->created = EINA_FALSE; +} + /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ diff --git a/src/lib/canvas/evas_object_main.c b/src/lib/canvas/evas_object_main.c index 5a75249..a9d27f1 100644 --- a/src/lib/canvas/evas_object_main.c +++ b/src/lib/canvas/evas_object_main.c @@ -37,6 +37,7 @@ evas_object_free(Evas_Object *obj, int clean_layer) #if 0 // filtering disabled evas_filter_free(obj); #endif + if (!strcmp(obj->type, "image")) evas_object_image_video_surface_set(obj, NULL); evas_object_map_set(obj, NULL); evas_object_grabs_cleanup(obj); evas_object_intercept_cleanup(obj); @@ -909,61 +910,61 @@ evas_object_hide(Evas_Object *obj) if (evas_object_is_in_output_rect(obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, 1, 1)) - evas_event_feed_mouse_move(obj->layer->evas, - obj->layer->evas->pointer.x, - obj->layer->evas->pointer.y, - obj->layer->evas->last_timestamp, - NULL); + evas_event_feed_mouse_move(obj->layer->evas, + obj->layer->evas->pointer.x, + obj->layer->evas->pointer.y, + obj->layer->evas->last_timestamp, + NULL); + } +/* this is at odds to handling events when an obj is moved out of the mouse + * ore resized out or clipped out. if mouse is grabbed - regardless of + * visibility, mouse move events should keep happening and mouse up. + * for better or worse it's at least consistent. + if (obj->delete_me) return; + if (obj->mouse_grabbed > 0) + obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; + if ((obj->mouse_in) || (obj->mouse_grabbed > 0)) + obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj); + obj->mouse_grabbed = 0; + if (obj->layer->evas->events_frozen > 0) + { + obj->mouse_in = 0; + return; } - /* this is at odds to handling events when an obj is moved out of the mouse - * ore resized out or clipped out. if mouse is grabbed - regardless of - * visibility, mouse move events should keep happening and mouse up. - * for better or worse it's at least consistent. - if (obj->delete_me) return; - if (obj->mouse_grabbed > 0) - obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; - if ((obj->mouse_in) || (obj->mouse_grabbed > 0)) - obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj); - obj->mouse_grabbed = 0; - if (obj->layer->evas->events_frozen > 0) - { - obj->mouse_in = 0; - return; - } - if (obj->mouse_in) - { - Evas_Event_Mouse_Out ev; - - _evas_object_event_new(); - - obj->mouse_in = 0; - ev.buttons = obj->layer->evas->pointer.button; - ev.output.x = obj->layer->evas->pointer.x; - ev.output.y = obj->layer->evas->pointer.y; - ev.canvas.x = obj->layer->evas->pointer.x; - ev.canvas.y = obj->layer->evas->pointer.y; - ev.data = NULL; - ev.modifiers = &(obj->layer->evas->modifiers); - ev.locks = &(obj->layer->evas->locks); - ev.timestamp = obj->layer->evas->last_timestamp; - ev.event_flags = EVAS_EVENT_FLAG_NONE; - evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev); - _evas_post_event_callback_call(obj->layer->evas); - } - */ + if (obj->mouse_in) + { + Evas_Event_Mouse_Out ev; + + _evas_object_event_new(); + + obj->mouse_in = 0; + ev.buttons = obj->layer->evas->pointer.button; + ev.output.x = obj->layer->evas->pointer.x; + ev.output.y = obj->layer->evas->pointer.y; + ev.canvas.x = obj->layer->evas->pointer.x; + ev.canvas.y = obj->layer->evas->pointer.y; + ev.data = NULL; + ev.modifiers = &(obj->layer->evas->modifiers); + ev.locks = &(obj->layer->evas->locks); + ev.timestamp = obj->layer->evas->last_timestamp; + ev.event_flags = EVAS_EVENT_FLAG_NONE; + evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev); + _evas_post_event_callback_call(obj->layer->evas); + } + */ } } } else { - /* - if (obj->mouse_grabbed > 0) - obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; - if ((obj->mouse_in) || (obj->mouse_grabbed > 0)) - obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj); - obj->mouse_grabbed = 0; - obj->mouse_in = 0; - */ +/* + if (obj->mouse_grabbed > 0) + obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; + if ((obj->mouse_in) || (obj->mouse_grabbed > 0)) + obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj); + obj->mouse_grabbed = 0; + obj->mouse_in = 0; + */ } evas_object_inform_call_hide(obj); } diff --git a/src/lib/canvas/evas_object_smart.c b/src/lib/canvas/evas_object_smart.c index 4a305f0..f516aa7 100644 --- a/src/lib/canvas/evas_object_smart.c +++ b/src/lib/canvas/evas_object_smart.c @@ -10,7 +10,8 @@ struct _Evas_Object_Smart void *engine_data; void *data; Eina_List *callbacks; - Eina_Inlist *contained; + Eina_Inlist *contained; + Eina_List *calc_node; Evas_Smart_Cb_Description_Array callbacks_descriptions; int walking_list; Eina_Bool deletions_waiting : 1; @@ -548,32 +549,49 @@ evas_object_smart_need_recalculate_set(Evas_Object *obj, Eina_Bool value) return; MAGIC_CHECK_END(); + // XXX: do i need this? + if (obj->delete_me) return; + value = !!value; - if (o->need_recalculate == value) - return; + if (value) + { + Evas *e = obj->layer->evas; + + if (o->need_recalculate) + { + if ((o->calc_node) && (e->calc_list_current != o->calc_node)) + e->calc_list = eina_list_demote_list(e->calc_list, + o->calc_node); + else + e->calc_list = eina_list_append(e->calc_list, obj); + } + else + e->calc_list = eina_list_append(e->calc_list, obj); + o->calc_node = eina_list_last(e->calc_list); + } + else + { + Evas *e = obj->layer->evas; + + if (o->need_recalculate) + { + if ((o->calc_node) && (e->calc_list_current != o->calc_node)) + e->calc_list = eina_list_remove_list(e->calc_list, + o->calc_node); + o->calc_node = NULL; + + } + } + + if (o->need_recalculate == value) return; - if (obj->recalculate_cycle > 64) + if (obj->recalculate_cycle > 256) { ERR("Object %p is not stable during recalc loop", obj); - return ; + return; } - if (obj->layer->evas->in_smart_calc) - obj->recalculate_cycle++; + if (obj->layer->evas->in_smart_calc) obj->recalculate_cycle++; o->need_recalculate = value; - - if (!obj->smart.smart->smart_class->calculate) return; - - /* XXX: objects can be present multiple times in calculate_objects() - * XXX: after a set-unset-set cycle, but it's not a problem since - * XXX: on _evas_render_call_smart_calculate() will check for the flag - * XXX: and it will be unset after the first. - */ - if (o->need_recalculate) - { - Evas *e = obj->layer->evas; - eina_array_push(&e->calculate_objects, obj); - } - /* TODO: else, remove from array */ } EAPI Eina_Bool @@ -619,6 +637,15 @@ evas_smart_objects_calculate(Evas *e) evas_call_smarts_calculate(e); } +EAPI int +evas_smart_objects_calculate_count_get(const Evas *e) +{ + MAGIC_CHECK(e, Evas, MAGIC_EVAS); + return 0; + MAGIC_CHECK_END(); + return e->smart_calc_count; +} + /** * Call calculate() on all smart objects that need_recalculate. * @@ -627,34 +654,37 @@ evas_smart_objects_calculate(Evas *e) void evas_call_smarts_calculate(Evas *e) { - Eina_Array *calculate; Evas_Object *obj; - Eina_Array_Iterator it; - unsigned int i; + Eina_List *l; +// printf("+CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALC-----------v\n"); + evas_event_freeze(e); e->in_smart_calc++; - calculate = &e->calculate_objects; - for (i = 0; i < eina_array_count_get(calculate); ++i) + + EINA_LIST_FOREACH(e->calc_list, l, obj) { - Evas_Object_Smart *o; - - obj = eina_array_data_get(calculate, i); - if (obj->delete_me) - continue; - - o = obj->object_data; + Evas_Object_Smart *o = obj->object_data; + + if (obj->delete_me) continue; + e->calc_list_current = l; if (o->need_recalculate) { o->need_recalculate = 0; obj->smart.smart->smart_class->calculate(obj); } + if (o->calc_node == l) o->calc_node = NULL; + e->calc_list_current = NULL; } - EINA_ARRAY_ITER_NEXT(calculate, i, obj, it) + EINA_LIST_FREE(e->calc_list, obj) { obj->recalculate_cycle = 0; } + e->calc_list_current = NULL; e->in_smart_calc--; - if (e->in_smart_calc == 0) eina_array_clean(calculate); + if (e->in_smart_calc == 0) e->smart_calc_count++; + evas_event_thaw(e); + evas_event_thaw_eval(e); +// printf("-CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALC-----------^\n"); } EAPI void @@ -715,13 +745,19 @@ evas_object_smart_cleanup(Evas_Object *obj) o = (Evas_Object_Smart *)(obj->object_data); if (o->magic == MAGIC_OBJ_SMART) { + Evas *e = obj->layer->evas; + + if ((o->calc_node) && (e->calc_list_current != o->calc_node)) + e->calc_list = eina_list_remove_list(e->calc_list, + o->calc_node); + o->calc_node = NULL; while (o->contained) - evas_object_smart_member_del((Evas_Object *)o->contained); + evas_object_smart_member_del((Evas_Object *)o->contained); while (o->callbacks) { Evas_Smart_Callback *cb; - + cb = o->callbacks->data; o->callbacks = eina_list_remove(o->callbacks, cb); if (cb->event) eina_stringshare_del(cb->event); @@ -749,16 +785,10 @@ evas_object_smart_member_cache_invalidate(Evas_Object *obj) obj->parent_cache_valid = 0; o = (Evas_Object_Smart *)(obj->object_data); - if (o->magic != MAGIC_OBJ_SMART) - return; + if (o->magic != MAGIC_OBJ_SMART) return; for (l = o->contained; l; l = l->next) - { - Evas_Object *obj2; - - obj2 = (Evas_Object *)l; - evas_object_smart_member_cache_invalidate(obj2); - } + evas_object_smart_member_cache_invalidate((Evas_Object *) l); } void diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index c1d08a9..060e77d 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -218,7 +218,7 @@ struct _Evas_Object_Textblock_Node_Text Evas_Object_Textblock_Node_Format *format_node; Evas_Object_Textblock_Paragraph *par; Eina_Bool dirty : 1; - Eina_Bool new : 1; + Eina_Bool is_new : 1; }; struct _Evas_Object_Textblock_Node_Format @@ -231,7 +231,7 @@ struct _Evas_Object_Textblock_Node_Format unsigned char anchor : 2; Eina_Bool visible : 1; Eina_Bool format_change : 1; - Eina_Bool new : 1; + Eina_Bool is_new : 1; }; #define ANCHOR_NONE 0 @@ -1167,7 +1167,7 @@ _format_command(Evas_Object *obj, Evas_Object_Textblock_Format *fmt, const char { fmt->font.fdesc = evas_font_desc_new(); } - else if (!fmt->font.fdesc->new) + else if (!fmt->font.fdesc->is_new) { Evas_Font_Description *old = fmt->font.fdesc; fmt->font.fdesc = evas_font_desc_dup(fmt->font.fdesc); @@ -3529,11 +3529,12 @@ _layout_par(Ctxt *c) /* Check if we need to skip this paragraph because it's already layouted * correctly, and mark handled nodes as dirty. */ c->par->line_no = c->line_no; + if (c->par->text_node) { /* Skip this paragraph if width is the same, there is no ellipsis * and we aren't just calculating. */ - if (!c->par->text_node->new && !c->par->text_node->dirty && + if (!c->par->text_node->is_new && !c->par->text_node->dirty && !c->width_changed && c->par->lines && !c->o->have_ellipsis) { @@ -3546,7 +3547,7 @@ _layout_par(Ctxt *c) return 0; } c->par->text_node->dirty = EINA_FALSE; - c->par->text_node->new = EINA_FALSE; + c->par->text_node->is_new = EINA_FALSE; c->par->rendered = EINA_FALSE; /* Merge back and clear the paragraph */ @@ -3822,7 +3823,7 @@ _format_changes_invalidate_text_nodes(Ctxt *c) int balance = 0; while (fnode) { - if (fnode->new) + if (fnode->is_new) { const char *fstr = fnode->orig_format; /* balance < 0 means we gave up and everything should be @@ -3932,7 +3933,7 @@ _layout_pre(Ctxt *c, int *style_pad_l, int *style_pad_r, int *style_pad_t, /* If it's not a new paragraph, either update it or skip it. * Remove all the paragraphs that were deleted */ - if (!n->new) + if (!n->is_new) { /* Remove all the deleted paragraphs at this point */ while (c->par->text_node != n) @@ -4025,7 +4026,7 @@ _layout_pre(Ctxt *c, int *style_pad_l, int *style_pad_r, int *style_pad_t, { off = 0; } - fnode->new = EINA_FALSE; + fnode->is_new = EINA_FALSE; fnode = _NODE_FORMAT(EINA_INLIST_GET(fnode)->next); } _layout_text_append(c, c->fmt, n, start, -1, o->repch); @@ -5126,7 +5127,7 @@ _evas_textblock_nodes_merge(Evas_Object_Textblock *o, Evas_Object_Textblock_Node to->par->text_node = NULL; to->par = NULL; - to->new = EINA_TRUE; + to->is_new = EINA_TRUE; _evas_textblock_cursors_set_node(o, from, to); _evas_textblock_node_text_remove(o, from); @@ -6519,7 +6520,7 @@ _evas_textblock_node_text_new(void) n->unicode = eina_ustrbuf_new(); /* We want to layout each paragraph at least once. */ n->dirty = EINA_TRUE; - n->new = EINA_TRUE; + n->is_new = EINA_TRUE; return n; } @@ -6916,7 +6917,7 @@ _evas_textblock_node_format_new(Evas_Object_Textblock *o, const char *_format) { o->anchors_item = eina_list_append(o->anchors_item, n); } - n->new = EINA_TRUE; + n->is_new = EINA_TRUE; return n; } @@ -7052,7 +7053,7 @@ evas_textblock_cursor_format_append(Evas_Textblock_Cursor *cur, const char *form { /* Handle visible format nodes here */ cur->node->dirty = EINA_TRUE; - n->new = EINA_FALSE; + n->is_new = EINA_FALSE; } } else @@ -7960,12 +7961,13 @@ evas_textblock_cursor_line_geometry_get(const Evas_Textblock_Cursor *cur, Evas_C EAPI Eina_Bool evas_textblock_cursor_visible_range_get(Evas_Textblock_Cursor *start, Evas_Textblock_Cursor *end) { + Evas *e; Evas_Coord cy, ch; Evas_Object *obj = start->obj; TB_HEAD_RETURN(EINA_FALSE); - /* Clip is relative to the object */ - cy = obj->cur.cache.clip.y - obj->cur.geometry.y; - ch = obj->cur.cache.clip.h; + e = evas_object_evas_get(obj); + cy = 0 - obj->cur.geometry.y; + ch = e->viewport.h; evas_textblock_cursor_line_coord_set(start, cy); evas_textblock_cursor_line_coord_set(end, cy + ch); evas_textblock_cursor_line_char_last(end); @@ -8270,14 +8272,17 @@ _evas_textblock_cursor_range_in_line_geometry_get( Evas_Coord x1, w1, x2, w2; Evas_Coord x, w, y, h; Evas_Object_Textblock_Text_Item *ti; - int ret; + int ret = 0; ti = _ITEM_TEXT(it1); - ret = cur->ENFN->font_pen_coords_get(cur->ENDT, - ti->parent.format->font.font, - &ti->text_props, - start, - &x1, &y, &w1, &h); + if (ti->parent.format->font.font) + { + ret = cur->ENFN->font_pen_coords_get(cur->ENDT, + ti->parent.format->font.font, + &ti->text_props, + start, + &x1, &y, &w1, &h); + } if (!ret) { return NULL; @@ -8742,6 +8747,17 @@ evas_object_textblock_style_insets_get(const Evas_Object *obj, Evas_Coord *l, Ev if (b) *b = o->style_pad.b; } +/** @internal + * FIXME: DELETE ME! DELETE ME! + * This is an ugly workaround to get around the fact that + * evas_object_textblock_coords_recalc isn't really called when it's supposed + * to. When that bug is fixed please remove this. */ +static void +_workaround_object_coords_recalc(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + evas_object_textblock_coords_recalc(obj); +} + /* all nice and private */ static void evas_object_textblock_init(Evas_Object *obj) @@ -8777,6 +8793,8 @@ evas_object_textblock_init(Evas_Object *obj) o = (Evas_Object_Textblock *)(obj->object_data); o->cursor->obj = obj; o->legacy_newline = EINA_TRUE; + evas_object_event_callback_priority_add(obj, EVAS_CALLBACK_RESIZE, -1000, + _workaround_object_coords_recalc, NULL); } static void * diff --git a/src/lib/canvas/evas_render.c b/src/lib/canvas/evas_render.c index 41ea0f5..12f5f2c 100644 --- a/src/lib/canvas/evas_render.c +++ b/src/lib/canvas/evas_render.c @@ -646,6 +646,199 @@ pending_change(void *data, void *gdata __UNUSED__) } } */ +static Eina_Bool +_evas_render_can_use_overlay(Evas *e, Evas_Object *obj) +{ + Eina_Rectangle *r; + Evas_Object *tmp; + Eina_List *alphas = NULL; + Eina_List *opaques = NULL; + Evas_Object *video_parent = NULL; + Eina_Rectangle zone; + Evas_Coord xc1, yc1, xc2, yc2; + unsigned int i; + Eina_Bool nooverlay; + + video_parent = _evas_object_image_video_parent_get(obj); + + /* Check if any one is the stack make this object mapped */ + tmp = obj; + while (tmp && !_evas_render_has_map(tmp)) + tmp = tmp->smart.parent; + + if (tmp && _evas_render_has_map(tmp)) return EINA_FALSE; /* we are mapped, we can't be an overlay */ + + if (!evas_object_is_visible(obj)) return EINA_FALSE; /* no need to update the overlay if it's not visible */ + + /* If any recoloring of the surface is needed, n overlay to */ + if ((obj->cur.cache.clip.r != 255) || + (obj->cur.cache.clip.g != 255) || + (obj->cur.cache.clip.b != 255) || + (obj->cur.cache.clip.a != 255)) + return EINA_FALSE; + + /* Check presence of transparent object on top of the video object */ + EINA_RECTANGLE_SET(&zone, + obj->cur.cache.clip.x, + obj->cur.cache.clip.y, + obj->cur.cache.clip.w, + obj->cur.cache.clip.h); + + for (i = e->active_objects.count - 1; i > 0; i--) + { + Eina_Rectangle self; + Eina_Rectangle *match; + Evas_Object *current; + Eina_List *l; + int xm1, ym1, xm2, ym2; + + current = eina_array_data_get(&e->active_objects, i); + + /* Did we find the video object in the stack ? */ + if (current == video_parent || current == obj) + break; + + EINA_RECTANGLE_SET(&self, + current->cur.cache.clip.x, + current->cur.cache.clip.y, + current->cur.cache.clip.w, + current->cur.cache.clip.h); + + /* This doesn't cover the area of the video object, so don't bother with that object */ + if (!eina_rectangles_intersect(&zone, &self)) + continue ; + + xc1 = current->cur.cache.clip.x; + yc1 = current->cur.cache.clip.y; + xc2 = current->cur.cache.clip.x + current->cur.cache.clip.w; + yc2 = current->cur.cache.clip.y + current->cur.cache.clip.h; + + if (evas_object_is_visible(current) && + (!current->clip.clipees) && + (current->cur.visible) && + (!current->delete_me) && + (current->cur.cache.clip.visible) && + (!current->smart.smart)) + { + Eina_Bool included = EINA_FALSE; + + if (evas_object_is_opaque(current) || + ((current->func->has_opaque_rect) && + (current->func->has_opaque_rect(current)))) + { + /* The object is opaque */ + + /* Check if the opaque object is inside another opaque object */ + EINA_LIST_FOREACH(opaques, l, match) + { + xm1 = match->x; + ym1 = match->y; + xm2 = match->x + match->w; + ym2 = match->y + match->h; + + /* Both object are included */ + if (xc1 >= xm1 && yc1 >= ym1 && xc2 <= xm2 && yc2 <= ym2) + { + included = EINA_TRUE; + break; + } + } + + /* Not included yet */ + if (!included) + { + Eina_List *ln; + Evas_Coord xn2, yn2; + + r = eina_rectangle_new(current->cur.cache.clip.x, current->cur.cache.clip.y, + current->cur.cache.clip.w, current->cur.cache.clip.h); + + opaques = eina_list_append(opaques, r); + + xn2 = r->x + r->w; + yn2 = r->y + r->h; + + /* Remove all the transparent object that are covered by the new opaque object */ + EINA_LIST_FOREACH_SAFE(alphas, l, ln, match) + { + xm1 = match->x; + ym1 = match->y; + xm2 = match->x + match->w; + ym2 = match->y + match->h; + + if (xm1 >= r->x && ym1 >= r->y && xm2 <= xn2 && ym2 <= yn2) + { + /* The new rectangle is over some transparent object, + so remove the transparent object */ + alphas = eina_list_remove_list(alphas, l); + } + } + } + } + else + { + /* The object has some transparency */ + + /* Check if the transparent object is inside any other transparent object */ + EINA_LIST_FOREACH(alphas, l, match) + { + xm1 = match->x; + ym1 = match->y; + xm2 = match->x + match->w; + ym2 = match->y + match->h; + + /* Both object are included */ + if (xc1 >= xm1 && yc1 >= ym1 && xc2 <= xm2 && yc2 <= ym2) + { + included = EINA_TRUE; + break; + } + } + + /* If not check if it is inside any opaque one */ + if (!included) + { + EINA_LIST_FOREACH(opaques, l, match) + { + xm1 = match->x; + ym1 = match->y; + xm2 = match->x + match->w; + ym2 = match->y + match->h; + + /* Both object are included */ + if (xc1 >= xm1 && yc1 >= ym1 && xc2 <= xm2 && yc2 <= ym2) + { + included = EINA_TRUE; + break; + } + } + } + + /* No inclusion at all, so add it */ + if (!included) + { + r = eina_rectangle_new(current->cur.cache.clip.x, current->cur.cache.clip.y, + current->cur.cache.clip.w, current->cur.cache.clip.h); + + alphas = eina_list_append(alphas, r); + } + } + } + } + + /* If there is any pending transparent object, then no overlay */ + nooverlay = !!eina_list_count(alphas); + + EINA_LIST_FREE(alphas, r) + eina_rectangle_free(r); + EINA_LIST_FREE(opaques, r) + eina_rectangle_free(r); + + if (nooverlay) + return EINA_FALSE; + + return EINA_TRUE; +} Eina_Bool evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface, @@ -1074,6 +1267,7 @@ evas_render_updates_internal(Evas *e, unsigned char make_updates, unsigned char do_draw) { + Evas_Object *obj; Eina_List *updates = NULL; Eina_List *ll; void *surface; @@ -1111,11 +1305,22 @@ evas_render_updates_internal(Evas *e, _evas_render_phase1_direct(e, &e->active_objects, &e->restack_objects, &e->delete_objects, &e->render_objects); + /* phase 1.5. check if the video should be inlined or stay in their overlay */ + alpha = e->engine.func->canvas_alpha_get(e->engine.data.output, + e->engine.data.context); + + EINA_LIST_FOREACH(e->video_objects, ll, obj) + { + /* we need the surface to be transparent to display the underlying overlay */ + if (alpha && _evas_render_can_use_overlay(e, obj)) + _evas_object_image_video_overlay_show(obj); + else + _evas_object_image_video_overlay_hide(obj); + } + /* phase 2. force updates for restacks */ for (i = 0; i < e->restack_objects.count; ++i) { - Evas_Object *obj; - obj = eina_array_data_get(&e->restack_objects, i); obj->func->render_pre(obj); _evas_render_prev_cur_clip_cache_add(e, obj); @@ -1162,8 +1367,6 @@ evas_render_updates_internal(Evas *e, /* build obscure objects list of active objects that obscure */ for (i = 0; i < e->active_objects.count; ++i) { - Evas_Object *obj; - obj = eina_array_data_get(&e->active_objects, i); if (UNLIKELY((evas_object_is_opaque(obj) || ((obj->func->has_opaque_rect) && @@ -1177,6 +1380,7 @@ evas_render_updates_internal(Evas *e, /* obscuring_objects = eina_list_append(obscuring_objects, obj); */ eina_array_push(&e->obscuring_objects, obj); } + /* save this list */ /* obscuring_objects_orig = obscuring_objects; */ /* obscuring_objects = NULL; */ @@ -1185,8 +1389,6 @@ evas_render_updates_internal(Evas *e, { unsigned int offset = 0; - alpha = e->engine.func->canvas_alpha_get(e->engine.data.output, - e->engine.data.context); while ((surface = e->engine.func->output_redraws_next_update_get (e->engine.data.output, @@ -1210,8 +1412,6 @@ evas_render_updates_internal(Evas *e, /* build obscuring objects list (in order from bottom to top) */ for (i = 0; i < e->obscuring_objects.count; ++i) { - Evas_Object *obj; - obj = (Evas_Object *)eina_array_data_get (&e->obscuring_objects, i); if (evas_object_is_in_output_rect(obj, ux, uy, uw, uh)) @@ -1283,8 +1483,6 @@ evas_render_updates_internal(Evas *e, /* render all object that intersect with rect */ for (i = 0; i < e->active_objects.count; ++i) { - Evas_Object *obj; - obj = eina_array_data_get(&e->active_objects, i); /* if it's in our outpout rect and it doesn't clip anything */ @@ -1408,8 +1606,6 @@ evas_render_updates_internal(Evas *e, /* and do a post render pass */ for (i = 0; i < e->active_objects.count; ++i) { - Evas_Object *obj; - obj = eina_array_data_get(&e->active_objects, i); obj->pre_render_done = 0; RD(" OBJ [%p] post... %i %i\n", obj, obj->changed, do_draw); @@ -1451,8 +1647,6 @@ evas_render_updates_internal(Evas *e, for (i = 0; i < e->render_objects.count; ++i) { - Evas_Object *obj; - obj = eina_array_data_get(&e->render_objects, i); obj->pre_render_done = 0; } @@ -1460,8 +1654,6 @@ evas_render_updates_internal(Evas *e, /* delete all objects flagged for deletion now */ for (i = 0; i < e->delete_objects.count; ++i) { - Evas_Object *obj; - obj = eina_array_data_get(&e->delete_objects, i); evas_object_free(obj, 1); } diff --git a/src/lib/engines/common/Makefile.am b/src/lib/engines/common/Makefile.am index 5a059b8..9c9918d 100644 --- a/src/lib/engines/common/Makefile.am +++ b/src/lib/engines/common/Makefile.am @@ -113,3 +113,6 @@ evas_map_image_loop.c libevas_engine_common_la_DEPENDENCIES = \ $(top_builddir)/config.h + +libevas_engine_common_la_LIBADD = \ +evas_op_blend/libevas_engine_common_op_blend_master_sse3.la diff --git a/src/lib/engines/common/evas_convert_colorspace.c b/src/lib/engines/common/evas_convert_colorspace.c index fa5faec..013c2e7 100644 --- a/src/lib/engines/common/evas_convert_colorspace.c +++ b/src/lib/engines/common/evas_convert_colorspace.c @@ -96,5 +96,91 @@ evas_common_convert_rgb565_a5p_to(void *data, int w, int h, int stride, Eina_Boo return NULL; } +EAPI void * +evas_common_convert_yuv_422_601_to(void *data, int w, int h, Evas_Colorspace cspace) +{ + switch (cspace) + { + case EVAS_COLORSPACE_ARGB8888: + { + void *dst; + + fprintf(stderr, "to argb888\n"); + + dst = malloc(sizeof (unsigned int) * w * h); + if (!dst) return NULL; + + evas_common_convert_yuv_422_601_rgba(data, dst, w, h); + return dst; + } + default: + break; + } + return NULL; +} + +EAPI void * +evas_common_convert_yuv_422P_601_to(void *data, int w, int h, Evas_Colorspace cspace) +{ + switch (cspace) + { + case EVAS_COLORSPACE_ARGB8888: + { + void *dst; + + dst = malloc(sizeof (unsigned int) * w * h); + if (!dst) return NULL; + + evas_common_convert_yuv_420p_601_rgba(data, dst, w, h); + break; + } + default: + break; + } + return NULL; +} + +EAPI void * +evas_common_convert_yuv_420_601_to(void *data, int w, int h, Evas_Colorspace cspace) +{ + switch (cspace) + { + case EVAS_COLORSPACE_ARGB8888: + { + void *dst; + + dst = malloc(sizeof (unsigned int) * w * h); + if (!dst) return NULL; + + evas_common_convert_yuv_420_601_rgba(data, dst, w, h); + break; + } + default: + break; + } + return NULL; +} + +EAPI void * +evas_common_convert_yuv_420T_601_to(void *data, int w, int h, Evas_Colorspace cspace) +{ + switch (cspace) + { + case EVAS_COLORSPACE_ARGB8888: + { + void *dst; + + dst = malloc(sizeof (unsigned int) * w * h); + if (!dst) return NULL; + + evas_common_convert_yuv_420_601_rgba(data, dst, w, h); + break; + } + default: + break; + } + return NULL; +} + /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ diff --git a/src/lib/engines/common/evas_convert_colorspace.h b/src/lib/engines/common/evas_convert_colorspace.h index 354a08c..f3bec78 100644 --- a/src/lib/engines/common/evas_convert_colorspace.h +++ b/src/lib/engines/common/evas_convert_colorspace.h @@ -2,8 +2,11 @@ #define _EVAS_CONVERT_COLORSPACE_H -EAPI void *evas_common_convert_argb8888_to (void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace); -EAPI void *evas_common_convert_rgb565_a5p_to (void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace); - +EAPI void *evas_common_convert_argb8888_to (void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace); +EAPI void *evas_common_convert_rgb565_a5p_to (void *data, int w, int h, int stride, Eina_Bool has_alpha, Evas_Colorspace cspace); +EAPI void *evas_common_convert_yuv_422P_601_to(void *data, int w, int h, Evas_Colorspace cspace); +EAPI void *evas_common_convert_yuv_422_601_to (void *data, int w, int h, Evas_Colorspace cspace); +EAPI void *evas_common_convert_yuv_420_601_to (void *data, int w, int h, Evas_Colorspace cspace); +EAPI void *evas_common_convert_yuv_420T_601_to(void *data, int w, int h, Evas_Colorspace cspace); #endif /* _EVAS_CONVERT_COLORSPACE_H */ diff --git a/src/lib/engines/common/evas_convert_yuv.c b/src/lib/engines/common/evas_convert_yuv.c index b832149..a0d155c 100644 --- a/src/lib/engines/common/evas_convert_yuv.c +++ b/src/lib/engines/common/evas_convert_yuv.c @@ -26,6 +26,8 @@ static void _evas_yv12torgb_diz (unsigned char **yuv, unsigned char *rgb, int #endif static void _evas_yv12torgb_raster (unsigned char **yuv, unsigned char *rgb, int w, int h); static void _evas_yuy2torgb_raster (unsigned char **yuv, unsigned char *rgb, int w, int h); +static void _evas_nv12torgb_raster (unsigned char **yuv, unsigned char *rgb, int w, int h); +static void _evas_nv12tiledtorgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h); #define CRV 104595 #define CBU 132251 @@ -898,6 +900,26 @@ evas_common_convert_yuv_422_601_rgba(DATA8 **src, DATA8 *dst, int w, int h) #endif } +void +evas_common_convert_yuv_420_601_rgba(DATA8 **src, DATA8 *dst, int w, int h) +{ +#ifdef BUILD_C + if (!initted) _evas_yuv_init(); + initted = 1; + _evas_nv12torgb_raster(src, dst, w, h); +#endif +} + +void +evas_common_convert_yuv_420T_601_rgba(DATA8 **src, DATA8 *dst, int w, int h) +{ +#ifdef BUILD_C + if (initted) _evas_yuv_init(); + initted = 1; + _evas_nv12tiledtorgb_raster(src, dst, w, h); +#endif +} + static void _evas_yuy2torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h) { @@ -953,5 +975,284 @@ _evas_yuy2torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h) #endif } +#ifdef BUILD_C +static inline void +_evas_yuv2rgb_420_raster(unsigned char *yp1, unsigned char *yp2, unsigned char *up, unsigned char *vp, + unsigned char *dp1, unsigned char *dp2) +{ + int y, u, v; + int vmu; + int rgb; + + /* collect u & v for 4 pixels block */ + u = *up; + v = *vp; + + /* save lookups */ +#ifdef MEM_BP + vmu = _v813[v] + _v391[u]; + u = _v2018[u]; + v = _v1596[v]; +#else + u -= 128; + v -= 128; + vmu = v * CGV + u * CGU; + u = u * CBU; + v = v * CRV; +#endif + + /* do the top 2 pixels of the 2x2 block which shared u & v */ + /* yuv to rgb */ +#ifdef MEM_BP + y = _v1164[*yp1]; + rgb = RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); +#else + y = (*yp1 - 16 ) * YMUL; + rgb = RGB_JOIN(LUT_CLIP(((y + v) >> 16)), + LUT_CLIP(((y - vmu + OFF) >> 16)), + LUT_CLIP(((y + u + OFF) >> 16))); +#endif + *((DATA32 *) dp1) = 0xff000000 + rgb; + + dp1 += 4; yp1++; + + /* yuv to rgb */ +#ifdef MEM_BP + y = _v1164[*yp1]; + rgb = RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); +#else + y = (*yp1 - 16 ) * YMUL; + rgb = RGB_JOIN(LUT_CLIP(((y + v) >> 16)), + LUT_CLIP(((y - vmu + OFF) >> 16)), + LUT_CLIP(((y + u + OFF) >> 16))); +#endif + *((DATA32 *) dp1) = 0xff000000 + rgb; + + /* do the bottom 2 pixels of the 2x2 block which shared u & v */ + /* yuv to rgb */ +#ifdef MEM_BP + y = _v1164[*yp2]; + rgb = RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); +#else + y = (*yp2 - 16 ) * YMUL; + rgb = RGB_JOIN(LUT_CLIP(((y + v) >> 16)), + LUT_CLIP(((y - vmu + OFF) >> 16)), + LUT_CLIP(((y + u + OFF) >> 16))); +#endif + *((DATA32 *) dp2) = 0xff000000 + rgb; + + dp2 += 4; yp2++; + + /* yuv to rgb */ +#ifdef MEM_BP + y = _v1164[*yp2]; + rgb = RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u)); +#else + y = (*yp2 - 16 ) * YMUL; + rgb = RGB_JOIN(LUT_CLIP(((y + v) >> 16)), + LUT_CLIP(((y - vmu + OFF) >> 16)), + LUT_CLIP(((y + u + OFF) >> 16))); +#endif + *((DATA32 *) dp2) = 0xff000000 + rgb; +} +#endif + +static void +_evas_nv12tiledtorgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h) +{ +#ifdef BUILD_C + +#define HANDLE_MACROBLOCK(YP1, YP2, UP, VP, DP1, DP2) \ + { \ + int i; \ + int j; \ + \ + for (i = 0; i < 32; i += 2) \ + { \ + for (j = 0; j < 64; j += 2) \ + { \ + _evas_yuv2rgb_420_raster(YP1, YP2, UP, VP, DP1, DP2); \ + \ + /* the previous call just rendered 2 pixels per lines */ \ + DP1 += 8; DP2 += 8; \ + \ + /* and took for that 2 lines with 2 Y, 1 U and 1 V. Don't forget U & V are in the same plane */ \ + YP1 += 2; YP2 += 2; UP += 2; VP += 2; \ + } \ + \ + DP1 += sizeof (int) * ((w << 1) - 64); \ + DP2 += sizeof (int) * ((w << 1) - 64); \ + YP1 += 64; \ + YP2 += 64; \ + } \ + } + + /* One macro block is 32 lines of Y and 16 lines of UV */ + const int offset_value[2] = { 0, 64 * 16 }; + int mb_x, mb_y, mb_w, mb_h; + int base_h; + int uv_x, uv_y, uv_step; + int stride; + + /* Idea iterate over each macroblock and convert each of them using _evas_nv12torgb_raster */ + + /* The layout of the Y macroblock order in RGB non tiled space : */ + /* --------------------------------------------------- */ + /* | 0 | 1 | 6 | 7 | 8 | 9 | 14 | 15 | 16 | 17 | */ + /* --------------------------------------------------- */ + /* | 2 | 3 | 4 | 5 | 10 | 11 | 12 | 13 | 18 | 19 | */ + /* --------------------------------------------------- */ + /* | 20 | 21 | 26 | 27 | 28 | 29 | 34 | 35 | 36 | 37 | */ + /* --------------------------------------------------- */ + /* | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 38 | 39 | */ + /* --------------------------------------------------- */ + /* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | */ + /* --------------------------------------------------- */ + /* The layout of the UV macroblock order in the same RGB non tiled space : */ + /* --------------------------------------------------- */ + /* | | | | | | | | | | | */ + /* - 0 - 1 - 6 - 7 - 8 - 9 - 14 - 15 - 16 - 17 - */ + /* | | | | | | | | | | | */ + /* --------------------------------------------------- */ + /* | | | | | | | | | | | */ + /* - 2 - 3 - 4 - 5 - 10 - 11 - 12 - 13 - 18 - 19 - */ + /* | | | | | | | | | | | */ + /* --------------------------------------------------- */ + /* | | | | | | | | | | | */ + /* - 20 - 21 - 22 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - */ + + /* the number of macroblock should be a multiple of 64x32 */ + mb_w = w / 64; + mb_h = h / 32; + + base_h = (mb_h >> 1) + (mb_h & 0x1); + stride = w * sizeof (int); + + uv_x = 0; uv_y = 0; + + /* In this format we linearize macroblock on two line to form a Z and it's invert */ + for (mb_y = 0; mb_y < (mb_h >> 1); mb_y++) + { + int step = 2; + int offset = 0; + int x = 0; + int rmb_x = 0; + int ry[2]; + + ry[0] = mb_y * 2 * 32 * stride; + ry[1] = ry[0] + 32 * stride; + + uv_step = (mb_y & 0x1) == 0 ? 4 : 0; + uv_x = (mb_y & 0x1) == 0 ? 0 : 2 * 64 * 32; + + for (mb_x = 0; mb_x < mb_w * 2; mb_x++, rmb_x += 64 * 32) + { + unsigned char *yp1, *yp2, *up, *vp; + unsigned char *dp1, *dp2; + + dp1 = rgb + x + ry[offset]; + dp2 = dp1 + stride; + + yp1 = yuv[mb_y] + rmb_x; + yp2 = yp1 + 64; + + /* UV plane is two time less bigger in pixel count, but it old two bytes each times */ + up = yuv[(mb_y >> 1) + base_h] + uv_x + offset_value[offset]; + vp = up + 1; + + HANDLE_MACROBLOCK(yp1, yp2, up, vp, dp1, dp2); + + step++; + if ((step & 0x3) == 0) + { + offset = 1 - offset; + x -= 64 * sizeof (int); + uv_x -= 64 * 32; + } + else + { + x += 64 * sizeof (int); + uv_x += 64 * 32; + } + + uv_step++; + if (uv_step == 8) + { + uv_step = 0; + uv_x += 4 * 64 * 32; + } + } + } + + if (mb_h & 0x1) + { + int x = 0; + int ry; + + ry = mb_y << 1; + + uv_step = 0; + uv_x = 0; + + for (mb_x = 0; mb_x < mb_w; mb_x++, x++, uv_x++) + { + unsigned char *yp1, *yp2, *up, *vp; + unsigned char *dp1, *dp2; + + dp1 = rgb + (x * 64 + (ry * 32 * w)) * sizeof (int); + dp2 = dp1 + sizeof (int) * w; + + yp1 = yuv[mb_y] + mb_x * 64 * 32; + yp2 = yp1 + 64; + + up = yuv[mb_y / 2 + base_h] + uv_x * 64 * 32; + vp = up + 1; + + HANDLE_MACROBLOCK(yp1, yp2, up, vp, dp1, dp2); + } + } +#endif +} + +static void +_evas_nv12torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h) +{ +#ifdef BUILD_C + int xx, yy; + unsigned char *yp1, *yp2, *up, *vp; + unsigned char *dp1; + unsigned char *dp2; + + dp1 = rgb; + dp2 = dp1 + sizeof (int) * w; + + for (yy = 0; yy < h; yy++) + { + yp1 = yuv[yy++]; + yp2 = yuv[yy]; + + up = yuv[h + (yy >> 1)]; + vp = up + 1; + + for (xx = 0; xx < w; xx += 2) + { + _evas_yuv2rgb_420_raster(yp1, yp2, up, vp, dp1, dp2); + + /* the previous call just rendered 2 pixels per lines */ + dp1 += 8; dp2 += 8; + + /* and took for that 2 lines with 2 Y, 1 U and 1 V. Don't forget U & V are in the same plane */ + yp1 += 2; yp2 += 2; up += 2; vp += 2; + } + + /* jump one line */ + dp1 += sizeof (int) * w; + dp2 += sizeof (int) * w; + yp1 += w; + yp2 += w; + } +#endif +} + #endif diff --git a/src/lib/engines/common/evas_convert_yuv.h b/src/lib/engines/common/evas_convert_yuv.h index 12b4f78..b598807 100644 --- a/src/lib/engines/common/evas_convert_yuv.h +++ b/src/lib/engines/common/evas_convert_yuv.h @@ -1,9 +1,9 @@ #ifndef _EVAS_CONVERT_YUV_H #define _EVAS_CONVERT_YUV_H - -EAPI void evas_common_convert_yuv_420p_601_rgba (DATA8 **src, DATA8 *dst, int w, int h); -EAPI void evas_common_convert_yuv_422_601_rgba(DATA8 **src, DATA8 *dst, int w, int h); - +EAPI void evas_common_convert_yuv_420p_601_rgba (DATA8 **src, DATA8 *dst, int w, int h); +EAPI void evas_common_convert_yuv_422_601_rgba (DATA8 **src, DATA8 *dst, int w, int h); +EAPI void evas_common_convert_yuv_420_601_rgba (DATA8 **src, DATA8 *dst, int w, int h); +EAPI void evas_common_convert_yuv_420T_601_rgba (DATA8 **src, DATA8 *dst, int w, int h); #endif /* _EVAS_CONVERT_YUV_H */ diff --git a/src/lib/engines/common/evas_cpu.c b/src/lib/engines/common/evas_cpu.c index 674e904..cff8b2b 100644 --- a/src/lib/engines/common/evas_cpu.c +++ b/src/lib/engines/common/evas_cpu.c @@ -3,7 +3,11 @@ #include "evas_mmx.h" #endif -#ifndef _WIN32 +#if defined BUILD_SSE3 +#include +#endif + +#if defined (HAVE_STRUCT_SIGACTION) && defined (HAVE_SIGLONGJMP) #include #include #include @@ -13,7 +17,7 @@ static sigjmp_buf detect_buf; static int cpu_feature_mask = 0; -#ifndef _WIN32 +#if defined (HAVE_STRUCT_SIGACTION) && defined (HAVE_SIGLONGJMP) static void evas_common_cpu_catch_ill(int sig); static void evas_common_cpu_catch_segv(int sig); @@ -60,6 +64,16 @@ evas_common_cpu_sse_test(void) #endif } +void evas_common_op_sse3_test(void); + +void +evas_common_cpu_sse3_test(void) +{ +#ifdef BUILD_SSE3 + evas_common_op_sse3_test(); +#endif +} + void evas_common_cpu_altivec_test(void) { @@ -99,7 +113,7 @@ evas_common_cpu_vis_test(void) int evas_common_cpu_feature_test(void (*feature)(void)) { -#ifndef _WIN32 +#if defined (HAVE_STRUCT_SIGACTION) && defined (HAVE_SIGLONGJMP) int enabled = 1; struct sigaction act, oact, oact2; @@ -154,6 +168,13 @@ evas_common_cpu_init(void) evas_common_cpu_end_opt(); if (getenv("EVAS_CPU_NO_SSE")) cpu_feature_mask &= ~CPU_FEATURE_SSE; +#ifdef BUILD_SSE3 + cpu_feature_mask |= CPU_FEATURE_SSE3 * + evas_common_cpu_feature_test(evas_common_cpu_sse3_test); + evas_common_cpu_end_opt(); + if (getenv("EVAS_CPU_NO_SSE3")) + cpu_feature_mask &= ~CPU_FEATURE_SSE3; +#endif /* BUILD_SSE3 */ #endif /* BUILD_SSE */ #endif /* BUILD_MMX */ #ifdef __POWERPC__ diff --git a/src/lib/engines/common/evas_font_ot.c b/src/lib/engines/common/evas_font_ot.c index 7fb9d08..3bd0c59 100644 --- a/src/lib/engines/common/evas_font_ot.c +++ b/src/lib/engines/common/evas_font_ot.c @@ -283,10 +283,10 @@ evas_common_font_ot_populate_text_props(const Eina_Unicode *text, slen = len; } - buffer = hb_buffer_create(slen); + buffer = hb_buffer_create(); hb_buffer_set_unicode_funcs(buffer, _evas_common_font_ot_unicode_funcs_get()); hb_buffer_set_language(buffer, hb_language_from_string( - evas_common_language_from_locale_get())); + evas_common_language_from_locale_get(), -1)); hb_buffer_set_script(buffer, _evas_script_to_harfbuzz[props->script]); hb_buffer_set_direction(buffer, (props->bidi.dir == EVAS_BIDI_DIRECTION_RTL) ? diff --git a/src/lib/engines/common/evas_image_data.c b/src/lib/engines/common/evas_image_data.c index 94257f1..10b3988 100644 --- a/src/lib/engines/common/evas_image_data.c +++ b/src/lib/engines/common/evas_image_data.c @@ -21,6 +21,8 @@ evas_common_rgba_image_from_data(Image_Entry* ie_dst, int w, int h, DATA32 *imag case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: w &= ~0x1; dst->cache_entry.w = w; dst->cache_entry.h = h; @@ -45,21 +47,23 @@ evas_common_rgba_image_from_copied_data(Image_Entry* ie_dst, int w, int h, DATA3 /* FIXME: Is dst->image.data valid. */ switch (cspace) { - case EVAS_COLORSPACE_ARGB8888: - dst->cache_entry.flags.alpha = alpha ? 1 : 0; - if (image_data) - memcpy(dst->image.data, image_data, w * h * sizeof(DATA32)); - break; - case EVAS_COLORSPACE_YCBCR422P601_PL: - case EVAS_COLORSPACE_YCBCR422P709_PL: - case EVAS_COLORSPACE_YCBCR422601_PL: - dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char*) * 2); - if (image_data && (dst->cs.data)) - memcpy(dst->cs.data, image_data, dst->cache_entry.h * sizeof(unsigned char*) * 2); - break; - default: - abort(); - break; + case EVAS_COLORSPACE_ARGB8888: + dst->cache_entry.flags.alpha = alpha ? 1 : 0; + if (image_data) + memcpy(dst->image.data, image_data, w * h * sizeof(DATA32)); + break; + case EVAS_COLORSPACE_YCBCR422P601_PL: + case EVAS_COLORSPACE_YCBCR422P709_PL: + case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char*) * 2); + if (image_data && (dst->cs.data)) + memcpy(dst->cs.data, image_data, dst->cache_entry.h * sizeof(unsigned char*) * 2); + break; + default: + abort(); + break; } dst->cache_entry.space = cspace; @@ -76,15 +80,16 @@ evas_common_rgba_image_size_set(Image_Entry *ie_dst, const Image_Entry *ie_im, u if ((im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P601_PL) || (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P709_PL) || - (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422601_PL)) - w &= ~0x1; + (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422601_PL) || + (im->cache_entry.space == EVAS_COLORSPACE_YCBCR420TM12601_PL) || + (im->cache_entry.space == EVAS_COLORSPACE_YCBCR420NV12601_PL)) + { + w &= ~0x1; + dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char *) * 2); + } dst->flags = im->flags; dst->cs.no_free = 0; - if ((im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P601_PL) || - (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P709_PL) || - (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422601_PL)) - dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char *) * 2); evas_common_image_colorspace_dirty(dst); _evas_common_rgba_image_post_surface(ie_dst); @@ -109,6 +114,8 @@ evas_common_rgba_image_colorspace_set(Image_Entry* ie_dst, int cspace) case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: if (dst->image.no_free) { ie_dst->allocated.w = 0; diff --git a/src/lib/engines/common/evas_image_main.c b/src/lib/engines/common/evas_image_main.c index 122bd86..d4d847c 100644 --- a/src/lib/engines/common/evas_image_main.c +++ b/src/lib/engines/common/evas_image_main.c @@ -610,6 +610,20 @@ evas_common_image_colorspace_normalize(RGBA_Image *im) im->cache_entry.w, im->cache_entry.h); #endif break; + case EVAS_COLORSPACE_YCBCR420NV12601_PL: +#ifdef BUILD_CONVERT_YUV + if ((im->image.data) && (*((unsigned char **)im->cs.data))) + evas_common_convert_yuv_420_601_rgba(im->cs.data, (DATA8*) im->image.data, + im->cache_entry.w, im->cache_entry.h); +#endif + break; + case EVAS_COLORSPACE_YCBCR420TM12601_PL: +#ifdef BUILD_CONVERT_YUV + if ((im->image.data) && (*((unsigned char **)im->cs.data))) + evas_common_convert_yuv_420T_601_rgba(im->cs.data, (DATA8*) im->image.data, + im->cache_entry.w, im->cache_entry.h); +#endif + break; default: break; } diff --git a/src/lib/engines/common/evas_op_blend/Makefile.am b/src/lib/engines/common/evas_op_blend/Makefile.am index 3bd97ce..84add38 100644 --- a/src/lib/engines/common/evas_op_blend/Makefile.am +++ b/src/lib/engines/common/evas_op_blend/Makefile.am @@ -4,15 +4,47 @@ EXTRA_DIST = \ op_blend_color_.c \ op_blend_color_i386.c \ op_blend_color_neon.c \ +op_blend_color_sse3.c \ op_blend_mask_color_.c \ op_blend_mask_color_i386.c \ op_blend_mask_color_neon.c \ +op_blend_mask_color_sse3.c \ op_blend_pixel_.c \ op_blend_pixel_color_.c \ op_blend_pixel_color_i386.c \ op_blend_pixel_color_neon.c \ +op_blend_pixel_color_sse3.c \ op_blend_pixel_i386.c \ op_blend_pixel_mask_.c \ op_blend_pixel_mask_i386.c \ op_blend_pixel_mask_neon.c \ -op_blend_pixel_neon.c +op_blend_pixel_mask_sse3.c \ +op_blend_pixel_neon.c \ +op_blend_pixel_sse3.c + +noinst_LTLIBRARIES = libevas_engine_common_op_blend_master_sse3.la + +libevas_engine_common_op_blend_master_sse3_la_SOURCES = \ +op_blend_master_sse3.c + +libevas_engine_common_op_blend_master_sse3_la_CFLAGS = \ +-I. \ +-I$(top_srcdir)/src/lib \ +-I$(top_srcdir)/src/lib/engines/common \ +-I$(top_srcdir)/src/lib/engines/common/evas_op_blend \ +-I$(top_srcdir)/src/lib/cserve \ +-I$(top_srcdir)/src/lib/include \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@FREETYPE_CFLAGS@ @VALGRIND_CFLAGS@ \ +@PIXMAN_CFLAGS@ \ +@EET_CFLAGS@ @pthread_cflags@ \ +@WIN32_CFLAGS@ @EINA_CFLAGS@ \ +@FRIBIDI_CFLAGS@ @HARFBUZZ_CFLAGS@ \ +@PIXMAN_CFLAGS@ \ +@EVAS_SSE3_CFLAGS@ + +libevas_engine_common_op_blend_master_sse3_la_DEPENENCIES = \ +$(top_builddir)/config.h + diff --git a/src/lib/engines/common/evas_op_blend_main_.c b/src/lib/engines/common/evas_op_blend_main_.c index 7160751..a1a5de8 100644 --- a/src/lib/engines/common/evas_op_blend_main_.c +++ b/src/lib/engines/common/evas_op_blend_main_.c @@ -1,7 +1,7 @@ #include "evas_common.h" -static RGBA_Gfx_Func op_blend_span_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST]; -static RGBA_Gfx_Pt_Func op_blend_pt_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST]; +RGBA_Gfx_Func op_blend_span_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST]; +RGBA_Gfx_Pt_Func op_blend_pt_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST]; static void op_blend_init(void); static void op_blend_shutdown(void); @@ -35,8 +35,8 @@ evas_common_gfx_compositor_blend_get(void) } -static RGBA_Gfx_Func op_blend_rel_span_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST]; -static RGBA_Gfx_Pt_Func op_blend_rel_pt_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST]; +RGBA_Gfx_Func op_blend_rel_span_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST]; +RGBA_Gfx_Pt_Func op_blend_rel_pt_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST]; static void op_blend_rel_init(void); static void op_blend_rel_shutdown(void); @@ -91,11 +91,18 @@ evas_common_gfx_compositor_blend_rel_get(void) # include "./evas_op_blend/op_blend_mask_color_neon.c" //# include "./evas_op_blend/op_blend_pixel_mask_color_neon.c" +#ifdef BUILD_SSE3 +void evas_common_op_blend_init_sse3(void); +#endif + static void op_blend_init(void) { memset(op_blend_span_funcs, 0, sizeof(op_blend_span_funcs)); memset(op_blend_pt_funcs, 0, sizeof(op_blend_pt_funcs)); +#ifdef BUILD_SSE3 + evas_common_op_blend_init_sse3(); +#endif #ifdef BUILD_MMX init_blend_pixel_span_funcs_mmx(); init_blend_pixel_color_span_funcs_mmx(); @@ -121,7 +128,7 @@ op_blend_init(void) init_blend_pixel_mask_pt_funcs_neon(); init_blend_color_pt_funcs_neon(); init_blend_mask_color_pt_funcs_neon(); -#endif +#endif #ifdef BUILD_C init_blend_pixel_span_funcs_c(); init_blend_pixel_color_span_funcs_c(); @@ -147,6 +154,14 @@ blend_gfx_span_func_cpu(int s, int m, int c, int d) { RGBA_Gfx_Func func = NULL; int cpu = CPU_N; +#ifdef BUILD_SSE3 + if (evas_common_cpu_has_feature(CPU_FEATURE_SSE3)) + { + cpu = CPU_SSE3; + func = op_blend_span_funcs[s][m][c][d][cpu]; + if(func) return func; + } +#endif #ifdef BUILD_MMX if (evas_common_cpu_has_feature(CPU_FEATURE_MMX)) { @@ -263,6 +278,14 @@ blend_gfx_pt_func_cpu(int s, int m, int c, int d) { RGBA_Gfx_Pt_Func func = NULL; int cpu = CPU_N; +#ifdef BUILD_SSE3 + if(evas_common_cpu_has_feature(CPU_FEATURE_SSE3)) + { + cpu = CPU_SSE3; + func = op_blend_pt_funcs[s][m][c][d][cpu]; + if(func) return func; + } +#endif #ifdef BUILD_MMX if (evas_common_cpu_has_feature(CPU_FEATURE_MMX)) { @@ -361,12 +384,16 @@ op_blend_pixel_mask_pt_get(Image_Entry_Flags src_flags, RGBA_Image *dst) return blend_gfx_pt_func_cpu(s, m, c, d); } +void evas_common_op_blend_rel_init_sse3(void); static void op_blend_rel_init(void) { memset(op_blend_rel_span_funcs, 0, sizeof(op_blend_rel_span_funcs)); memset(op_blend_rel_pt_funcs, 0, sizeof(op_blend_rel_pt_funcs)); +#ifdef BUILD_SSE3 + evas_common_op_blend_rel_init_sse3(); +#endif #ifdef BUILD_MMX init_blend_rel_pixel_span_funcs_mmx(); init_blend_rel_pixel_color_span_funcs_mmx(); @@ -418,6 +445,14 @@ blend_rel_gfx_span_func_cpu(int s, int m, int c, int d) { RGBA_Gfx_Func func = NULL; int cpu = CPU_N; +#ifdef BUILD_SSE3 + if (evas_common_cpu_has_feature(CPU_FEATURE_SSE3)) + { + cpu = CPU_SSE3; + func = op_blend_rel_span_funcs[s][m][c][d][cpu]; + if(func) return func; + } +#endif #ifdef BUILD_MMX if (evas_common_cpu_has_feature(CPU_FEATURE_MMX)) { @@ -529,6 +564,14 @@ blend_rel_gfx_pt_func_cpu(int s, int m, int c, int d) { RGBA_Gfx_Pt_Func func = NULL; int cpu = CPU_N; +#ifdef BUILD_SSE3 + if (evas_common_cpu_has_feature(CPU_FEATURE_SSE3)) + { + cpu = CPU_SSE3; + func = op_blend_rel_pt_funcs[s][m][c][d][cpu]; + if(func) return func; + } +#endif #ifdef BUILD_MMX if (evas_common_cpu_has_feature(CPU_FEATURE_MMX)) { diff --git a/src/lib/file/evas_module.c b/src/lib/file/evas_module.c index 04223d9..b335dba 100644 --- a/src/lib/file/evas_module.c +++ b/src/lib/file/evas_module.c @@ -289,6 +289,20 @@ evas_module_register(const Evas_Module_Api *module, Evas_Module_Type type) return EINA_TRUE; } +Eina_List * +evas_module_engine_list(void) +{ + Evas_Module *em; + Eina_List *r = NULL; + Eina_Array_Iterator iterator; + unsigned int i; + + EINA_ARRAY_ITER_NEXT(evas_engines, i, em, iterator) + r = eina_list_append(r, em->definition->name); + + return r; +} + Eina_Bool evas_module_unregister(const Evas_Module_Api *module, Evas_Module_Type type) { @@ -554,3 +568,15 @@ _evas_module_engine_inherit(Evas_Func *funcs, char *name) } return 0; } + +static Eina_Prefix *pfx = NULL; + +EAPI const char * +_evas_module_libdir_get(void) +{ + if (!pfx) pfx = eina_prefix_new + (NULL, _evas_module_libdir_get, "EVAS", "evas", NULL, + PACKAGE_BIN_DIR, PACKAGE_LIB_DIR, PACKAGE_DATA_DIR, PACKAGE_DATA_DIR); + if (!pfx) return NULL; + return eina_prefix_lib_get(pfx); +} diff --git a/src/lib/include/evas_blend_ops.h b/src/lib/include/evas_blend_ops.h index 9627f87..1429596 100644 --- a/src/lib/include/evas_blend_ops.h +++ b/src/lib/include/evas_blend_ops.h @@ -5,6 +5,14 @@ #include "evas_mmx.h" #endif +#include "config.h" + +#ifdef NEED_SSE3 +# if defined BUILD_SSE3 +# include +# endif +#endif + /* src pixel flags: */ /* pixels none */ @@ -67,8 +75,10 @@ #define CPU_SSE2 4 /* cpu flags count */ #define CPU_NEON 5 +/* CPU SSE3 */ +#define CPU_SSE3 6 /* cpu flags count */ -#define CPU_LAST 6 +#define CPU_LAST 7 /* some useful constants */ @@ -176,4 +186,193 @@ extern const DATA32 ALPHA_256; #endif + +/* some useful SSE3 inline functions */ + +#ifdef NEED_SSE3 +#ifdef BUILD_SSE3 + +static __m128i GA_MASK_SSE3; +static __m128i RB_MASK_SSE3; +static __m128i SYM4_MASK_SSE3; +static __m128i RGB_MASK_SSE3; +//static __m128i A_MASK_SSE3; + +static __m128i ALPHA_SSE3; + +static always_inline __m128i +mul_256_sse3(__m128i a, __m128i c) { + + /* prepare alpha for word multiplication */ + __m128i a_l = a; + __m128i a_h = a; + a_l = _mm_unpacklo_epi16(a_l, a_l); + a_h = _mm_unpackhi_epi16(a_h, a_h); + __m128i a0 = (__m128i) _mm_shuffle_ps( (__m128)a_l, (__m128)a_h, 0x88); + + /* first half of calc */ + __m128i c0 = c; + c0 = _mm_srli_epi32(c0, 8); + c0 = _mm_and_si128(GA_MASK_SSE3, c0); + c0 = _mm_mullo_epi16(a0, c0); + c0 = _mm_and_si128(RB_MASK_SSE3, c0); + + /* second half of calc */ + __m128i c1 = c; + c1 = _mm_and_si128(GA_MASK_SSE3, c1); + c1 = _mm_mullo_epi16(a0, c1); + c1 = _mm_srli_epi32(c1, 8); + c1 = _mm_and_si128(GA_MASK_SSE3, c1); + + /* combine */ + return _mm_add_epi32(c0, c1); +} + +static always_inline __m128i +sub4_alpha_sse3(__m128i c) { + + __m128i c0 = c; + + c0 = _mm_srli_epi32(c0, 24); + return _mm_sub_epi32(ALPHA_SSE3, c0); +} + +static always_inline __m128i +interp4_256_sse3(__m128i a, __m128i c0, __m128i c1) +{ + const __m128i zero = _mm_setzero_si128(); + + __m128i a_l = a; + __m128i a_h = a; + a_l = _mm_unpacklo_epi16(a_l, a_l); + a_h = _mm_unpackhi_epi16(a_h, a_h); + + __m128i a_t = _mm_slli_epi64(a_l, 32); + __m128i a_t0 = _mm_slli_epi64(a_h, 32); + + a_l = _mm_add_epi32(a_l, a_t); + a_h = _mm_add_epi32(a_h, a_t0); + + __m128i c0_l = c0; + __m128i c0_h = c0; + + c0_l = _mm_unpacklo_epi8(c0_l, zero); + c0_h = _mm_unpackhi_epi8(c0_h, zero); + + __m128i c1_l = c1; + __m128i c1_h = c1; + + c1_l = _mm_unpacklo_epi8(c1_l, zero); + c1_h = _mm_unpackhi_epi8(c1_h, zero); + + __m128i cl_sub = _mm_sub_epi16(c0_l, c1_l); + __m128i ch_sub = _mm_sub_epi16(c0_h, c1_h); + + cl_sub = _mm_mullo_epi16(cl_sub, a_l); + ch_sub = _mm_mullo_epi16(ch_sub, a_h); + + __m128i c1ls = _mm_slli_epi16(c1_l, 8); + __m128i c1hs = _mm_slli_epi16(c1_h, 8); + + cl_sub = _mm_add_epi16(cl_sub, c1ls); + ch_sub = _mm_add_epi16(ch_sub, c1hs); + + cl_sub = _mm_and_si128(cl_sub, RB_MASK_SSE3); + ch_sub = _mm_and_si128(ch_sub, RB_MASK_SSE3); + + cl_sub = _mm_srli_epi64(cl_sub, 8); + ch_sub = _mm_srli_epi64(ch_sub, 8); + + cl_sub = _mm_packus_epi16(cl_sub, cl_sub); + ch_sub = _mm_packus_epi16(ch_sub, ch_sub); + + return (__m128i) _mm_shuffle_ps( (__m128)cl_sub, (__m128)ch_sub, 0x44); +} + +static always_inline __m128i +mul_sym_sse3(__m128i a, __m128i c) { + + /* Prepare alpha for word mult */ + __m128i a_l = a; + __m128i a_h = a; + a_l = _mm_unpacklo_epi16(a_l, a_l); + a_h = _mm_unpackhi_epi16(a_h, a_h); + __m128i a0 = (__m128i) _mm_shuffle_ps( (__m128)a_l, (__m128)a_h, 0x88); + + /* first part */ + __m128i c0 = c; + c0 = _mm_srli_epi32(c0, 8); + c0 = _mm_and_si128(GA_MASK_SSE3, c0); + c0 = _mm_mullo_epi16(a0, c0); + c0 = _mm_add_epi32(c0, GA_MASK_SSE3); + c0 = _mm_and_si128(RB_MASK_SSE3, c0); + + /* second part */ + __m128i c1 = c; + c1 = _mm_and_si128(GA_MASK_SSE3, c1); + c1 = _mm_mullo_epi16(a0, c1); + c1 = _mm_add_epi32(c1, GA_MASK_SSE3); + c1 = _mm_srli_epi32(c1, 8); + c1 = _mm_and_si128(GA_MASK_SSE3, c1); + + return _mm_add_epi32(c0, c1); +} + +static always_inline __m128i +mul4_sym_sse3(__m128i x, __m128i y) { + + const __m128i zero = _mm_setzero_si128(); + + __m128i x_l = _mm_unpacklo_epi8(x, zero); + __m128i x_h = _mm_unpackhi_epi8(x, zero); + + __m128i y_l = _mm_unpacklo_epi8(y, zero); + __m128i y_h = _mm_unpackhi_epi8(y, zero); + + __m128i r_l = _mm_mullo_epi16(x_l, y_l); + __m128i r_h = _mm_mullo_epi16(x_h, y_h); + + r_l = _mm_add_epi16(r_l, SYM4_MASK_SSE3); + r_h = _mm_add_epi16(r_h, SYM4_MASK_SSE3); + + r_l = _mm_srli_epi16(r_l, 8); + r_h = _mm_srli_epi16(r_h, 8); + + return _mm_packus_epi16(r_l, r_h); +} + +static always_inline __m128i +mul3_sym_sse3(__m128i x, __m128i y) { + + __m128i res = mul4_sym_sse3(x, y); + return _mm_and_si128(res, RGB_MASK_SSE3); +} + +#define LOOP_ALIGNED_U1_A48_SSE3(D, LENGTH, UOP,A4OP, A8OP) \ + { \ + while((uintptr_t)d & 0xF && l) UOP \ + \ + while(l) { \ + switch(l) { \ + case 3: UOP \ + case 2: UOP \ + case 1: UOP \ + break; \ + case 7: \ + case 6: \ + case 5: \ + case 4: \ + A4OP \ + break; \ + default: \ + A8OP \ + break; \ + } \ + } \ + } + + +#endif +#endif + #endif diff --git a/src/lib/include/evas_common.h b/src/lib/include/evas_common.h index 1570728..e00398c 100644 --- a/src/lib/include/evas_common.h +++ b/src/lib/include/evas_common.h @@ -158,7 +158,7 @@ extern EAPI int _evas_log_dom_global; # define LKI(x) # define LKD(x) # define LKL(x) -# define LKT(x) 0 +# define LKT(x) 1 # define LKU(x) # define TH(x) # define THI(x) @@ -350,9 +350,9 @@ void *alloca (size_t); /*****************************************************************************/ -typedef unsigned long long DATA64; -typedef unsigned int DATA32; -typedef unsigned short DATA16; +typedef unsigned long long DATA64; +typedef unsigned int DATA32; +typedef unsigned short DATA16; typedef unsigned char DATA8; typedef struct _Image_Entry Image_Entry; @@ -458,7 +458,8 @@ typedef enum _CPU_Features CPU_FEATURE_ALTIVEC = (1 << 3), CPU_FEATURE_VIS = (1 << 4), CPU_FEATURE_VIS2 = (1 << 5), - CPU_FEATURE_NEON = (1 << 6) + CPU_FEATURE_NEON = (1 << 6), + CPU_FEATURE_SSE3 = (1 << 7) } CPU_Features; typedef enum _Font_Hint_Flags diff --git a/src/lib/include/evas_options.h b/src/lib/include/evas_options.h index a54291d..f6739c0 100644 --- a/src/lib/include/evas_options.h +++ b/src/lib/include/evas_options.h @@ -43,6 +43,7 @@ /*#define BUILD_MMX*/ /*#define BUILD_SSE*/ +/*#define BUILD_SSE3*/ /*#define BUILD_C*/ /*#define BUILD_LOADER_PNG*/ @@ -54,9 +55,11 @@ /* check in that the user configured it right */ #ifndef BUILD_MMX -# ifndef BUILD_SSE -# ifndef BUILD_C +# ifndef BUILD_SSE3 +# ifndef BUILD_SSE +# ifndef BUILD_C # error "Please Read the README" + #endif # endif # endif #endif diff --git a/src/lib/include/evas_private.h b/src/lib/include/evas_private.h index d20d0f5..bb16f47 100644 --- a/src/lib/include/evas_private.h +++ b/src/lib/include/evas_private.h @@ -47,6 +47,48 @@ typedef struct _Evas_Map_Point Evas_Map_Point; typedef struct _Evas_Smart_Cb_Description_Array Evas_Smart_Cb_Description_Array; typedef struct _Evas_Post_Callback Evas_Post_Callback; +enum _Evas_Font_Style +{ + EVAS_FONT_STYLE_SLANT, + EVAS_FONT_STYLE_WEIGHT, + EVAS_FONT_STYLE_WIDTH +}; + +enum _Evas_Font_Slant +{ + EVAS_FONT_SLANT_NORMAL, + EVAS_FONT_SLANT_OBLIQUE, + EVAS_FONT_SLANT_ITALIC +}; + +enum _Evas_Font_Weight +{ + EVAS_FONT_WEIGHT_NORMAL, + EVAS_FONT_WEIGHT_THIN, + EVAS_FONT_WEIGHT_ULTRALIGHT, + EVAS_FONT_WEIGHT_LIGHT, + EVAS_FONT_WEIGHT_BOOK, + EVAS_FONT_WEIGHT_MEDIUM, + EVAS_FONT_WEIGHT_SEMIBOLD, + EVAS_FONT_WEIGHT_BOLD, + EVAS_FONT_WEIGHT_ULTRABOLD, + EVAS_FONT_WEIGHT_BLACK, + EVAS_FONT_WEIGHT_EXTRABLACK +}; + +enum _Evas_Font_Width +{ + EVAS_FONT_WIDTH_NORMAL, + EVAS_FONT_WIDTH_ULTRACONDENSED, + EVAS_FONT_WIDTH_EXTRACONDENSED, + EVAS_FONT_WIDTH_CONDENSED, + EVAS_FONT_WIDTH_SEMICONDENSED, + EVAS_FONT_WIDTH_SEMIEXPANDED, + EVAS_FONT_WIDTH_EXPANDED, + EVAS_FONT_WIDTH_EXTRAEXPANDED, + EVAS_FONT_WIDTH_ULTRAEXPANDED +}; + typedef enum _Evas_Font_Style Evas_Font_Style; typedef enum _Evas_Font_Slant Evas_Font_Slant; typedef enum _Evas_Font_Weight Evas_Font_Weight; @@ -305,6 +347,10 @@ struct _Evas Eina_Array calculate_objects; Eina_Array clip_changes; + Eina_List *calc_list; + Eina_List *calc_list_current; + Eina_List *video_objects; + Eina_List *post_events; // free me on evas_free Evas_Callbacks *callbacks; @@ -316,6 +362,7 @@ struct _Evas Eina_List *font_path; int in_smart_calc; + int smart_calc_count; Evas_Object *focused; void *attach_data; @@ -331,6 +378,8 @@ struct _Evas unsigned char invalidate : 1; unsigned char cleanup : 1; unsigned char focus : 1; + + Eina_List *touch_points; }; struct _Evas_Layer @@ -591,48 +640,6 @@ struct _Evas_Font_Alias Evas_Font *fn; }; -enum _Evas_Font_Style -{ - EVAS_FONT_STYLE_SLANT, - EVAS_FONT_STYLE_WEIGHT, - EVAS_FONT_STYLE_WIDTH -}; - -enum _Evas_Font_Slant -{ - EVAS_FONT_SLANT_NORMAL, - EVAS_FONT_SLANT_OBLIQUE, - EVAS_FONT_SLANT_ITALIC -}; - -enum _Evas_Font_Weight -{ - EVAS_FONT_WEIGHT_NORMAL, - EVAS_FONT_WEIGHT_THIN, - EVAS_FONT_WEIGHT_ULTRALIGHT, - EVAS_FONT_WEIGHT_LIGHT, - EVAS_FONT_WEIGHT_BOOK, - EVAS_FONT_WEIGHT_MEDIUM, - EVAS_FONT_WEIGHT_SEMIBOLD, - EVAS_FONT_WEIGHT_BOLD, - EVAS_FONT_WEIGHT_ULTRABOLD, - EVAS_FONT_WEIGHT_BLACK, - EVAS_FONT_WEIGHT_EXTRABLACK -}; - -enum _Evas_Font_Width -{ - EVAS_FONT_WIDTH_NORMAL, - EVAS_FONT_WIDTH_ULTRACONDENSED, - EVAS_FONT_WIDTH_EXTRACONDENSED, - EVAS_FONT_WIDTH_CONDENSED, - EVAS_FONT_WIDTH_SEMICONDENSED, - EVAS_FONT_WIDTH_SEMIEXPANDED, - EVAS_FONT_WIDTH_EXPANDED, - EVAS_FONT_WIDTH_EXTRAEXPANDED, - EVAS_FONT_WIDTH_ULTRAEXPANDED -}; - struct _Evas_Font_Description { int ref; @@ -645,7 +652,7 @@ struct _Evas_Font_Description Evas_Font_Weight weight; Evas_Font_Width width; - Eina_Bool new : 1; + Eina_Bool is_new : 1; }; struct _Evas_Object_Func @@ -897,6 +904,9 @@ const Evas_Smart_Cb_Description *evas_smart_cb_description_find(const Evas_Smart Eina_Bool _evas_object_image_preloading_get(const Evas_Object *obj); void _evas_object_image_preloading_set(Evas_Object *obj, Eina_Bool preloading); void _evas_object_image_preloading_check(Evas_Object *obj); +Evas_Object *_evas_object_image_video_parent_get(Evas_Object *obj); +void _evas_object_image_video_overlay_show(Evas_Object *obj); +void _evas_object_image_video_overlay_hide(Evas_Object *obj); void evas_object_smart_del(Evas_Object *obj); void evas_object_smart_cleanup(Evas_Object *obj); void evas_object_smart_member_raise(Evas_Object *member); @@ -988,7 +998,8 @@ void _evas_unwalk(Evas *e); // expose for use in engines EAPI int _evas_module_engine_inherit(Evas_Func *funcs, char *name); - +EAPI const char *_evas_module_libdir_get(void); + Eina_Bool evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface, int off_x, int off_y, int mapped, @@ -999,6 +1010,13 @@ void evas_render_object_recalc(Evas_Object *obj); Eina_Bool evas_map_inside_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y); Eina_Bool evas_map_coords_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y, Evas_Coord *mx, Evas_Coord *my, int grab); +Eina_List *evas_module_engine_list(void); + +/* for touch event */ +void _evas_event_touch_down(Evas *e, Evas_Coord x, Evas_Coord y, int id, unsigned int timestamp); +void _evas_event_touch_up(Evas *e, Evas_Coord x, Evas_Coord y, int id, unsigned int timestamp); +void _evas_event_touch_move(Evas *e, Evas_Coord x, Evas_Coord y, int id, unsigned int timestamp); + /****************************************************************************/ /*****************************************/ /********************/ diff --git a/src/modules/engines/Makefile.am b/src/modules/engines/Makefile.am index 60acbd1..041e3ad 100644 --- a/src/modules/engines/Makefile.am +++ b/src/modules/engines/Makefile.am @@ -47,7 +47,10 @@ if !EVAS_STATIC_BUILD_SOFTWARE_16_X11 SUBDIRS += software_16_x11 endif if !EVAS_STATIC_BUILD_SOFTWARE_SDL -SUBDIRS += software_16_sdl software_sdl +SUBDIRS += software_sdl +endif +if !EVAS_STATIC_BUILD_SOFTWARE_16_SDL +SUBDIRS += software_16_sdl endif if !EVAS_STATIC_BUILD_SOFTWARE_DDRAW SUBDIRS += software_ddraw diff --git a/src/modules/engines/gl_common/Makefile.am b/src/modules/engines/gl_common/Makefile.am index c92d5fb..aeae77d 100644 --- a/src/modules/engines/gl_common/Makefile.am +++ b/src/modules/engines/gl_common/Makefile.am @@ -51,6 +51,10 @@ shader/img_bgra_nomul_vert.h \ shader/img_bgra_nomul_vert_bin_s3c6410.h \ shader/img_mask_frag.h \ shader/img_mask_vert.h \ +shader/nv12_nomul_vert.h \ +shader/nv12_vert.h \ +shader/nv12_nomul_frag.h \ +shader/nv12_frag.h \ shader/yuv_frag.h \ shader/yuv_frag_bin_s3c6410.h \ shader/yuv_vert.h \ @@ -82,7 +86,11 @@ shader/filter_greyscale_bgra_nomul.h \ shader/filter_blur.h \ shader/filter_blur_nomul.h \ shader/filter_blur_bgra.h \ -shader/filter_blur_bgra_nomul.h +shader/filter_blur_bgra_nomul.h \ +shader/yuy2_frag.h \ +shader/yuy2_vert.h \ +shader/yuy2_nomul_frag.h \ +shader/yuy2_nomul_vert.h libevas_engine_gl_common_la_LIBADD = @EINA_LIBS@ @GL_EET_LIBS@ @evas_engine_gl_common_libs@ @dlopen_libs@ endif diff --git a/src/modules/engines/gl_common/evas_gl_common.h b/src/modules/engines/gl_common/evas_gl_common.h index a131cce..34a0cc9 100644 --- a/src/modules/engines/gl_common/evas_gl_common.h +++ b/src/modules/engines/gl_common/evas_gl_common.h @@ -78,14 +78,20 @@ #ifndef EGL_MAP_GL_TEXTURE_RGBA_SEC # define EGL_MAP_GL_TEXTURE_RGBA_SEC 0x3206 #endif +#ifndef EGL_MAP_GL_TEXTURE_LUMINANCE_SEC +# define EGL_MAP_GL_TEXTURE_LUMINANCE_SEC 0x3207 +#endif +#ifndef EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC +# define EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC 0x3208 +#endif #ifndef EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC -# define EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC 0x3206 +# define EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC 0x3209 #endif #ifndef EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC -# define EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC 0x3207 +# define EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC 0x3210 #endif #ifndef EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC -# define EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC 0x3208 +# define EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC 0x3211 #endif #ifndef GL_PROGRAM_BINARY_LENGTH # define GL_PROGRAM_BINARY_LENGTH 0x8741 @@ -118,9 +124,46 @@ typedef struct _Evas_GL_Font_Texture Evas_GL_Font_Texture; typedef struct _Evas_GL_Polygon Evas_GL_Polygon; typedef struct _Evas_GL_Polygon_Point Evas_GL_Polygon_Point; +typedef enum { + SHADER_RECT, + SHADER_FONT, + SHADER_IMG, + SHADER_IMG_NOMUL, + SHADER_IMG_BGRA, + SHADER_IMG_BGRA_NOMUL, + SHADER_IMG_MASK, + SHADER_YUV, + SHADER_YUV_NOMUL, + SHADER_YUY2, + SHADER_YUY2_NOMUL, + SHADER_NV12, + SHADER_NV12_NOMUL, + SHADER_TEX, + SHADER_TEX_NOMUL, + SHADER_FILTER_INVERT, + SHADER_FILTER_INVERT_NOMUL, + SHADER_FILTER_INVERT_BGRA, + SHADER_FILTER_INVERT_BGRA_NOMUL, + SHADER_FILTER_GREYSCALE, + SHADER_FILTER_GREYSCALE_NOMUL, + SHADER_FILTER_GREYSCALE_BGRA, + SHADER_FILTER_GREYSCALE_BGRA_NOMUL, + SHADER_FILTER_SEPIA, + SHADER_FILTER_SEPIA_NOMUL, + SHADER_FILTER_SEPIA_BGRA, + SHADER_FILTER_SEPIA_BGRA_NOMUL, + /* SHADER_FILTER_BLUR, */ + /* SHADER_FILTER_BLUR_NOMUL, */ + /* SHADER_FILTER_BLUR_BGRA, */ + /* SHADER_FILTER_BLUR_BGRA_NOMUL, */ + SHADER_LAST +} Evas_GL_Shader; + struct _Evas_GL_Program { GLuint vert, frag, prog; + + int tex_count; }; struct _Evas_GL_Program_Source @@ -200,28 +243,8 @@ struct _Evas_GL_Shared Eina_Hash *native_pm_hash; Eina_Hash *native_tex_hash; - struct { - Evas_GL_Program rect; - Evas_GL_Program font; - - Evas_GL_Program img, img_nomul; - Evas_GL_Program img_bgra, img_bgra_nomul; - Evas_GL_Program img_mask; - Evas_GL_Program yuv, yuv_nomul; - Evas_GL_Program tex, tex_nomul; - - Evas_GL_Program filter_invert, filter_invert_nomul; - Evas_GL_Program filter_invert_bgra, filter_invert_bgra_nomul; - Evas_GL_Program filter_greyscale, filter_greyscale_nomul; - Evas_GL_Program filter_greyscale_bgra, filter_greyscale_bgra_nomul; - Evas_GL_Program filter_sepia, filter_sepia_nomul; - Evas_GL_Program filter_sepia_bgra, filter_sepia_bgra_nomul; -#if 0 - Evas_GL_Program filter_blur_vert; - Evas_GL_Program filter_blur, filter_blur_nomul; - Evas_GL_Program filter_blur_bgra, filter_blur_bgra_nomul; -#endif - } shader; + Evas_GL_Program shader[SHADER_LAST]; + int references; int w, h; int rot; @@ -237,8 +260,8 @@ struct _Evas_GL_Shared #define RTYPE_YUV 4 #define RTYPE_MAP 5 /* need to merge with image */ #define RTYPE_IMASK 6 - - +#define RTYPE_YUY2 7 +#define RTYPE_NV12 8 struct _Evas_Engine_GL_Context { @@ -255,7 +278,7 @@ struct _Evas_Engine_GL_Context int top_pipe; struct { GLuint cur_prog; - GLuint cur_tex, cur_texu, cur_texv; + GLuint cur_tex, cur_texu, cur_texv; GLuint cur_texm, cur_texmu, cur_texmv; int render_op; int cx, cy, cw, ch; @@ -278,7 +301,8 @@ struct _Evas_Engine_GL_Context Evas_GL_Image *surface; GLuint cur_prog; GLuint cur_tex, cur_texu, cur_texv, cur_texm; - int render_op; + void *cur_tex_dyn, *cur_texu_dyn, *cur_texv_dyn; + int render_op; int cx, cy, cw, ch; int smooth; int blend; @@ -345,12 +369,19 @@ struct _Evas_GL_Texture { Evas_Engine_GL_Context *gc; Evas_GL_Image *im; - Evas_GL_Texture_Pool *pt, *ptu, *ptv; + Evas_GL_Texture_Pool *pt, *ptu, *ptv, *ptuv; int x, y, w, h; double sx1, sy1, sx2, sy2; int references; + struct + { + Evas_GL_Texture_Pool *pt[2], *ptuv[2]; + int source; + } double_buffer; + Eina_Bool alpha : 1; + Eina_Bool dyn : 1; }; struct _Evas_GL_Image @@ -409,6 +440,7 @@ struct _Evas_GL_Polygon_Point int x, y; }; +#if 0 extern Evas_GL_Program_Source shader_rect_frag_src; extern Evas_GL_Program_Source shader_rect_vert_src; extern Evas_GL_Program_Source shader_font_frag_src; @@ -430,6 +462,11 @@ extern Evas_GL_Program_Source shader_yuv_vert_src; extern Evas_GL_Program_Source shader_yuv_nomul_frag_src; extern Evas_GL_Program_Source shader_yuv_nomul_vert_src; +extern Evas_GL_Program_Source shader_yuy2_frag_src; +extern Evas_GL_Program_Source shader_yuy2_vert_src; +extern Evas_GL_Program_Source shader_yuy2_nomul_frag_src; +extern Evas_GL_Program_Source shader_yuy2_nomul_vert_src; + extern Evas_GL_Program_Source shader_tex_frag_src; extern Evas_GL_Program_Source shader_tex_vert_src; extern Evas_GL_Program_Source shader_tex_nomul_frag_src; @@ -447,7 +484,6 @@ extern Evas_GL_Program_Source shader_filter_greyscale_frag_src; extern Evas_GL_Program_Source shader_filter_greyscale_nomul_frag_src; extern Evas_GL_Program_Source shader_filter_greyscale_bgra_frag_src; extern Evas_GL_Program_Source shader_filter_greyscale_bgra_nomul_frag_src; -#if 0 /* blur (annoyingly) needs (aka is faster with) a vertex shader */ extern Evas_GL_Program_Source shader_filter_blur_vert_src; extern Evas_GL_Program_Source shader_filter_blur_frag_src; @@ -499,6 +535,18 @@ void evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc, int x, int y, int w, int h, int r, int g, int b, int a, Eina_Bool smooth); +void evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc, + Evas_GL_Texture *tex, + double sx, double sy, double sw, double sh, + int x, int y, int w, int h, + int r, int g, int b, int a, + Eina_Bool smooth); +void evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc, + Evas_GL_Texture *tex, + double sx, double sy, double sw, double sh, + int x, int y, int w, int h, + int r, int g, int b, int a, + Eina_Bool smooth); void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, Evas_GL_Texture *tex, int npoints, @@ -507,7 +555,7 @@ void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *g int r, int g, int b, int a, Eina_Bool smooth, Eina_Bool tex_only, - Eina_Bool yuv); + Evas_Colorspace cspace); void evas_gl_common_context_flush(Evas_Engine_GL_Context *gc); int evas_gl_common_shader_program_init(Evas_GL_Shared *shared); @@ -527,6 +575,12 @@ Evas_GL_Texture *evas_gl_common_texture_alpha_new(Evas_Engine_GL_Context *gc, D void evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels, unsigned int w, unsigned int h, int fh); Evas_GL_Texture *evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h); void evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned int w, unsigned int h); +Evas_GL_Texture *evas_gl_common_texture_yuy2_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h); +void evas_gl_common_texture_yuy2_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned int w, unsigned int h); +Evas_GL_Texture *evas_gl_common_texture_nv12_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h); +void evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **row, unsigned int w, unsigned int h); +Evas_GL_Texture *evas_gl_common_texture_nv12tiled_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h); +void evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **row, unsigned int w, unsigned int h); void evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc); @@ -583,7 +637,7 @@ extern unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b); extern unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d); #endif -//#define GL_ERRORS 1 +#define GL_ERRORS 1 #ifdef GL_ERRORS # define GLERR(fn, fl, ln, op) \ diff --git a/src/modules/engines/gl_common/evas_gl_context.c b/src/modules/engines/gl_common/evas_gl_context.c index 221d7f2..5bd3c44 100644 --- a/src/modules/engines/gl_common/evas_gl_context.c +++ b/src/modules/engines/gl_common/evas_gl_context.c @@ -324,6 +324,7 @@ static void _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) { GLfloat proj[16]; + unsigned int i; int w = 1, h = 1, m = 1, rot = 1, foc = 0; EINA_SAFETY_ON_NULL_RETURN(gc); @@ -445,151 +446,13 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) gc->shared->ay = ay; } - glUseProgram(gc->shared->shader.rect.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.rect.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.font.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.font.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - - glUseProgram(gc->shared->shader.yuv.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.yuv.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.yuv_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.yuv_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - - glUseProgram(gc->shared->shader.tex.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.tex.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.tex_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.tex_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - - glUseProgram(gc->shared->shader.img.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.img.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.img_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.img_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - - glUseProgram(gc->shared->shader.img_bgra.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.img_bgra.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.img_bgra_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.img_bgra_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.img_mask.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.img_mask.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_invert.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_invert.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_invert_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_invert_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_invert_bgra.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_invert_bgra.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_invert_bgra_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_invert_bgra_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - - glUseProgram(gc->shared->shader.filter_greyscale.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_greyscale.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_greyscale_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_greyscale_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_greyscale_bgra.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_greyscale_bgra.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_greyscale_bgra_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_greyscale_bgra_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - - glUseProgram(gc->shared->shader.filter_sepia.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_sepia.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_sepia_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_sepia_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_sepia_bgra.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_sepia_bgra.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_sepia_bgra_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_sepia_bgra_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - -#if 0 - glUseProgram(gc->shared->shader.filter_blur_bgra_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_blur_bgra_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_blur_bgra_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_blur_bgra_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_blur_bgra_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_blur_bgra_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->shared->shader.filter_blur_bgra_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.filter_blur_bgra_nomul.prog, "mvp"), 1, - GL_FALSE, proj); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); -#endif - + for (i = 0; i < SHADER_LAST; ++i) + { + glUseProgram(gc->shared->shader[i].prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader[i].prog, "mvp"), 1, GL_FALSE, proj); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } glUseProgram(gc->pipe[0].shader.cur_prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); @@ -811,32 +674,34 @@ evas_gl_common_context_new(void) if (!evas_gl_common_shader_program_init(shared)) goto error; - glUseProgram(shared->shader.yuv.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "tex"), 0); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "texu"), 1); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "texv"), 2); +#define SHADER_TEXTURE_ADD(Shared, Shader, Name) \ + glUseProgram(Shared->shader[SHADER_##Shader].prog); \ + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); \ + glUniform1i(glGetUniformLocation(Shared->shader[SHADER_##Shader].prog, #Name), Shared->shader[SHADER_##Shader].tex_count++); \ GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(shared->shader.yuv_nomul.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniform1i(glGetUniformLocation(shared->shader.yuv_nomul.prog, "tex"), 0); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniform1i(glGetUniformLocation(shared->shader.yuv_nomul.prog, "texu"), 1); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniform1i(glGetUniformLocation(shared->shader.yuv_nomul.prog, "texv"), 2); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + SHADER_TEXTURE_ADD(shared, YUV, tex); + SHADER_TEXTURE_ADD(shared, YUV, texu); + SHADER_TEXTURE_ADD(shared, YUV, texv); - glUseProgram(shared->shader.img_mask.prog); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniform1i(glGetUniformLocation(shared->shader.img_mask.prog, "tex"), 0); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUniform1i(glGetUniformLocation(shared->shader.img_mask.prog, "texm"), 1); - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + SHADER_TEXTURE_ADD(shared, YUY2, tex); + SHADER_TEXTURE_ADD(shared, YUY2, texuv); + + SHADER_TEXTURE_ADD(shared, NV12, tex); + SHADER_TEXTURE_ADD(shared, NV12, texuv); + + SHADER_TEXTURE_ADD(shared, YUV_NOMUL, tex); + SHADER_TEXTURE_ADD(shared, YUV_NOMUL, texu); + SHADER_TEXTURE_ADD(shared, YUV_NOMUL, texv); + SHADER_TEXTURE_ADD(shared, YUY2_NOMUL, tex); + SHADER_TEXTURE_ADD(shared, YUY2_NOMUL, texuv); + SHADER_TEXTURE_ADD(shared, NV12_NOMUL, tex); + SHADER_TEXTURE_ADD(shared, NV12_NOMUL, texuv); + + SHADER_TEXTURE_ADD(shared, IMG_MASK, tex); + SHADER_TEXTURE_ADD(shared, IMG_MASK, texm); glUseProgram(gc->pipe[0].shader.cur_prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); @@ -894,19 +759,8 @@ evas_gl_common_context_free(Evas_Engine_GL_Context *gc) { Evas_GL_Texture_Pool *pt; - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.rect)); - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.font)); - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.img)); - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.img_nomul)); - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.img_bgra)); - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.img_bgra_nomul)); - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.img_mask)); - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.yuv)); - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.yuv_nomul)); - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.tex)); - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.tex_nomul)); - - evas_gl_common_shader_program_shutdown(&(gc->shared->shader.filter_invert)); + for (i = 0; i < SHADER_LAST; ++i) + evas_gl_common_shader_program_shutdown(&(gc->shared->shader[i])); while (gc->shared->images) { @@ -1154,6 +1008,7 @@ array_alloc(Evas_Engine_GL_Context *gc, int n) gc->pipe[n].array.alloc * sizeof(GLfloat) * 2); } +#ifdef GLPIPES static int pipe_region_intersects(Evas_Engine_GL_Context *gc, int n, int x, int y, int w, int h) @@ -1192,6 +1047,7 @@ pipe_region_intersects(Evas_Engine_GL_Context *gc, int n, } return 0; } +#endif static void pipe_region_expand(Evas_Engine_GL_Context *gc, int n, @@ -1234,6 +1090,120 @@ vertex_array_size_check(Evas_Engine_GL_Context *gc, int pn, int n) return 1; } +static inline Evas_GL_Shader +evas_gl_common_shader_choice(int npoints __UNUSED__, + RGBA_Map_Point *p, + int r, int g, int b, int a, + Evas_GL_Shader nomul, + Evas_GL_Shader mul) +{ + if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) + { + if (!p) return nomul; + + if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) && + (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff)) + return nomul; + } + return mul; +} + +static int +_evas_gl_common_context_push(int rtype, + Evas_Engine_GL_Context *gc, + Evas_GL_Texture *tex, + Evas_GL_Texture *texm, + GLuint prog, + int x, int y, int w, int h, + Eina_Bool blend, + Eina_Bool smooth, + Eina_Bool clip, + int cx, int cy, int cw, int ch) +{ + int pn = 0; + +#ifdef GLPIPES + again: +#endif + vertex_array_size_check(gc, gc->state.top_pipe, 6); + pn = gc->state.top_pipe; +#ifdef GLPIPES + if (!((pn == 0) && (gc->pipe[pn].array.num == 0))) + { + int found = 0; + int i; + + for (i = pn; i >= 0; i--) + { + if ((gc->pipe[i].region.type == rtype) + && (!tex || gc->pipe[i].shader.cur_tex == tex->pt->texture) + && (!texm || gc->pipe[i].shader.cur_texm == texm->pt->texture) + && (gc->pipe[i].shader.cur_prog == prog) + && (gc->pipe[i].shader.smooth == smooth) + && (gc->pipe[i].shader.blend == blend) + && (gc->pipe[i].shader.render_op == gc->dc->render_op) + && (gc->pipe[i].shader.clip == clip) + && (!clip || ((gc->pipe[i].shader.cx == cx) + && (gc->pipe[i].shader.cy == cy) + && (gc->pipe[i].shader.cw == cw) + && (gc->pipe[i].shader.ch == ch)))) + { + found = 1; + pn = i; + break; + } + if (pipe_region_intersects(gc, i, x, y, w, h)) break; + } + if (!found) + { + pn = gc->state.top_pipe + 1; + if (pn >= gc->shared->info.tune.pipes.max) + { + shader_array_flush(gc); + goto again; + } + gc->state.top_pipe = pn; + } + } + if ((tex) && (((tex->im) && (tex->im->native.data)) || tex->pt->dyn.img)) + { + if (gc->pipe[pn].array.im != tex->im) + { + shader_array_flush(gc); + pn = gc->state.top_pipe; + gc->pipe[pn].array.im = tex->im; + goto again; + } + } +#else + if (!((gc->pipe[pn].region.type == rtype) + && (!tex || gc->pipe[pn].shader.cur_tex == tex->pt->texture) + && (!texm || gc->pipe[pn].shader.cur_texm == texm->pt->texture) + && (gc->pipe[pn].shader.cur_prog == prog) + && (gc->pipe[pn].shader.smooth == smooth) + && (gc->pipe[pn].shader.blend == blend) + && (gc->pipe[pn].shader.render_op == gc->dc->render_op) + && (gc->pipe[pn].shader.clip == clip) + && (!clip || ((gc->pipe[pn].shader.cx == cx) + && (gc->pipe[pn].shader.cy == cy) + && (gc->pipe[pn].shader.cw == cw) + && (gc->pipe[pn].shader.ch == ch))))) + { + shader_array_flush(gc); + } + if ((tex) && (((tex->im) && (tex->im->native.data)) || tex->pt->dyn.img)) + { + if (gc->pipe[pn].array.im != tex->im) + { + shader_array_flush(gc); + gc->pipe[pn].array.im = tex->im; + } + } +#endif + + return pn; +} + void evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int y2, @@ -1242,7 +1212,7 @@ evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc, { int pnum, nv, nc, nu, nt, i; Eina_Bool blend = 0; - GLuint prog = gc->shared->shader.rect.prog; + GLuint prog = gc->shared->shader[SHADER_RECT].prog; int pn = 0; if (a < 255) blend = 1; @@ -1297,7 +1267,7 @@ evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc, { int pnum, nv, nc, nu, nt, i; Eina_Bool blend = 0; - GLuint prog = gc->shared->shader.rect.prog; + GLuint prog = gc->shared->shader[SHADER_RECT].prog; int pn = 0; if (gc->dc->mask.mask) @@ -1448,7 +1418,7 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc, int pnum, nv, nc, nu, nu2, nt, i; GLfloat tx1, tx2, ty1, ty2; Eina_Bool blend = 1; - GLuint prog = gc->shared->shader.img.prog; + GLuint prog = gc->shared->shader[SHADER_IMG].prog; int pn = 0; if (!tex->alpha) blend = 0; @@ -1462,222 +1432,97 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc, { if (tex->pt->dyn.img) { - if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) - prog = gc->shared->shader.img_nomul.prog; - else - prog = gc->shared->shader.img.prog; + prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, + SHADER_IMG_NOMUL, SHADER_IMG)].prog; } else { - if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) - prog = gc->shared->shader.tex_nomul.prog; - else - prog = gc->shared->shader.tex.prog; + prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, + SHADER_TEX_NOMUL, SHADER_TEX)].prog; } } else { if (tex->gc->shared->info.bgra) { - if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) - prog = gc->shared->shader.img_bgra_nomul.prog; - else - prog = gc->shared->shader.img_bgra.prog; + prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, + SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA)].prog; } else { - if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) - prog = gc->shared->shader.img_nomul.prog; - else - prog = gc->shared->shader.img.prog; + prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, + SHADER_IMG_NOMUL, SHADER_IMG)].prog; } } -again: - vertex_array_size_check(gc, gc->state.top_pipe, 6); - pn = gc->state.top_pipe; -#ifdef GLPIPES - if ((pn == 0) && (gc->pipe[pn].array.num == 0)) + pn = _evas_gl_common_context_push(RTYPE_IMAGE, + gc, tex, NULL, + prog, + x, y, w, h, + blend, + smooth, + 0, 0, 0, 0, 0); + + gc->pipe[pn].region.type = RTYPE_IMAGE; + gc->pipe[pn].shader.cur_tex = tex->pt->texture; + gc->pipe[pn].shader.cur_prog = prog; + gc->pipe[pn].shader.smooth = smooth; + gc->pipe[pn].shader.blend = blend; + gc->pipe[pn].shader.render_op = gc->dc->render_op; + gc->pipe[pn].shader.clip = 0; + gc->pipe[pn].shader.cx = 0; + gc->pipe[pn].shader.cy = 0; + gc->pipe[pn].shader.cw = 0; + gc->pipe[pn].shader.ch = 0; + gc->pipe[pn].array.line = 0; + gc->pipe[pn].array.use_vertex = 1; + // if nomul... dont need this + gc->pipe[pn].array.use_color = 1; + gc->pipe[pn].array.use_texuv = 1; + gc->pipe[pn].array.use_texuv2 = 0; + gc->pipe[pn].array.use_texuv3 = 0; + + pipe_region_expand(gc, pn, x, y, w, h); + + pnum = gc->pipe[pn].array.num; + nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2; + nt = pnum * 4; + gc->pipe[pn].array.num += 6; + array_alloc(gc, pn); + + if ((tex->im) && (tex->im->native.data) && (!tex->im->native.yinvert)) { - gc->pipe[pn].region.type = RTYPE_IMAGE; - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; - gc->pipe[pn].array.line = 0; - gc->pipe[pn].array.use_vertex = 1; - // if nomul... dont need this - gc->pipe[pn].array.use_color = 1; - gc->pipe[pn].array.use_texuv = 1; - gc->pipe[pn].array.use_texuv2 = 0; - gc->pipe[pn].array.use_texuv3 = 0; + tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w; + ty1 = 1.0 - ((double)(tex->y) + sy) / (double)tex->pt->h; + tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w; + ty2 = 1.0 - ((double)(tex->y) + sy + sh) / (double)tex->pt->h; } else { - int found = 0; + tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w; + ty1 = ((double)(tex->y) + sy) / (double)tex->pt->h; + tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w; + ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h; + } - for (i = pn; i >= 0; i--) - { - if ((gc->pipe[i].region.type == RTYPE_IMAGE) - && (gc->pipe[i].shader.cur_tex == tex->pt->texture) - && (gc->pipe[i].shader.cur_prog == prog) - && (gc->pipe[i].shader.smooth == smooth) - && (gc->pipe[i].shader.blend == blend) - && (gc->pipe[i].shader.render_op == gc->dc->render_op) - && (gc->pipe[i].shader.clip == 0) - ) - { - found = 1; - pn = i; - break; - } - if (pipe_region_intersects(gc, i, x, y, w, h)) break; - } - if (!found) - { - pn = gc->state.top_pipe + 1; - if (pn >= gc->shared->info.tune.pipes.max) - { - shader_array_flush(gc); - goto again; - } - gc->state.top_pipe = pn; - gc->pipe[pn].region.type = RTYPE_IMAGE; - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; - gc->pipe[pn].array.line = 0; - gc->pipe[pn].array.use_vertex = 1; - // if nomul... dont need this - gc->pipe[pn].array.use_color = 1; - gc->pipe[pn].array.use_texuv = 1; - gc->pipe[pn].array.use_texuv2 = 0; - gc->pipe[pn].array.use_texuv3 = 0; + PUSH_VERTEX(pn, x , y , 0); + PUSH_VERTEX(pn, x + w, y , 0); + PUSH_VERTEX(pn, x , y + h, 0); - } - } - if ((tex->im) && (tex->im->native.data)) - { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - pn = gc->state.top_pipe; - gc->pipe[pn].array.im = tex->im; - goto again; - } - } - if (tex->pt->dyn.img) - { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - pn = gc->state.top_pipe; - gc->pipe[pn].array.im = tex->im; - goto again; - } - } -#else - if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) - || (gc->pipe[pn].shader.cur_prog != prog) - || (gc->pipe[pn].shader.smooth != smooth) - || (gc->pipe[pn].shader.blend != blend) - || (gc->pipe[pn].shader.render_op != gc->dc->render_op) - || (gc->pipe[pn].shader.clip != 0) - ) - { - shader_array_flush(gc); - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; - } - if ((tex->im) && (tex->im->native.data)) - { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - gc->pipe[pn].array.im = tex->im; - } - } - if (tex->pt->dyn.img) - { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - gc->pipe[pn].array.im = tex->im; - } - } - - gc->pipe[pn].array.line = 0; - gc->pipe[pn].array.use_vertex = 1; - // if nomul... dont need this - gc->pipe[pn].array.use_color = 1; - gc->pipe[pn].array.use_texuv = 1; - gc->pipe[pn].array.use_texuvm = 0; - gc->pipe[pn].array.use_texuv2 = 0; - gc->pipe[pn].array.use_texuv3 = 0; -#endif - - pipe_region_expand(gc, pn, x, y, w, h); - - pnum = gc->pipe[pn].array.num; - nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2; - nt = pnum * 4; - gc->pipe[pn].array.num += 6; - array_alloc(gc, pn); - - if ((tex->im) && (tex->im->native.data) && (!tex->im->native.yinvert)) - { - tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w; - ty1 = 1.0 - ((double)(tex->y) + sy) / (double)tex->pt->h; - tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w; - ty2 = 1.0 - ((double)(tex->y) + sy + sh) / (double)tex->pt->h; - } - else - { - tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w; - ty1 = ((double)(tex->y) + sy) / (double)tex->pt->h; - tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w; - ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h; - } - - PUSH_VERTEX(pn, x , y , 0); - PUSH_VERTEX(pn, x + w, y , 0); - PUSH_VERTEX(pn, x , y + h, 0); - - PUSH_TEXUV(pn, tx1, ty1); - PUSH_TEXUV(pn, tx2, ty1); - PUSH_TEXUV(pn, tx1, ty2); - - PUSH_VERTEX(pn, x + w, y , 0); - PUSH_VERTEX(pn, x + w, y + h, 0); - PUSH_VERTEX(pn, x , y + h, 0); - - PUSH_TEXUV(pn, tx2, ty1); - PUSH_TEXUV(pn, tx2, ty2); - PUSH_TEXUV(pn, tx1, ty2); - - // if nomul... dont need this - for (i = 0; i < 6; i++) + PUSH_TEXUV(pn, tx1, ty1); + PUSH_TEXUV(pn, tx2, ty1); + PUSH_TEXUV(pn, tx1, ty2); + + PUSH_VERTEX(pn, x + w, y , 0); + PUSH_VERTEX(pn, x + w, y + h, 0); + PUSH_VERTEX(pn, x , y + h, 0); + + PUSH_TEXUV(pn, tx2, ty1); + PUSH_TEXUV(pn, tx2, ty2); + PUSH_TEXUV(pn, tx1, ty2); + + // if nomul... dont need this + for (i = 0; i < 6; i++) { PUSH_COLOR(pn, r, g, b, a); } @@ -1697,169 +1542,50 @@ evas_gl_common_context_image_mask_push(Evas_Engine_GL_Context *gc, GLfloat tx1, tx2, ty1, ty2; GLfloat txm1, txm2, tym1, tym2; Eina_Bool blend = 1; - GLuint prog = gc->shared->shader.img_mask.prog; + GLuint prog = gc->shared->shader[SHADER_IMG_MASK].prog; int pn = 0; #if 0 if (tex->gc->shared->info.bgra) { - prog = gc->shared->shader.img_mask.prog; + prog = gc->shared->shader[SHADER_IMG_MASK].prog; } else { #warning Nash: FIXME: Need two shaders? printf("Not good: Need other texture\n"); - prog = gc->shared->shader.img.prog; + prog = gc->shared->shader[SHADER_IMG].prog; } #endif -again: - vertex_array_size_check(gc, gc->state.top_pipe, 6); - pn = gc->state.top_pipe; -#ifdef GLPIPES - if ((pn == 0) && (gc->pipe[pn].array.num == 0)) - { - gc->pipe[pn].region.type = RTYPE_IMASK; - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_texm = texm->pt->texture; - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; - gc->pipe[pn].array.line = 0; - gc->pipe[pn].array.use_vertex = 1; - // if nomul... dont need this - gc->pipe[pn].array.use_color = 1; - gc->pipe[pn].array.use_texuv = 1; - gc->pipe[pn].array.use_texuv2 = 0; - gc->pipe[pn].array.use_texuv3 = 0; - gc->pipe[pn].array.use_texm = 1; - } - else - { - int found = 0; - - for (i = pn; i >= 0; i--) - { - if ((gc->pipe[i].region.type == RTYPE_IMASK) - && (gc->pipe[i].shader.cur_tex == tex->pt->texture) - && (gc->pipe[i].shader.cur_texm == texm->pt->texture) - && (gc->pipe[i].shader.cur_prog == prog) - && (gc->pipe[i].shader.smooth == smooth) - && (gc->pipe[i].shader.blend == blend) - && (gc->pipe[i].shader.render_op == gc->dc->render_op) - && (gc->pipe[i].shader.clip == 0) - ) - { - found = 1; - pn = i; - break; - } - if (pipe_region_intersects(gc, i, x, y, w, h)) break; - } - if (!found) - { - pn = gc->state.top_pipe + 1; - if (pn >= gc->shared->info.tune.pipes.max) - { - shader_array_flush(gc); - goto again; - } - gc->state.top_pipe = pn; - gc->pipe[pn].region.type = RTYPE_IMASK; - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_texm = texm->pt->texture; - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; - gc->pipe[pn].array.line = 0; - gc->pipe[pn].array.use_vertex = 1; - gc->pipe[pn].array.use_color = 1; - gc->pipe[pn].array.use_texuv = 1; - gc->pipe[pn].array.use_texuv2 = 0; - gc->pipe[pn].array.use_texuv3 = 0; - gc->pipe[pn].array.use_texm = 1; - - } - } - if ((tex->im) && (tex->im->native.data)) - { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - pn = gc->state.top_pipe; - gc->pipe[pn].array.im = tex->im; - goto again; - } - } - if (tex->pt->dyn.img) - { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - pn = gc->state.top_pipe; - gc->pipe[pn].array.im = tex->im; - goto again; - } - } -#else - if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) - || (gc->pipe[pn].shader.cur_prog != prog) - || (gc->pipe[pn].shader.smooth != smooth) - || (gc->pipe[pn].shader.blend != blend) - || (gc->pipe[pn].shader.render_op != gc->dc->render_op) - || (gc->pipe[pn].shader.clip != 0) - ) - { - shader_array_flush(gc); - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_texm = texm->pt->texture; - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; - } - if ((tex->im) && (tex->im->native.data)) - { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - gc->pipe[pn].array.im = tex->im; - } - } - if (tex->pt->dyn.img) - { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - gc->pipe[pn].array.im = tex->im; - } - } - + pn = _evas_gl_common_context_push(RTYPE_IMASK, + gc, tex, texm, + prog, + x, y, w, h, + blend, + smooth, + 0, 0, 0, 0, 0); + + gc->pipe[pn].region.type = RTYPE_IMASK; + gc->pipe[pn].shader.cur_tex = tex->pt->texture; + gc->pipe[pn].shader.cur_texm = texm->pt->texture; + gc->pipe[pn].shader.cur_prog = prog; + gc->pipe[pn].shader.smooth = smooth; + gc->pipe[pn].shader.blend = blend; + gc->pipe[pn].shader.render_op = gc->dc->render_op; + gc->pipe[pn].shader.clip = 0; + gc->pipe[pn].shader.cx = 0; + gc->pipe[pn].shader.cy = 0; + gc->pipe[pn].shader.cw = 0; + gc->pipe[pn].shader.ch = 0; gc->pipe[pn].array.line = 0; gc->pipe[pn].array.use_vertex = 1; + // if nomul... dont need this gc->pipe[pn].array.use_color = 1; gc->pipe[pn].array.use_texuv = 1; gc->pipe[pn].array.use_texuv2 = 0; gc->pipe[pn].array.use_texuv3 = 0; gc->pipe[pn].array.use_texm = 1; -#endif pipe_region_expand(gc, pn, x, y, w, h); @@ -1939,111 +1665,34 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc, { int pnum, nv, nc, nu, nt, i; GLfloat tx1, tx2, ty1, ty2; + GLuint prog = gc->shared->shader[SHADER_FONT].prog; int pn = 0; -again: - vertex_array_size_check(gc, gc->state.top_pipe, 6); - pn = gc->state.top_pipe; -#ifdef GLPIPES - if ((pn == 0) && (gc->pipe[pn].array.num == 0)) - { - gc->pipe[pn].region.type = RTYPE_FONT; - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_prog = gc->shared->shader.font.prog; - gc->pipe[pn].shader.smooth = 0; - gc->pipe[pn].shader.blend = 1; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; - gc->pipe[pn].array.line = 0; - gc->pipe[pn].array.use_vertex = 1; - gc->pipe[pn].array.use_color = 1; - gc->pipe[pn].array.use_texuv = 1; - gc->pipe[pn].array.use_texuv2 = 0; - gc->pipe[pn].array.use_texuv3 = 0; - } - else - { - int found = 0; - - for (i = pn; i >= 0; i--) - { - if ((gc->pipe[i].region.type == RTYPE_FONT) - && (gc->pipe[i].shader.cur_tex == tex->pt->texture) - && (gc->pipe[i].shader.cur_prog == gc->shared->shader.font.prog) - && (gc->pipe[i].shader.smooth == 0) - && (gc->pipe[i].shader.blend == 1) - && (gc->pipe[i].shader.render_op == gc->dc->render_op) - && (gc->pipe[i].shader.clip == 0) - ) - { - found = 1; - pn = i; - break; - } - if (pipe_region_intersects(gc, i, x, y, w, h)) break; - } - if (!found) - { - pn = gc->state.top_pipe + 1; - if (pn >= gc->shared->info.tune.pipes.max) - { - shader_array_flush(gc); - goto again; - } - gc->state.top_pipe = pn; - gc->pipe[pn].region.type = RTYPE_FONT; - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_prog = gc->shared->shader.font.prog; - gc->pipe[pn].shader.smooth = 0; - gc->pipe[pn].shader.blend = 1; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; - gc->pipe[pn].array.line = 0; - gc->pipe[pn].array.use_vertex = 1; - gc->pipe[pn].array.use_color = 1; - gc->pipe[pn].array.use_texuv = 1; - gc->pipe[pn].array.use_texuv2 = 0; - gc->pipe[pn].array.use_texuv3 = 0; - } - } -#else - if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) - || (gc->pipe[pn].shader.cur_prog != gc->shared->shader.font.prog) - || (gc->pipe[pn].shader.smooth != 0) - || (gc->pipe[pn].shader.blend != 1) - || (gc->pipe[pn].shader.render_op != gc->dc->render_op) - || (gc->pipe[pn].shader.clip != 0) - ) - { - shader_array_flush(gc); - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_prog = gc->shared->shader.font.prog; - gc->pipe[pn].shader.smooth = 0; - gc->pipe[pn].shader.blend = 1; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; - } + pn = _evas_gl_common_context_push(RTYPE_FONT, + gc, tex, NULL, + prog, + x, y, w, h, + 1, + 0, + 0, 0, 0, 0, 0); gc->pipe[pn].region.type = RTYPE_FONT; + gc->pipe[pn].shader.cur_tex = tex->pt->texture; + gc->pipe[pn].shader.cur_prog = prog; + gc->pipe[pn].shader.smooth = 0; + gc->pipe[pn].shader.blend = 1; + gc->pipe[pn].shader.render_op = gc->dc->render_op; + gc->pipe[pn].shader.clip = 0; + gc->pipe[pn].shader.cx = 0; + gc->pipe[pn].shader.cy = 0; + gc->pipe[pn].shader.cw = 0; + gc->pipe[pn].shader.ch = 0; gc->pipe[pn].array.line = 0; gc->pipe[pn].array.use_vertex = 1; gc->pipe[pn].array.use_color = 1; gc->pipe[pn].array.use_texuv = 1; gc->pipe[pn].array.use_texuv2 = 0; gc->pipe[pn].array.use_texuv3 = 0; -#endif pipe_region_expand(gc, pn, x, y, w, h); @@ -2100,125 +1749,239 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc, int pnum, nv, nc, nu, nu2, nu3, nt, i; GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2; Eina_Bool blend = 0; - GLuint prog = gc->shared->shader.yuv.prog; + GLuint prog; int pn = 0; if (a < 255) blend = 1; - if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) - prog = gc->shared->shader.yuv_nomul.prog; - else - prog = gc->shared->shader.yuv.prog; + prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, + SHADER_YUV_NOMUL, SHADER_YUV)].prog; -again: - vertex_array_size_check(gc, gc->state.top_pipe, 6); - pn = gc->state.top_pipe; -#ifdef GLPIPES - if ((pn == 0) && (gc->pipe[pn].array.num == 0)) + pn = _evas_gl_common_context_push(RTYPE_YUV, + gc, tex, NULL, + prog, + x, y, w, h, + blend, + smooth, + 0, 0, 0, 0, 0); + + gc->pipe[pn].region.type = RTYPE_YUV; + gc->pipe[pn].shader.cur_tex = tex->pt->texture; + gc->pipe[pn].shader.cur_texu = tex->ptu->texture; + gc->pipe[pn].shader.cur_texv = tex->ptv->texture; + gc->pipe[pn].shader.cur_prog = prog; + gc->pipe[pn].shader.smooth = smooth; + gc->pipe[pn].shader.blend = blend; + gc->pipe[pn].shader.render_op = gc->dc->render_op; + gc->pipe[pn].shader.clip = 0; + gc->pipe[pn].shader.cx = 0; + gc->pipe[pn].shader.cy = 0; + gc->pipe[pn].shader.cw = 0; + gc->pipe[pn].shader.ch = 0; + gc->pipe[pn].array.line = 0; + gc->pipe[pn].array.use_vertex = 1; + gc->pipe[pn].array.use_color = 1; + gc->pipe[pn].array.use_texuv = 1; + gc->pipe[pn].array.use_texuv2 = 1; + gc->pipe[pn].array.use_texuv3 = 1; + + pipe_region_expand(gc, pn, x, y, w, h); + + pnum = gc->pipe[pn].array.num; + nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; + nu2 = pnum * 2; nu3 = pnum * 2; nt = pnum * 4; + gc->pipe[pn].array.num += 6; + array_alloc(gc, pn); + + tx1 = (sx) / (double)tex->pt->w; + ty1 = (sy) / (double)tex->pt->h; + tx2 = (sx + sw) / (double)tex->pt->w; + ty2 = (sy + sh) / (double)tex->pt->h; + + t2x1 = ((sx) / 2) / (double)tex->ptu->w; + t2y1 = ((sy) / 2) / (double)tex->ptu->h; + t2x2 = ((sx + sw) / 2) / (double)tex->ptu->w; + t2y2 = ((sy + sh) / 2) / (double)tex->ptu->h; + + PUSH_VERTEX(pn, x , y , 0); + PUSH_VERTEX(pn, x + w, y , 0); + PUSH_VERTEX(pn, x , y + h, 0); + + PUSH_TEXUV(pn, tx1, ty1); + PUSH_TEXUV(pn, tx2, ty1); + PUSH_TEXUV(pn, tx1, ty2); + + PUSH_TEXUV2(pn, t2x1, t2y1); + PUSH_TEXUV2(pn, t2x2, t2y1); + PUSH_TEXUV2(pn, t2x1, t2y2); + + PUSH_TEXUV3(pn, t2x1, t2y1); + PUSH_TEXUV3(pn, t2x2, t2y1); + PUSH_TEXUV3(pn, t2x1, t2y2); + + PUSH_VERTEX(pn, x + w, y , 0); + PUSH_VERTEX(pn, x + w, y + h, 0); + PUSH_VERTEX(pn, x , y + h, 0); + + PUSH_TEXUV(pn, tx2, ty1); + PUSH_TEXUV(pn, tx2, ty2); + PUSH_TEXUV(pn, tx1, ty2); + + PUSH_TEXUV2(pn, t2x2, t2y1); + PUSH_TEXUV2(pn, t2x2, t2y2); + PUSH_TEXUV2(pn, t2x1, t2y2); + + PUSH_TEXUV3(pn, t2x2, t2y1); + PUSH_TEXUV3(pn, t2x2, t2y2); + PUSH_TEXUV3(pn, t2x1, t2y2); + + for (i = 0; i < 6; i++) { - gc->pipe[pn].region.type = RTYPE_YUV; - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_texu = tex->ptu->texture; - gc->pipe[pn].shader.cur_texv = tex->ptv->texture; - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; - gc->pipe[pn].array.line = 0; - gc->pipe[pn].array.use_vertex = 1; - gc->pipe[pn].array.use_color = 1; - gc->pipe[pn].array.use_texuv = 1; - gc->pipe[pn].array.use_texuv2 = 1; - gc->pipe[pn].array.use_texuv3 = 1; + PUSH_COLOR(pn, r, g, b, a); } - else - { - int found = 0; +} + +void +evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc, + Evas_GL_Texture *tex, + double sx, double sy, double sw, double sh, + int x, int y, int w, int h, + int r, int g, int b, int a, + Eina_Bool smooth) +{ + int pnum, nv, nc, nu, nu2, nu3, nt, i; + GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2; + Eina_Bool blend = 0; + GLuint prog; + int pn = 0; + + if (a < 255) blend = 1; + + prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, + SHADER_YUY2_NOMUL, SHADER_YUY2)].prog; + + pn = _evas_gl_common_context_push(RTYPE_YUY2, + gc, tex, NULL, + prog, + x, y, w, h, + blend, + smooth, + 0, 0, 0, 0, 0); + + gc->pipe[pn].region.type = RTYPE_YUY2; + gc->pipe[pn].shader.cur_tex = tex->pt->texture; + gc->pipe[pn].shader.cur_texu = tex->ptuv->texture; + gc->pipe[pn].shader.cur_prog = prog; + gc->pipe[pn].shader.smooth = smooth; + gc->pipe[pn].shader.blend = blend; + gc->pipe[pn].shader.render_op = gc->dc->render_op; + gc->pipe[pn].shader.clip = 0; + gc->pipe[pn].shader.cx = 0; + gc->pipe[pn].shader.cy = 0; + gc->pipe[pn].shader.cw = 0; + gc->pipe[pn].shader.ch = 0; + gc->pipe[pn].array.line = 0; + gc->pipe[pn].array.use_vertex = 1; + gc->pipe[pn].array.use_color = 1; + gc->pipe[pn].array.use_texuv = 1; + gc->pipe[pn].array.use_texuv2 = 1; + gc->pipe[pn].array.use_texuv3 = 0; + + pipe_region_expand(gc, pn, x, y, w, h); + + pnum = gc->pipe[pn].array.num; + nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; + nu2 = pnum * 2; nu3 = pnum * 2; nt = pnum * 4; + gc->pipe[pn].array.num += 6; + array_alloc(gc, pn); + + tx1 = (sx) / (double)tex->pt->w; + ty1 = (sy) / (double)tex->pt->h; + tx2 = (sx + sw) / (double)tex->pt->w; + ty2 = (sy + sh) / (double)tex->pt->h; + + t2x1 = sx / (double)tex->ptuv->w; + t2y1 = sy / (double)tex->ptuv->h; + t2x2 = (sx + sw) / (double)tex->ptuv->w; + t2y2 = (sy + sh) / (double)tex->ptuv->h; + + PUSH_VERTEX(pn, x , y , 0); + PUSH_VERTEX(pn, x + w, y , 0); + PUSH_VERTEX(pn, x , y + h, 0); + + PUSH_TEXUV(pn, tx1, ty1); + PUSH_TEXUV(pn, tx2, ty1); + PUSH_TEXUV(pn, tx1, ty2); + + PUSH_TEXUV2(pn, t2x1, t2y1); + PUSH_TEXUV2(pn, t2x2, t2y1); + PUSH_TEXUV2(pn, t2x1, t2y2); + + PUSH_VERTEX(pn, x + w, y , 0); + PUSH_VERTEX(pn, x + w, y + h, 0); + PUSH_VERTEX(pn, x , y + h, 0); + + PUSH_TEXUV(pn, tx2, ty1); + PUSH_TEXUV(pn, tx2, ty2); + PUSH_TEXUV(pn, tx1, ty2); + + PUSH_TEXUV2(pn, t2x2, t2y1); + PUSH_TEXUV2(pn, t2x2, t2y2); + PUSH_TEXUV2(pn, t2x1, t2y2); - for (i = pn; i >= 0; i--) - { - if ((gc->pipe[i].region.type == RTYPE_YUV) - && (gc->pipe[i].shader.cur_tex == tex->pt->texture) - && (gc->pipe[i].shader.cur_prog == gc->shared->shader.font.prog) - && (gc->pipe[i].shader.smooth == smooth) - && (gc->pipe[i].shader.blend == blend) - && (gc->pipe[i].shader.render_op == gc->dc->render_op) - && (gc->pipe[i].shader.clip == 0) - ) - { - found = 1; - pn = i; - break; - } - if (pipe_region_intersects(gc, i, x, y, w, h)) break; - } - if (!found) - { - pn = gc->state.top_pipe + 1; - if (pn >= gc->shared->info.tune.pipes.max) - { - shader_array_flush(gc); - goto again; - } - gc->state.top_pipe = pn; - gc->pipe[pn].region.type = RTYPE_YUV; - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_texu = tex->ptu->texture; - gc->pipe[pn].shader.cur_texv = tex->ptv->texture; - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; - gc->pipe[pn].array.line = 0; - gc->pipe[pn].array.use_vertex = 1; - gc->pipe[pn].array.use_color = 1; - gc->pipe[pn].array.use_texuv = 1; - gc->pipe[pn].array.use_texuv2 = 1; - gc->pipe[pn].array.use_texuv3 = 1; - } - } -#else - if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) - || (gc->pipe[pn].shader.cur_prog != prog) - || (gc->pipe[pn].shader.smooth != smooth) - || (gc->pipe[pn].shader.blend != blend) - || (gc->pipe[pn].shader.render_op != gc->dc->render_op) - || (gc->pipe[pn].shader.clip != 0) - ) + for (i = 0; i < 6; i++) { - shader_array_flush(gc); - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_texu = tex->ptu->texture; - gc->pipe[pn].shader.cur_texv = tex->ptv->texture; - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = 0; - gc->pipe[pn].shader.cx = 0; - gc->pipe[pn].shader.cy = 0; - gc->pipe[pn].shader.cw = 0; - gc->pipe[pn].shader.ch = 0; + PUSH_COLOR(pn, r, g, b, a); } +} - gc->pipe[pn].region.type = RTYPE_YUV; +void +evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc, + Evas_GL_Texture *tex, + double sx, double sy, double sw, double sh, + int x, int y, int w, int h, + int r, int g, int b, int a, + Eina_Bool smooth) +{ + int pnum, nv, nc, nu, nu2, nu3, nt, i; + GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2; + Eina_Bool blend = 0; + GLuint prog; + int pn = 0; + + if (a < 255) blend = 1; + + prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, + SHADER_NV12_NOMUL, SHADER_NV12)].prog; + + pn = _evas_gl_common_context_push(RTYPE_NV12, + gc, tex, NULL, + prog, + x, y, w, h, + blend, + smooth, + 0, 0, 0, 0, 0); + + gc->pipe[pn].region.type = RTYPE_NV12; + gc->pipe[pn].shader.cur_tex = tex->pt->texture; + gc->pipe[pn].shader.cur_tex_dyn = tex->pt->dyn.img; + gc->pipe[pn].shader.cur_texu = tex->ptuv->texture; + gc->pipe[pn].shader.cur_texu_dyn = tex->ptuv->dyn.img; + gc->pipe[pn].shader.cur_prog = prog; + gc->pipe[pn].shader.smooth = smooth; + gc->pipe[pn].shader.blend = blend; + gc->pipe[pn].shader.render_op = gc->dc->render_op; + gc->pipe[pn].shader.clip = 0; + gc->pipe[pn].shader.cx = 0; + gc->pipe[pn].shader.cy = 0; + gc->pipe[pn].shader.cw = 0; + gc->pipe[pn].shader.ch = 0; gc->pipe[pn].array.line = 0; gc->pipe[pn].array.use_vertex = 1; gc->pipe[pn].array.use_color = 1; gc->pipe[pn].array.use_texuv = 1; gc->pipe[pn].array.use_texuv2 = 1; - gc->pipe[pn].array.use_texuv3 = 1; -#endif + gc->pipe[pn].array.use_texuv3 = 0; pipe_region_expand(gc, pn, x, y, w, h); @@ -2233,10 +1996,10 @@ again: tx2 = (sx + sw) / (double)tex->pt->w; ty2 = (sy + sh) / (double)tex->pt->h; - t2x1 = ((sx) / 2) / (double)tex->ptu->w; - t2y1 = ((sy) / 2) / (double)tex->ptu->h; - t2x2 = ((sx + sw) / 2) / (double)tex->ptu->w; - t2y2 = ((sy + sh) / 2) / (double)tex->ptu->h; + t2x1 = sx / (double)tex->ptuv->w; + t2y1 = sy / (double)tex->ptuv->h; + t2x2 = (sx + sw) / (double)tex->ptuv->w; + t2y2 = (sy + sh) / (double)tex->ptuv->h; PUSH_VERTEX(pn, x , y , 0); PUSH_VERTEX(pn, x + w, y , 0); @@ -2250,10 +2013,6 @@ again: PUSH_TEXUV2(pn, t2x2, t2y1); PUSH_TEXUV2(pn, t2x1, t2y2); - PUSH_TEXUV3(pn, t2x1, t2y1); - PUSH_TEXUV3(pn, t2x2, t2y1); - PUSH_TEXUV3(pn, t2x1, t2y2); - PUSH_VERTEX(pn, x + w, y , 0); PUSH_VERTEX(pn, x + w, y + h, 0); PUSH_VERTEX(pn, x , y + h, 0); @@ -2266,10 +2025,6 @@ again: PUSH_TEXUV2(pn, t2x2, t2y2); PUSH_TEXUV2(pn, t2x1, t2y2); - PUSH_TEXUV3(pn, t2x2, t2y1); - PUSH_TEXUV3(pn, t2x2, t2y2); - PUSH_TEXUV3(pn, t2x1, t2y2); - for (i = 0; i < 6; i++) { PUSH_COLOR(pn, r, g, b, a); @@ -2283,8 +2038,8 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, RGBA_Map_Point *p, int clip, int cx, int cy, int cw, int ch, int r, int g, int b, int a, - Eina_Bool smooth, Eina_Bool tex_only, - Eina_Bool yuv) + Eina_Bool smooth, Eina_Bool tex_only, + Evas_Colorspace cspace) { int pnum, nv, nc, nu, nu2, nu3, nt, i; const int points[6] = { 0, 1, 2, 0, 2, 3 }; @@ -2292,7 +2047,9 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, GLfloat tx[4], ty[4], t2x[4], t2y[4]; Eina_Bool blend = 1; DATA32 cmul; - GLuint prog = gc->shared->shader.img.prog; + GLuint prog = gc->shared->shader[SHADER_IMG].prog; + Eina_Bool utexture = EINA_FALSE; + Eina_Bool uvtexture = EINA_FALSE; int pn = 0; int flat = 0; @@ -2317,80 +2074,56 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, { if (p[0].foc <= 0) flat = 1; } - if (yuv) - { - prog = gc->shared->shader.yuv.prog; - if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) - { - if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) && - (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff)) - prog = gc->shared->shader.yuv_nomul.prog; - else - prog = gc->shared->shader.yuv.prog; - } - else - prog = gc->shared->shader.yuv.prog; - } - else - { - if (tex_only) - { - if (tex->pt->dyn.img) - { - if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) - { - if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) && - (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff)) - prog = gc->shared->shader.img_nomul.prog; - else - prog = gc->shared->shader.img.prog; - } - else - prog = gc->shared->shader.img.prog; - } - else - { - if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) - { - if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) && - (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff)) - prog = gc->shared->shader.tex_nomul.prog; - else - prog = gc->shared->shader.tex.prog; - } - else - prog = gc->shared->shader.tex.prog; - } - } - else - { - if (tex->gc->shared->info.bgra) - { - if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) - { - if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) && - (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff)) - prog = gc->shared->shader.img_bgra_nomul.prog; - else - prog = gc->shared->shader.img_bgra.prog; - } - else - prog = gc->shared->shader.img_bgra.prog; - } + + switch (cspace) + { + case EVAS_COLORSPACE_YCBCR422P601_PL: + case EVAS_COLORSPACE_YCBCR422P709_PL: + prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, + SHADER_YUV_NOMUL, SHADER_YUV)].prog; + utexture = EINA_TRUE; + break; + case EVAS_COLORSPACE_YCBCR422601_PL: + prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, + SHADER_YUY2_NOMUL, SHADER_YUY2)].prog; + uvtexture = EINA_TRUE; + break; + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: + prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, + SHADER_NV12_NOMUL, SHADER_NV12)].prog; + uvtexture = EINA_TRUE; + break; + + default: + if (tex_only) + { + if (tex->pt->dyn.img) + { + prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, + SHADER_IMG_NOMUL, SHADER_IMG)].prog; + } + else + { + prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, + SHADER_TEX_NOMUL, SHADER_TEX)].prog; + } + } + else + { + if (tex->gc->shared->info.bgra) + { + prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, + SHADER_IMG_BGRA_NOMUL, + SHADER_IMG_BGRA)].prog; + } else { - if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) - { - if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) && - (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff)) - prog = gc->shared->shader.img_nomul.prog; - else - prog = gc->shared->shader.img.prog; - } - else - prog = gc->shared->shader.img.prog; + prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a, + SHADER_IMG_NOMUL, + SHADER_IMG)].prog; } - } + } } x = w = (p[points[0]].x >> FP); @@ -2407,11 +2140,16 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, py = (p[points[i]].y >> FP); if (py < y) y = py; else if (py > h) h = py; - if (yuv) + if (utexture) { t2x[i] = ((((double)p[i].u / 2) / FP1)) / (double)tex->ptu->w; t2y[i] = ((((double)p[i].v / 2) / FP1)) / (double)tex->ptu->h; } + else if (uvtexture) + { + t2x[i] = ((((double)p[i].u / 2) / FP1)) / (double)tex->ptuv->w; + t2y[i] = ((((double)p[i].v / 2) / FP1)) / (double)tex->ptuv->h; + } } w = w - x; h = h - y; @@ -2438,187 +2176,44 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc, gc->change.size = 1; _evas_gl_common_viewport_set(gc); } -again: - vertex_array_size_check(gc, gc->state.top_pipe, 6); - pn = gc->state.top_pipe; -#ifdef GLPIPES - if ((pn == 0) && (gc->pipe[pn].array.num == 0)) - { - gc->pipe[pn].region.type = RTYPE_MAP; - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - if (yuv) - { - gc->pipe[pn].shader.cur_texu = tex->ptu->texture; - gc->pipe[pn].shader.cur_texv = tex->ptv->texture; - } - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = clip; - gc->pipe[pn].shader.cx = cx; - gc->pipe[pn].shader.cy = cy; - gc->pipe[pn].shader.cw = cw; - gc->pipe[pn].shader.ch = ch; - gc->pipe[pn].array.line = 0; - gc->pipe[pn].array.use_vertex = 1; - gc->pipe[pn].array.use_color = 1; - gc->pipe[pn].array.use_texuv = 1; - if (yuv) - { - gc->pipe[pn].array.use_texuv2 = 1; - gc->pipe[pn].array.use_texuv3 = 1; - } - else - { - gc->pipe[pn].array.use_texuv2 = 0; - gc->pipe[pn].array.use_texuv3 = 0; - } - } - else - { - int found = 0; - for (i = pn; i >= 0; i--) - { - if ((gc->pipe[i].region.type == RTYPE_MAP) - && (gc->pipe[i].shader.cur_tex == tex->pt->texture) - && (gc->pipe[i].shader.cur_prog == prog) - && (gc->pipe[i].shader.smooth == smooth) - && (gc->pipe[i].shader.blend == blend) - && (gc->pipe[i].shader.render_op == gc->dc->render_op) - && (gc->pipe[i].shader.clip == clip) - && (gc->pipe[i].shader.cx == cx) - && (gc->pipe[i].shader.cy == cy) - && (gc->pipe[i].shader.cw == cw) - && (gc->pipe[i].shader.ch == ch) - ) - { - found = 1; - pn = i; - break; - } - if (pipe_region_intersects(gc, i, x, y, w, h)) break; - } - if (!found) - { - pn = gc->state.top_pipe + 1; - if (pn >= gc->shared->info.tune.pipes.max) - { - shader_array_flush(gc); - goto again; - } - gc->state.top_pipe = pn; - gc->pipe[pn].region.type = RTYPE_MAP; - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - if (yuv) - { - gc->pipe[pn].shader.cur_texu = tex->ptu->texture; - gc->pipe[pn].shader.cur_texv = tex->ptv->texture; - } - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = clip; - gc->pipe[pn].shader.cx = cx; - gc->pipe[pn].shader.cy = cy; - gc->pipe[pn].shader.cw = cw; - gc->pipe[pn].shader.ch = ch; - gc->pipe[pn].array.line = 0; - gc->pipe[pn].array.use_vertex = 1; - gc->pipe[pn].array.use_color = 1; - gc->pipe[pn].array.use_texuv = 1; - if (yuv) - { - gc->pipe[pn].array.use_texuv2 = 1; - gc->pipe[pn].array.use_texuv3 = 1; - } - else - { - gc->pipe[pn].array.use_texuv2 = 0; - gc->pipe[pn].array.use_texuv3 = 0; - } - } - } - if ((tex->im) && (tex->im->native.data)) - { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - pn = gc->state.top_pipe; - gc->pipe[pn].array.im = tex->im; - goto again; - } - } - if (tex->pt->dyn.img) - { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - pn = gc->state.top_pipe; - gc->pipe[pn].array.im = tex->im; - goto again; - } - } -#else - if ((gc->pipe[pn].shader.cur_tex != tex->pt->texture) - || (gc->pipe[pn].shader.cur_prog != prog) - || (gc->pipe[pn].shader.smooth != smooth) - || (gc->pipe[pn].shader.blend != blend) - || (gc->pipe[pn].shader.render_op != gc->dc->render_op) - || (gc->pipe[pn].shader.clip != clip) - || (gc->pipe[pn].shader.cx != cx) - || (gc->pipe[pn].shader.cy != cy) - || (gc->pipe[pn].shader.cw != cw) - || (gc->pipe[pn].shader.ch != ch) - ) - { - shader_array_flush(gc); - gc->pipe[pn].shader.cur_tex = tex->pt->texture; - gc->pipe[pn].shader.cur_prog = prog; - gc->pipe[pn].shader.smooth = smooth; - gc->pipe[pn].shader.blend = blend; - gc->pipe[pn].shader.render_op = gc->dc->render_op; - gc->pipe[pn].shader.clip = clip; - gc->pipe[pn].shader.cx = cx; - gc->pipe[pn].shader.cy = cy; - gc->pipe[pn].shader.cw = cw; - gc->pipe[pn].shader.ch = ch; - } - if ((tex->im) && (tex->im->native.data)) + pn = _evas_gl_common_context_push(RTYPE_MAP, + gc, tex, NULL, + prog, + x, y, w, h, + blend, + smooth, + clip, cx, cy, cw, ch); + + gc->pipe[pn].region.type = RTYPE_MAP; + gc->pipe[pn].shader.cur_tex = tex->pt->texture; + if (utexture) { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - gc->pipe[pn].array.im = tex->im; - } + gc->pipe[pn].shader.cur_texu = tex->ptu->texture; + gc->pipe[pn].shader.cur_texu_dyn = tex->ptu->dyn.img; + gc->pipe[pn].shader.cur_texv = tex->ptv->texture; + gc->pipe[pn].shader.cur_texv_dyn = tex->ptv->dyn.img; } - if (tex->pt->dyn.img) + else if (uvtexture) { - if (gc->pipe[pn].array.im != tex->im) - { - shader_array_flush(gc); - gc->pipe[pn].array.im = tex->im; - } + gc->pipe[pn].shader.cur_texu = tex->ptuv->texture; + gc->pipe[pn].shader.cur_texu_dyn = tex->ptuv->dyn.img; } - - gc->pipe[pn].region.type = RTYPE_MAP; + gc->pipe[pn].shader.cur_prog = prog; + gc->pipe[pn].shader.smooth = smooth; + gc->pipe[pn].shader.blend = blend; + gc->pipe[pn].shader.render_op = gc->dc->render_op; + gc->pipe[pn].shader.clip = clip; + gc->pipe[pn].shader.cx = cx; + gc->pipe[pn].shader.cy = cy; + gc->pipe[pn].shader.cw = cw; + gc->pipe[pn].shader.ch = ch; gc->pipe[pn].array.line = 0; gc->pipe[pn].array.use_vertex = 1; gc->pipe[pn].array.use_color = 1; gc->pipe[pn].array.use_texuv = 1; - if (yuv) - { - gc->pipe[pn].array.use_texuv2 = 1; - gc->pipe[pn].array.use_texuv3 = 1; - } - else - { - gc->pipe[pn].array.use_texuv2 = 0; - gc->pipe[pn].array.use_texuv3 = 0; - } -#endif + gc->pipe[pn].array.use_texuv2 = (utexture || uvtexture) ? 1 : 0; + gc->pipe[pn].array.use_texuv3 = (utexture) ? 1 : 0; pipe_region_expand(gc, pn, x, y, w, h); @@ -2633,7 +2228,7 @@ again: for (i = 0; i < 4; i++) { ty[i] = 1.0 - ty[i]; - if (yuv) + if (utexture || uvtexture) t2y[i] = 1.0 - t2y[i]; } } @@ -2660,7 +2255,7 @@ again: PUSH_TEXUV(pn, tx[points[i]], ty[points[i]]); - if (yuv) + if (utexture) { PUSH_TEXUV2(pn, t2x[points[i]], @@ -2669,6 +2264,12 @@ again: t2x[points[i]], t2y[points[i]]); } + else if (uvtexture) + { + PUSH_TEXUV2(pn, + t2x[points[i]], + t2y[points[i]]); + } PUSH_COLOR(pn, R_VAL(&cl), @@ -2970,14 +2571,24 @@ shader_array_flush(Evas_Engine_GL_Context *gc) GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_TEXUV3, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv3); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glActiveTexture(GL_TEXTURE1); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + if (gc->pipe[i].shader.cur_texu_dyn) + secsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu_dyn); +#endif + glActiveTexture(GL_TEXTURE2); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + if (gc->pipe[i].shader.cur_texv_dyn) + secsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv_dyn); +#endif glActiveTexture(GL_TEXTURE0); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } @@ -2987,9 +2598,15 @@ shader_array_flush(Evas_Engine_GL_Context *gc) GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv2); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glActiveTexture(GL_TEXTURE1); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + if (gc->pipe[i].shader.cur_texu_dyn) + secsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu_dyn); +#endif glActiveTexture(GL_TEXTURE0); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } diff --git a/src/modules/engines/gl_common/evas_gl_font.c b/src/modules/engines/gl_common/evas_gl_font.c index 7c3dd6c..e5f3a4a 100644 --- a/src/modules/engines/gl_common/evas_gl_font.c +++ b/src/modules/engines/gl_common/evas_gl_font.c @@ -119,9 +119,9 @@ evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_co g = (dc->col.col >> 8 ) & 0xff; b = (dc->col.col ) & 0xff; sx = 0; sy = 0; sw = tex->w, sh = tex->h; - if ((!gc->dc->cutout.rects) -// || (gc->dc->cutout.active > 32) - ) + if ((!gc->dc->cutout.rects) || + ((gc->shared->info.tune.cutout.max > 0) && + (gc->dc->cutout.active > gc->shared->info.tune.cutout.max))) { if (gc->dc->clip.use) { diff --git a/src/modules/engines/gl_common/evas_gl_image.c b/src/modules/engines/gl_common/evas_gl_image.c index 726ba0f..07eba7b 100644 --- a/src/modules/engines/gl_common/evas_gl_image.c +++ b/src/modules/engines/gl_common/evas_gl_image.c @@ -266,6 +266,9 @@ evas_gl_common_image_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned in break; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: + case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: // if (im->tex) evas_gl_common_texture_free(im->tex); im->tex = NULL; im->cs.no_free = 0; @@ -561,9 +564,60 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im) } if (!im->tex) return; break; + case EVAS_COLORSPACE_YCBCR422601_PL: + if ((im->tex) && (im->dirty)) + { + evas_gl_common_texture_yuy2_update(im->tex, im->cs.data, + im->im->cache_entry.w, + im->im->cache_entry.h); + im->dirty = 0; + } + if ((!im->tex) && (im->cs.data) && (*((unsigned char **)im->cs.data))) + { + im->tex = evas_gl_common_texture_yuy2_new(gc, im->cs.data, + im->im->cache_entry.w, + im->im->cache_entry.h); + im->dirty = 0; + } + if (!im->tex) return; + break; + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + if ((im->tex) && (im->dirty)) + { + evas_gl_common_texture_nv12_update(im->tex, im->cs.data, + im->im->cache_entry.w, + im->im->cache_entry.h); + im->dirty = 0; + } + if ((!im->tex) && (im->cs.data) && (*((unsigned char **)im->cs.data))) + { + im->tex = evas_gl_common_texture_nv12_new(gc, im->cs.data, + im->im->cache_entry.w, + im->im->cache_entry.h); + im->dirty = 0; + } + if (!im->tex) return; + break; + case EVAS_COLORSPACE_YCBCR420TM12601_PL: + if ((im->tex) && (im->dirty)) + { + evas_gl_common_texture_nv12tiled_update(im->tex, im->cs.data, + im->im->cache_entry.w, + im->im->cache_entry.h); + im->dirty = 0; + } + if ((!im->tex) && (im->cs.data) && (*((unsigned char **)im->cs.data))) + { + im->tex = evas_gl_common_texture_nv12tiled_new(gc, im->cs.data, + im->im->cache_entry.w, + im->im->cache_entry.h); + im->dirty = 0; + } + if (!im->tex) return; + break; default: - ERR("unhandled img format colorspace=%d", im->cs.space); - break; + ERR("unhandled img format colorspace=%d", im->cs.space); + break; } } @@ -574,7 +628,6 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, RGBA_Draw_Context *dc; int r, g, b, a; int c, cx, cy, cw, ch; - Eina_Bool yuv = 0; dc = gc->dc; if (dc->mul.use) @@ -595,13 +648,11 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; im->tex->im = im; - if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) || - (im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL)) - yuv = 1; + evas_gl_common_context_image_map_push(gc, im->tex, npoints, p, c, cx, cy, cw, ch, r, g, b, a, smooth, im->tex_only, - yuv); + im->cs.space); } void @@ -617,6 +668,8 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, int c, cx, cy, cw, ch; int i; int yuv = 0; + int yuy2 = 0; + int nv12 = 0; if (sw < 1) sw = 1; if (sh < 1) sh = 1; @@ -649,6 +702,11 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) || (im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL)) yuv = 1; + if (im->cs.space == EVAS_COLORSPACE_YCBCR422601_PL) + yuy2 = 1; + if ((im->cs.space == EVAS_COLORSPACE_YCBCR420NV12601_PL) || + (im->cs.space == EVAS_COLORSPACE_YCBCR420TM12601_PL)) + nv12 = 1; im->tex->im = im; if (imm) imm->tex->im = imm; @@ -675,7 +733,22 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, dx, dy, dw, dh, r, g, b, a, smooth); + else if (yuy2) + evas_gl_common_context_yuy2_push(gc, + im->tex, + sx, sy, sw, sh, + dx, dy, dw, dh, + r, g, b, a, + smooth); + else if (nv12) + evas_gl_common_context_nv12_push(gc, + im->tex, + sx, sy, sw, sh, + dx, dy, dw, dh, + r, g, b, a, + smooth); else + evas_gl_common_context_image_push(gc, im->tex, sx, sy, sw, sh, @@ -717,6 +790,20 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, nx, ny, nw, nh, r, g, b, a, smooth); + else if (yuy2) + evas_gl_common_context_yuy2_push(gc, + im->tex, + ssx, ssy, ssw, ssh, + nx, ny, nw, nh, + r, g, b, a, + smooth); + else if (nv12) + evas_gl_common_context_nv12_push(gc, + im->tex, + ssx, ssy, ssw, ssh, + nx, ny, nw, nh, + r, g, b, a, + smooth); else evas_gl_common_context_image_push(gc, im->tex, @@ -734,6 +821,20 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, dx, dy, dw, dh, r, g, b, a, smooth); + else if (yuy2) + evas_gl_common_context_yuy2_push(gc, + im->tex, + sx, sy, sw, sh, + dx, dy, dw, dh, + r, g, b, a, + smooth); + else if (nv12) + evas_gl_common_context_nv12_push(gc, + im->tex, + sx, sy, sw, sh, + dx, dy, dw, dh, + r, g, b, a, + smooth); else evas_gl_common_context_image_push(gc, im->tex, @@ -773,6 +874,20 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, dx, dy, dw, dh, r, g, b, a, smooth); + else if (yuy2) + evas_gl_common_context_yuy2_push(gc, + im->tex, + sx, sy, sw, sh, + dx, dy, dw, dh, + r, g, b, a, + smooth); + else if (nv12) + evas_gl_common_context_nv12_push(gc, + im->tex, + sx, sy, sw, sh, + dx, dy, dw, dh, + r, g, b, a, + smooth); else evas_gl_common_context_image_push(gc, im->tex, @@ -793,6 +908,20 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, nx, ny, nw, nh, r, g, b, a, smooth); + else if (yuy2) + evas_gl_common_context_yuy2_push(gc, + im->tex, + ssx, ssy, ssw, ssh, + nx, ny, nw, nh, + r, g, b, a, + smooth); + else if (nv12) + evas_gl_common_context_nv12_push(gc, + im->tex, + ssx, ssy, ssw, ssh, + nx, ny, nw, nh, + r, g, b, a, + smooth); else evas_gl_common_context_image_push(gc, im->tex, diff --git a/src/modules/engines/gl_common/evas_gl_shader.c b/src/modules/engines/gl_common/evas_gl_shader.c index 2d5efff..5903a17 100644 --- a/src/modules/engines/gl_common/evas_gl_shader.c +++ b/src/modules/engines/gl_common/evas_gl_shader.c @@ -122,6 +122,165 @@ Evas_GL_Program_Source shader_yuv_vert_src = ///////////////////////////////////////////// #if defined (GLES_VARIETY_S3C6410) +const unsigned int yuy2_frag_bin[] = +{ +# include "shader/yuy2_frag_bin_s3c6410.h" +}; +#endif + +const char yuy2_frag_glsl[] = +#include "shader/yuy2_frag.h" + ; +Evas_GL_Program_Source shader_yuy2_frag_src = +{ + yuy2_frag_glsl, +#if defined (GLES_VARIETY_S3C6410) + yuy2_frag_bin, sizeof(yuy2_frag_bin) +#else + NULL, 0 +#endif +}; + +#if defined (GLES_VARIETY_S3C6410) +const unsigned int yuy2_vert_bin[] = +{ +# include "shader/yuy2_vert_bin_s3c6410.h" +}; +#endif +const char yuy2_vert_glsl[] = +#include "shader/yuy2_vert.h" + ; +Evas_GL_Program_Source shader_yuy2_vert_src = +{ + yuy2_vert_glsl, +#if defined (GLES_VARIETY_S3C6410) + yuy2_vert_bin, sizeof(yuy2_vert_bin) +#else + NULL, 0 +#endif +}; + +///////////////////////////////////////////// +#if defined (GLES_VARIETY_S3C6410) +const unsigned int yuy2_nomul_frag_bin[] = +{ +# include "shader/yuy2_nomul_frag_bin_s3c6410.h" +}; +#endif + +const char yuy2_nomul_frag_glsl[] = +#include "shader/yuy2_nomul_frag.h" + ; +Evas_GL_Program_Source shader_yuy2_nomul_frag_src = +{ + yuy2_nomul_frag_glsl, +#if defined (GLES_VARIETY_S3C6410) + yuy2_nomul_frag_bin, sizeof(yuy2_nomul_frag_bin) +#else + NULL, 0 +#endif +}; + +#if defined (GLES_VARIETY_S3C6410) +const unsigned int yuy2_nomul_vert_bin[] = +{ +# include "shader/yuy2_nomul_vert_bin_s3c6410.h" +}; +#endif +const char yuy2_nomul_vert_glsl[] = +#include "shader/yuy2_nomul_vert.h" + ; +Evas_GL_Program_Source shader_yuy2_nomul_vert_src = +{ + yuy2_nomul_vert_glsl, +#if defined (GLES_VARIETY_S3C6410) + yuy2_nomul_vert_bin, sizeof(yuy2_nomul_vert_bin) +#else + NULL, 0 +#endif +}; + +///////////////////////////////////////////// +#if defined (GLES_VARIETY_S3C6410) +const unsigned int nv12_nomul_vert_bin[] = +{ +# include "shader/nv12_nomul_vert_bin_s3c6410.h" +}; +#endif +const char nv12_nomul_vert_glsl[] = +#include "shader/nv12_nomul_vert.h" + ; +Evas_GL_Program_Source shader_nv12_nomul_vert_src = +{ + nv12_nomul_vert_glsl, +#if defined (GLES_VARIETY_S3C6410) + nv12_nomul_vert_bin, sizeof(nv12_nomul_vert_bin) +#else + NULL, 0 +#endif +}; + +#if defined (GLES_VARIETY_S3C6410) +const unsigned int nv12_vert_bin[] = +{ +# include "shader/nv12_vert_bin_s3c6410.h" +}; +#endif +const char nv12_vert_glsl[] = +#include "shader/nv12_vert.h" + ; +Evas_GL_Program_Source shader_nv12_vert_src = +{ + nv12_vert_glsl, +#if defined (GLES_VARIETY_S3C6410) + nv12_vert_bin, sizeof(nv12_vert_bin) +#else + NULL, 0 +#endif +}; + +#if defined (GLES_VARIETY_S3C6410) +const unsigned int nv12_nomul_frag_bin[] = +{ +# include "shader/nv12_nomul_frag_bin_s3c6410.h" +}; +#endif + +const char nv12_frag_glsl[] = +#include "shader/nv12_frag.h" + ; +Evas_GL_Program_Source shader_nv12_frag_src = +{ + nv12_frag_glsl, +#if defined (GLES_VARIETY_S3C6410) + nv12_frag_bin, sizeof(nv12_frag_bin) +#else + NULL, 0 +#endif +}; + +#if defined (GLES_VARIETY_S3C6410) +const unsigned int nv12_nomul_frag_bin[] = +{ +# include "shader/nv12_nomul_frag_bin_s3c6410.h" +}; +#endif + +const char nv12_nomul_frag_glsl[] = +#include "shader/nv12_nomul_frag.h" + ; +Evas_GL_Program_Source shader_nv12_nomul_frag_src = +{ + nv12_nomul_frag_glsl, +#if defined (GLES_VARIETY_S3C6410) + nv12_nomul_frag_bin, sizeof(nv12_nomul_frag_bin) +#else + NULL, 0 +#endif +}; + +///////////////////////////////////////////// +#if defined (GLES_VARIETY_S3C6410) const unsigned int yuv_nomul_frag_bin[] = { # include "shader/yuv_nomul_frag_bin_s3c6410.h" @@ -935,123 +1094,63 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p, return 1; } +#define SHADER_SOURCE_LINE(Big, Small) \ + { SHADER_##Big, &(shader_##Small##_vert_src), &(shader_##Small##_frag_src), #Small } + +#define SHADER_SOURCE_FILTER_LINE(Big, Small) \ + { SHADER_##Big, &(shader_img_vert_src), &(shader_##Small##_frag_src), #Small } + +static const struct { + Evas_GL_Shader id; + Evas_GL_Program_Source *vert; + Evas_GL_Program_Source *frag; + const char *name; +} _shaders_source[] = { + SHADER_SOURCE_LINE(RECT, rect), + SHADER_SOURCE_LINE(FONT, font), + SHADER_SOURCE_LINE(IMG, img), + SHADER_SOURCE_LINE(IMG_NOMUL, img_nomul), + SHADER_SOURCE_LINE(IMG_BGRA, img_bgra), + SHADER_SOURCE_LINE(IMG_BGRA_NOMUL, img_bgra_nomul), + SHADER_SOURCE_LINE(IMG_MASK, img_mask), + SHADER_SOURCE_LINE(YUV, yuv), + SHADER_SOURCE_LINE(YUV_NOMUL, yuv_nomul), + SHADER_SOURCE_LINE(YUY2, yuy2), + SHADER_SOURCE_LINE(YUY2_NOMUL, yuy2_nomul), + SHADER_SOURCE_LINE(NV12, nv12), + SHADER_SOURCE_LINE(NV12_NOMUL, nv12_nomul), + SHADER_SOURCE_LINE(TEX, tex), + SHADER_SOURCE_LINE(TEX_NOMUL, tex_nomul), + /* Most of the filters use the image fragment shader */ + SHADER_SOURCE_FILTER_LINE(FILTER_INVERT, filter_invert), + SHADER_SOURCE_FILTER_LINE(FILTER_INVERT_NOMUL, filter_invert_nomul), + SHADER_SOURCE_FILTER_LINE(FILTER_INVERT_BGRA, filter_invert_bgra), + SHADER_SOURCE_FILTER_LINE(FILTER_INVERT_BGRA_NOMUL, filter_invert_bgra_nomul), + SHADER_SOURCE_FILTER_LINE(FILTER_GREYSCALE, filter_greyscale), + SHADER_SOURCE_FILTER_LINE(FILTER_GREYSCALE_NOMUL, filter_greyscale_nomul), + SHADER_SOURCE_FILTER_LINE(FILTER_GREYSCALE_BGRA, filter_greyscale_bgra), + SHADER_SOURCE_FILTER_LINE(FILTER_GREYSCALE_BGRA_NOMUL, filter_greyscale_bgra_nomul), + SHADER_SOURCE_FILTER_LINE(FILTER_SEPIA, filter_sepia), + SHADER_SOURCE_FILTER_LINE(FILTER_SEPIA_NOMUL, filter_sepia_nomul), + SHADER_SOURCE_FILTER_LINE(FILTER_SEPIA_BGRA, filter_sepia_bgra), + SHADER_SOURCE_FILTER_LINE(FILTER_SEPIA_BGRA_NOMUL, filter_sepia_bgra_nomul)/* , */ + /* SHADER_SOURCE_LINE(FILTER_BLUR, filter_blur), */ + /* SHADER_SOURCE_LINE(FILTER_BLUR_NOMUL, filter_blur_nomul), */ + /* SHADER_SOURCE_LINE(FILTER_BLUR_BGRA, filter_blur_bgra), */ + /* SHADER_SOURCE_LINE(FILTER_BLUR_BGRA_NOMUL, filter_blur_bgra_nomul) */ +}; + static int _evas_gl_common_shader_source_init(Evas_GL_Shared *shared) { - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.rect), - &(shader_rect_vert_src), - &(shader_rect_frag_src), - "rect")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.font), - &(shader_font_vert_src), - &(shader_font_frag_src), - "font")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.img), - &(shader_img_vert_src), - &(shader_img_frag_src), - "img")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.img_nomul), - &(shader_img_nomul_vert_src), - &(shader_img_nomul_frag_src), - "img_nomul")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.img_bgra), - &(shader_img_bgra_vert_src), - &(shader_img_bgra_frag_src), - "img_bgra")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.img_bgra_nomul), - &(shader_img_bgra_nomul_vert_src), - &(shader_img_bgra_nomul_frag_src), - "img_bgra_nomul")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.img_mask), - &(shader_img_mask_vert_src), - &(shader_img_mask_frag_src), - "img_mask")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.tex), - &(shader_tex_vert_src), - &(shader_tex_frag_src), - "tex")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.tex_nomul), - &(shader_tex_nomul_vert_src), - &(shader_tex_nomul_frag_src), - "tex_nomul")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.yuv), - &(shader_yuv_vert_src), - &(shader_yuv_frag_src), - "yuv")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.yuv_nomul), - &(shader_yuv_nomul_vert_src), - &(shader_yuv_nomul_frag_src), - "yuv_nomul")) return 0; + unsigned int i; - /* Most of the filters use the image fragment shader */ - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_invert), - &(shader_img_vert_src), - &(shader_filter_invert_frag_src), - "filter_invert")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_invert_nomul), - &(shader_img_vert_src), - &(shader_filter_invert_nomul_frag_src), - "filter_invert_nomul")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_invert_bgra), - &(shader_img_vert_src), - &(shader_filter_invert_bgra_frag_src), - "filter_invert_bgra")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_invert_bgra_nomul), - &(shader_img_vert_src), - &(shader_filter_invert_bgra_nomul_frag_src), - "filter_invert_bgra_nomul")) return 0; - - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_sepia), - &(shader_img_vert_src), - &(shader_filter_sepia_frag_src), - "filter_sepia")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_sepia_nomul), - &(shader_img_vert_src), - &(shader_filter_sepia_nomul_frag_src), - "filter_sepia_nomul")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_sepia_bgra), - &(shader_img_vert_src), - &(shader_filter_sepia_bgra_frag_src), - "filter_sepia_bgra")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_sepia_bgra_nomul), - &(shader_img_vert_src), - &(shader_filter_sepia_bgra_nomul_frag_src), - "filter_sepia_bgra_nomul")) return 0; - - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_greyscale), - &(shader_img_vert_src), - &(shader_filter_greyscale_frag_src), - "filter_greyscale")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_greyscale_nomul), - &(shader_img_vert_src), - &(shader_filter_greyscale_nomul_frag_src), - "filter_greyscale_nomul")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_greyscale_bgra), - &(shader_img_vert_src), - &(shader_filter_greyscale_bgra_frag_src), - "filter_greyscale_bgra")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_greyscale_bgra_nomul), - &(shader_img_vert_src), - &(shader_filter_greyscale_bgra_nomul_frag_src), - "filter_greyscale_bgra_nomul")) return 0; -#if 0 - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_blur), - &(shader_filter_blur_vert_src), - &(shader_filter_blur_frag_src), - "filter_blur")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_blur_nomul), - &(shader_filter_blur_vert_src), - &(shader_filter_blur_nomul_frag_src), - "filter_blur_nomul")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_blur_bgra), - &(shader_filter_blur_vert_src), - &(shader_filter_blur_bgra_frag_src), - "filter_blur_bgra")) return 0; - if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_blur_bgra_nomul), - &(shader_filter_blur_vert_src), - &(shader_filter_blur_bgra_nomul_frag_src), - "filter_blur_bgra_nomul")) return 0; -#endif + for (i = 0; i < sizeof (_shaders_source) / sizeof (_shaders_source[0]); ++i) + if (!_evas_gl_common_shader_program_source_init(&(shared->shader[_shaders_source[i].id]), + _shaders_source[i].vert, + _shaders_source[i].frag, + _shaders_source[i].name)) + return 0; return 1; } @@ -1063,6 +1162,7 @@ _evas_gl_common_shader_binary_init(Evas_GL_Shared *shared) Eet_File *et = NULL; char bin_dir_path[PATH_MAX]; char bin_file_path[PATH_MAX]; + unsigned int i; if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path))) return 0; @@ -1076,39 +1176,11 @@ _evas_gl_common_shader_binary_init(Evas_GL_Shared *shared) et = eet_open(bin_file_path, EET_FILE_MODE_READ); if (!et) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.rect), "rect", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.font), "font", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.img), "img", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.img_nomul), "img_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.img_bgra), "img_bgra", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.img_bgra_nomul), "img_bgra_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.img_mask), "img_mask", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.tex), "tex", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.tex_nomul),"tex_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.yuv), "yuv", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.yuv_nomul), "yuv_nomul", et)) goto error; - - /* Most of the filters use the image fragment shader */ - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_invert), "filter_invert", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_invert_nomul), "filter_invert_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_invert_bgra), "filter_invert_bgra", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_invert_bgra_nomul), "filter_invert_bgra_nomul", et)) goto error; - - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_sepia), "filter_sepia", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_sepia_nomul), "filter_sepia_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_sepia_bgra), "filter_sepia_bgra", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_sepia_bgra_nomul), "filter_sepia_bgra_nomul", et)) goto error; - - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_greyscale), "filter_greyscale", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_greyscale_nomul), "filter_greyscale_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_greyscale_bgra), "filter_greyscale_bgra", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_greyscale_bgra_nomul), "filter_greyscale_bgra_nomul", et)) goto error; -#if 0 - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_blur), "filter_blur", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_blur_nomul), "filter_blur_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_blur_bgra), "filter_blur_bgra", et)) goto error; - if (!_evas_gl_common_shader_program_binary_init(&(shared->shader.filter_blur_bgra_nomul), "filter_blur_bgra_nomul", et)) goto error; -#endif + for (i = 0; i < sizeof (_shaders_source) / sizeof (_shaders_source[0]); ++i) + if (!_evas_gl_common_shader_program_binary_init(&(shared->shader[_shaders_source[i].id]), + _shaders_source[i].name, + et)) + goto error; if (et) eet_close(et); eet_shutdown(); @@ -1130,6 +1202,7 @@ _evas_gl_common_shader_binary_save(Evas_GL_Shared *shared) char bin_dir_path[PATH_MAX]; char bin_file_path[PATH_MAX]; char tmp_file[PATH_MAX]; + unsigned int i; if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path))) res = _evas_gl_shader_file_mkpath(bin_dir_path); @@ -1150,38 +1223,11 @@ _evas_gl_common_shader_binary_save(Evas_GL_Shared *shared) et = eet_open(tmp_file, EET_FILE_MODE_WRITE); if (!et) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.rect), "rect", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.font), "font", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.img), "img", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.img_nomul), "img_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.img_bgra), "img_bgra", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.img_bgra_nomul), "img_bgra_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.img_mask), "img_mask", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.tex), "tex", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.tex_nomul),"tex_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.yuv), "yuv", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.yuv_nomul), "yuv_nomul", et)) goto error; - /* Most of the filters use the image fragment shader */ - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_invert), "filter_invert", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_invert_nomul), "filter_invert_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_invert_bgra), "filter_invert_bgra", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_invert_bgra_nomul), "filter_invert_bgra_nomul", et)) goto error; - - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_sepia), "filter_sepia", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_sepia_nomul), "filter_sepia_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_sepia_bgra), "filter_sepia_bgra", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_sepia_bgra_nomul), "filter_sepia_bgra_nomul", et)) goto error; - - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_greyscale), "filter_greyscale", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_greyscale_nomul), "filter_greyscale_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_greyscale_bgra), "filter_greyscale_bgra", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_greyscale_bgra_nomul), "filter_greyscale_bgra_nomul", et)) goto error; -#if 0 - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_blur), "filter_blur", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_blur_nomul), "filter_blur_nomul", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_blur_bgra), "filter_blur_bgra", et)) goto error; - if (!_evas_gl_common_shader_program_binary_save(&(shared->shader.filter_blur_bgra_nomul), "filter_blur_bgra_nomul", et)) goto error; -#endif + for (i = 0; i < sizeof (_shaders_source) / sizeof (_shaders_source[0]); ++i) + if (!_evas_gl_common_shader_program_binary_save(&(shared->shader[_shaders_source[i].id]), + _shaders_source[i].name, + et)) + goto error; if (eet_close(et) != EET_ERROR_NONE) goto error; if (rename(tmp_file,bin_file_path) < 0) goto error; diff --git a/src/modules/engines/gl_common/evas_gl_texture.c b/src/modules/engines/gl_common/evas_gl_texture.c index c6b6e29..b3fcc9c 100644 --- a/src/modules/engines/gl_common/evas_gl_texture.c +++ b/src/modules/engines/gl_common/evas_gl_texture.c @@ -22,10 +22,14 @@ static const GLenum bgr_fmt = GL_BGRA; static const GLenum bgr_ifmt = GL_RGB; # endif #endif -static const GLenum alpha_fmt = GL_ALPHA; -static const GLenum alpha_ifmt = GL_ALPHA; -static const GLenum lum_fmt = GL_LUMINANCE; -static const GLenum lum_ifmt = GL_LUMINANCE; +static const GLenum alpha_fmt = GL_ALPHA; +static const GLenum alpha_ifmt = GL_ALPHA; +static const GLenum lum_fmt = GL_LUMINANCE; +static const GLenum lum_ifmt = GL_LUMINANCE; +static const GLenum lum_alpha_fmt = GL_LUMINANCE_ALPHA; +static const GLenum lum_alpha_ifmt = GL_LUMINANCE_ALPHA; +static const GLenum rgba8_ifmt = GL_RGBA; +static const GLenum rgba8_fmt = GL_BGRA; static struct { struct { @@ -464,6 +468,7 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) int fmt; // EGL_MAP_GL_TEXTURE_RGBA_SEC or EGL_MAP_GL_TEXTURE_RGB_SEC or bust int pixtype; // EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC or bust + int glformat; int attr[] = { EGL_MAP_GL_TEXTURE_WIDTH_SEC, 32, @@ -474,6 +479,20 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i }; void *egldisplay; + if (intformat != format) return NULL; + + switch (intformat) + { +#ifdef EGL_MAP_GL_TEXTURE_LUMINANCE_SEC + case GL_LUMINANCE: attr[5] = EGL_MAP_GL_TEXTURE_LUMINANCE_SEC; break; +#endif +#ifdef EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC + case GL_LUMINANCE_ALPHA: attr[5] = EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC; break; +#endif + case GL_RGBA: attr[5] = EGL_MAP_GL_TEXTURE_RGBA_SEC; break; + default: fprintf(stderr, "unknown format\n"); return NULL; + } + pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); if (!pt) return NULL; h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; @@ -515,75 +534,39 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i EGL_NO_CONTEXT, EGL_MAP_GL_TEXTURE_2D_SEC, 0, attr); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (!pt->dyn.img) { + glBindTexture(GL_TEXTURE_2D, 0); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - return pt; + glDeleteTextures(1, &(pt->texture)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + free(pt); + return NULL; } if (secsym_eglGetImageAttribSEC(egldisplay, pt->dyn.img, EGL_MAP_GL_TEXTURE_WIDTH_SEC, - &(pt->dyn.w)) != EGL_TRUE) - { - secsym_eglDestroyImage(egldisplay, pt->dyn.img); - pt->dyn.img = NULL; - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - return pt; - } + &(pt->dyn.w)) != EGL_TRUE) goto error; if (secsym_eglGetImageAttribSEC(egldisplay, pt->dyn.img, EGL_MAP_GL_TEXTURE_HEIGHT_SEC, - &(pt->dyn.h)) != EGL_TRUE) - { - secsym_eglDestroyImage(egldisplay, pt->dyn.img); - pt->dyn.img = NULL; - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - return pt; - } + &(pt->dyn.h)) != EGL_TRUE) goto error; if (secsym_eglGetImageAttribSEC(egldisplay, pt->dyn.img, EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC, - &(pt->dyn.stride)) != EGL_TRUE) - { - secsym_eglDestroyImage(egldisplay, pt->dyn.img); - pt->dyn.img = NULL; - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - return pt; - } + &(pt->dyn.stride)) != EGL_TRUE) goto error; if (secsym_eglGetImageAttribSEC(egldisplay, pt->dyn.img, EGL_MAP_GL_TEXTURE_FORMAT_SEC, - &(fmt)) != EGL_TRUE) - { - secsym_eglDestroyImage(egldisplay, pt->dyn.img); - pt->dyn.img = NULL; - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - return pt; - } - if (fmt != EGL_MAP_GL_TEXTURE_RGBA_SEC) - { - secsym_eglDestroyImage(egldisplay, pt->dyn.img); - pt->dyn.img = NULL; - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - return pt; - } + &(fmt)) != EGL_TRUE) goto error; + if (secsym_eglGetImageAttribSEC(egldisplay, pt->dyn.img, EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC, - &(pixtype)) != EGL_TRUE) - { - secsym_eglDestroyImage(egldisplay, pt->dyn.img); - pt->dyn.img = NULL; - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - return pt; - } - if (pixtype != EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC) - { - secsym_eglDestroyImage(egldisplay, pt->dyn.img); - pt->dyn.img = NULL; - GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - return pt; - } + &(pixtype)) != EGL_TRUE) goto error; + + if (pixtype != EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC) goto error; glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); @@ -595,6 +578,20 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i format = 0; #endif return pt; + +/* ERROR HANDLING */ +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) +error: + secsym_eglDestroyImage(egldisplay, pt->dyn.img); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + pt->dyn.img = NULL; + glBindTexture(GL_TEXTURE_2D, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glDeleteTextures(1, &(pt->texture)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + free(pt); + return NULL; +#endif } void @@ -667,6 +664,7 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt) static void pt_unref(Evas_GL_Texture_Pool *pt) { + if (!pt) return; if (!pt->gc) return; pt->references--; if (pt->references != 0) return; @@ -684,6 +682,17 @@ pt_unref(Evas_GL_Texture_Pool *pt) free(pt); } +static void +pt_link(Evas_Engine_GL_Context *gc, Evas_GL_Texture *tex, Evas_GL_Texture_Pool *pt) +{ + gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, pt); + pt->slot = -1; + pt->fslot = -1; + pt->whole = 1; + pt->allocations = eina_list_prepend(pt->allocations, tex); + pt->references++; +} + Evas_GL_Texture * evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_GL_Image *im) { @@ -892,15 +901,36 @@ evas_gl_common_texture_free(Evas_GL_Texture *tex) if (!tex) return; tex->references--; if (tex->references != 0) return; - if (tex->pt) + if (tex->double_buffer.pt[0]) { -// printf("tex->pt = %p\n", tex->pt); -// printf("tex->pt->references = %i\n", tex->pt->references); - tex->pt->allocations = eina_list_remove(tex->pt->allocations, tex); - pt_unref(tex->pt); + tex->double_buffer.pt[0]->allocations = eina_list_remove(tex->double_buffer.pt[0]->allocations, tex); + tex->double_buffer.pt[1]->allocations = eina_list_remove(tex->double_buffer.pt[1]->allocations, tex); + tex->double_buffer.ptuv[0]->allocations = eina_list_remove(tex->double_buffer.ptuv[0]->allocations, tex); + tex->double_buffer.ptuv[1]->allocations = eina_list_remove(tex->double_buffer.ptuv[1]->allocations, tex); + } + else + { + if (tex->pt) + { + tex->pt->allocations = eina_list_remove(tex->pt->allocations, tex); + pt_unref(tex->pt); + } + if (tex->ptu) + { + tex->ptu->allocations = eina_list_remove(tex->ptu->allocations, tex); + pt_unref(tex->ptu); + } + if (tex->ptv) + { + tex->ptv->allocations = eina_list_remove(tex->ptv->allocations, tex); + pt_unref(tex->ptv); + } + if (tex->ptuv) + { + tex->ptuv->allocations = eina_list_remove(tex->ptuv->allocations, tex); + pt_unref(tex->ptuv); + } } - if (tex->ptu) pt_unref(tex->ptu); - if (tex->ptv) pt_unref(tex->ptv); free(tex); } @@ -952,10 +982,8 @@ evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels, #endif glPixelStorei(GL_UNPACK_ALIGNMENT, 4); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - _tex_sub_2d(tex->x, tex->y, w, h, tex->pt->format, tex->pt->dataformat, pixels); - if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) { glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); @@ -1031,16 +1059,19 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, tex->pt->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); glBindTexture(GL_TEXTURE_2D, tex->ptu->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat); _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]); glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + (h / 2) + 1] - rows[h + (h / 2)]); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat); _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]); #else unsigned int y; @@ -1049,6 +1080,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, tex->pt->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); if ((rows[1] - rows[0]) == (int)w) _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); else @@ -1059,6 +1091,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i glBindTexture(GL_TEXTURE_2D, tex->ptu->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat); if ((rows[h + 1] - rows[h]) == (int)(w / 2)) _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]); else @@ -1069,6 +1102,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat); if ((rows[h + (h / 2) + 1] - rows[h + (h / 2)]) == (int)(w / 2)) _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]); else @@ -1083,3 +1117,464 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } } + +static Evas_GL_Texture * +_evas_gl_common_texture_y2uv_new(Evas_Engine_GL_Context *gc, + unsigned int yw, unsigned int yh, + unsigned int uvw, unsigned int uvh, + GLenum y_ifmt, GLenum y_fmt, + GLenum uv_ifmt, GLenum uv_fmt, + Eina_Bool dynamic) +{ + Evas_GL_Texture_Pool *pt[2] = { NULL, NULL }; + Evas_GL_Texture_Pool *ptuv[2] = { NULL, NULL }; + Evas_GL_Texture *tex; + + if (!dynamic) + { + pt[0] = _pool_tex_new(gc, yw + 1, yh + 1, y_ifmt, y_fmt); + pt[1] = _pool_tex_new(gc, yw + 1, yh + 1, y_ifmt, y_fmt); + + ptuv[0] = _pool_tex_new(gc, uvw + 1, uvh + 1, uv_ifmt, uv_fmt); + ptuv[1] = _pool_tex_new(gc, uvw + 1, uvh + 1, uv_ifmt, uv_fmt); + } + else + { + pt[0] = _pool_tex_dynamic_new(gc, yw + 1, yh + 1, y_ifmt, y_fmt); + pt[1] = _pool_tex_dynamic_new(gc, yw + 1, yh + 1, y_ifmt, y_fmt); + + ptuv[0] = _pool_tex_dynamic_new(gc, uvw + 1, uvh + 1, uv_ifmt, uv_fmt); + ptuv[1] = _pool_tex_dynamic_new(gc, uvw + 1, uvh + 1, uv_ifmt, uv_fmt); + } + + if (!pt[0] || !pt[1] || !ptuv[0] || !ptuv[1]) + goto on_error; + + tex = calloc(1, sizeof(Evas_GL_Texture)); + if (!tex) + goto on_error; + + tex->gc = gc; + tex->references = 1; + tex->pt = pt[0]; + tex->ptuv = ptuv[0]; + tex->dyn = dynamic; + + pt_link(gc, tex, pt[0]); + pt_link(gc, tex, pt[1]); + pt_link(gc, tex, ptuv[0]); + pt_link(gc, tex, ptuv[1]); + + tex->x = 0; + tex->y = 0; + tex->w = yw; + tex->h = yh; + tex->double_buffer.source = 0; + memcpy(tex->double_buffer.pt, pt, sizeof (Evas_GL_Texture_Pool *) * 2); + memcpy(tex->double_buffer.ptuv, ptuv, sizeof (Evas_GL_Texture_Pool *) * 2); + + return tex; + + on_error: + pt_unref(pt[0]); + pt_unref(pt[1]); + pt_unref(ptuv[0]); + pt_unref(ptuv[1]); + return NULL; +} + +Evas_GL_Texture * +evas_gl_common_texture_yuy2_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h) +{ + Evas_GL_Texture *tex; + + tex = _evas_gl_common_texture_y2uv_new(gc, w, h, w / 2, h, lum_alpha_ifmt, lum_alpha_fmt, rgba8_ifmt, rgba8_fmt, 0); + evas_gl_common_texture_yuy2_update(tex, rows, w, h); + return tex; +} + +Evas_GL_Texture * +evas_gl_common_texture_nv12_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h) +{ + Evas_GL_Texture *tex; + +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + tex = _evas_gl_common_texture_y2uv_new(gc, w, h, w / 2, h / 2, lum_ifmt, lum_fmt, lum_alpha_ifmt, lum_alpha_fmt, 1); + if (!tex) +#endif + tex = _evas_gl_common_texture_y2uv_new(gc, w, h, w / 2, h / 2, lum_ifmt, lum_fmt, lum_alpha_ifmt, lum_alpha_fmt, 0); + + evas_gl_common_texture_nv12_update(tex, rows, w, h); + return tex; +} + +Evas_GL_Texture * +evas_gl_common_texture_nv12tiled_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h) +{ + Evas_GL_Texture *tex = NULL; + +#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) + tex = _evas_gl_common_texture_y2uv_new(gc, w, h, w, h, lum_ifmt, lum_fmt, lum_alpha_ifmt, lum_alpha_fmt, 1); + if (!tex) +#endif + tex = _evas_gl_common_texture_y2uv_new(gc, w, h, w, h, lum_ifmt, lum_fmt, lum_alpha_ifmt, lum_alpha_fmt, 0); + + evas_gl_common_texture_nv12tiled_update(tex, rows, w, h); + return tex; +} + +void +evas_gl_common_texture_yuy2_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned int w, unsigned int h) +{ + if (!tex->pt) return; + // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2 + unsigned int y; + + tex->double_buffer.source = 1 - tex->double_buffer.source; + tex->pt = tex->double_buffer.pt[tex->double_buffer.source]; + tex->ptuv = tex->double_buffer.ptuv[tex->double_buffer.source]; + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); + if ((rows[1] - rows[0]) == (int)w * 4) + _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); + else + { + for (y = 0; y < h; y++) + _tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]); + } + + glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->ptuv->intformat, w / 2, h, tex->ptuv->format, tex->ptuv->dataformat); + if ((rows[1] - rows[0]) == (int)(w * 2)) + _tex_sub_2d(0, 0, w / 2, h, tex->ptuv->format, tex->ptuv->dataformat, rows[0]); + else + { + for (y = 0; y < h; y++) + _tex_sub_2d(0, y, w / 2, 1, tex->ptuv->format, tex->ptuv->dataformat, rows[y]); + } + + if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) + { + glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } +} + +void +evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned int w, unsigned int h) +{ + if (!tex->pt) return; + + tex->double_buffer.source = 1 - tex->double_buffer.source; + tex->pt = tex->double_buffer.pt[tex->double_buffer.source]; + tex->ptuv = tex->double_buffer.ptuv[tex->double_buffer.source]; + + // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2 +#ifdef GL_UNPACK_ROW_LENGTH + glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); + _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); + glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat); + _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat, rows[h]); +#else + unsigned int y; + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); + if ((rows[1] - rows[0]) == (int)w) + _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); + else + { + for (y = 0; y < h; y++) + _tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]); + } + + glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + _tex_2d(tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat); + if ((rows[h + 1] - rows[h]) == (int)(w / 2)) + _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat, rows[h]); + else + { + for (y = 0; y < (h / 2); y++) + _tex_sub_2d(0, y, w / 2, 1, tex->ptuv->format, tex->ptuv->dataformat, rows[h + y]); + } +#endif + if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) + { + glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } +} + +void +evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned int w, unsigned int h) +{ + unsigned int mb_x, mb_y, mb_w, mb_h; + unsigned int base_h; + + if (!tex->pt) return; + + tex->double_buffer.source = 1 - tex->double_buffer.source; + tex->pt = tex->double_buffer.pt[tex->double_buffer.source]; + tex->ptuv = tex->double_buffer.ptuv[tex->double_buffer.source]; + + mb_w = w / 64 + (w % 64 ? 1 : 0); + mb_h = h / 32 + (h % 32 ? 1 : 0); + +#if ( defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) ) + if (tex->dyn) + { + char *texture_addr; + char *tmp; + + texture_addr = secsym_eglMapImageSEC(tex->gc->egldisp, tex->pt->dyn.img); + + /* Iterate each Y macroblock like we do in evas_convert_yuv.c */ + for (mb_y = 0; mb_y < (mb_h >> 1); mb_y++) + { + int step = 2; + int offset = 0; + int x = 0; + int rmb_x = 0; + int ry[2]; + + ry[0] = mb_y * 2 * 32 * tex->pt->dyn.stride; + ry[1] = ry[0] + 32 * tex->pt->dyn.stride; + + for (mb_x = 0; mb_x < mb_w * 2; mb_x++, rmb_x += 64 * 32) + { + unsigned int i; + + tmp = texture_addr + x + ry[offset]; + + for (i = 0; i < 32 * 64; i += 64, tmp += tex->pt->dyn.stride) + memcpy(tmp, rows[mb_y] + rmb_x + i, 64); + + step++; + if ((step & 0x3) == 0) + { + offset = 1 - offset; + x -= 64; + } + else + { + x += 64; + } + } + } + + if (mb_h & 0x1) + { + int rmb_x = 0; + int x = 0; + int ry; + + ry = mb_y * 2 * 32 * tex->pt->dyn.stride; + + for (mb_x = 0; mb_x < mb_w; mb_x++, x += 64, rmb_x += 64 * 32) + { + unsigned int i; + + tmp = texture_addr + x + ry; + + for (i = 0; i < 32 * 64; i += 64, tmp += tex->pt->dyn.stride) + memcpy(tmp, rows[mb_y] + rmb_x + i, 64); + } + } + + secsym_eglUnmapImageSEC(tex->gc->egldisp, tex->pt->dyn.img); + + texture_addr = secsym_eglMapImageSEC(tex->gc->egldisp, tex->ptuv->dyn.img); + + /* Iterate each UV macroblock like we do in evas_convert_yuv.c */ + base_h = (mb_h >> 1) + (mb_h & 0x1); + + /* h is always a multiple of 32 */ + mb_h = h / 2; + mb_h = (mb_h / 32 + (mb_h % 32 ? 1 : 0)); + + mb_w = w / 2; + mb_w = (mb_w / 32 + (mb_w % 32 ? 1 : 0)); + + for (mb_y = 0; mb_y < (mb_h >> 1); mb_y++) + { + int step = 2; + int offset = 0; + int x = 0; + int rmb_x = 0; + int ry[2]; + + ry[0] = mb_y * 2 * 32 * tex->ptuv->dyn.stride; + ry[1] = ry[0] + 32 * tex->ptuv->dyn.stride; + + for (mb_x = 0; mb_x < mb_w * 4; mb_x++, rmb_x += 64 * 32) + { + unsigned int i = 0; + + tmp = texture_addr + x + ry[offset]; + + for (i = 0; i < 32 * 64; i += 64, tmp += tex->ptuv->dyn.stride) + memcpy(tmp, rows[mb_y + base_h] + rmb_x + i, 64); + + step++; + if ((step & 0x3) == 0) + { + offset = 1 - offset; + x -= 64; + } + else + { + x += 64; + } + } + } + + if (mb_h & 0x1) + { + int rmb_x = 0; + int x = 0; + int ry; + + ry = mb_y * 2 * 32 * tex->ptuv->dyn.stride; + + for (mb_x = 0; mb_x < mb_w * 2; mb_x++, x += 64, rmb_x += 64 * 32) + { + unsigned int i; + + tmp = texture_addr + x + ry; + + /* It has horizontaly half the pixels, but they are double the size*/ + for (i = 0; i < 32 * 64; i += 64, tmp += tex->ptuv->dyn.stride) + memcpy(tmp, rows[mb_y + base_h] + rmb_x + i, 64); + } + } + + secsym_eglUnmapImageSEC(tex->gc->egldisp, tex->ptuv->dyn.img); + return ; + } +#endif + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + + glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + + // We are telling the driver to not swizzle back the buffer as we are going to replace all pixel + _tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); + + /* Iterate each Y macroblock like we do in evas_convert_yuv.c */ + for (mb_y = 0; mb_y < (mb_h >> 1); mb_y++) + { + int step = 2; + int offset = 0; + int x = 0; + int rmb_x = 0; + int ry[2]; + + ry[0] = mb_y * 2 * 32; + ry[1] = ry[0] + 32; + + for (mb_x = 0; mb_x < mb_w * 2; mb_x++, rmb_x += 64 * 32) + { + _tex_sub_2d(x, ry[offset], 64, 32, tex->pt->format, tex->pt->dataformat, rows[mb_y] + rmb_x); + + step++; + if ((step & 0x3) == 0) + { + offset = 1 - offset; + x -= 64; + } + else + { + x += 64; + } + } + } + + if (mb_h & 0x1) + { + int rmb_x = 0; + int x = 0; + int ry; + + ry = mb_y * 2 * 32; + + for (mb_x = 0; mb_x < mb_w; mb_x++, x += 64, rmb_x += 64 * 32) + _tex_sub_2d(x, ry, 64, 32, tex->pt->format, tex->pt->dataformat, rows[mb_y] + rmb_x); + } + + glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + + _tex_2d(tex->ptuv->intformat, w, h, tex->ptuv->format, tex->ptuv->dataformat); + + /* Iterate each UV macroblock like we do in evas_convert_yuv.c */ + base_h = (mb_h >> 1) + (mb_h & 0x1); + + /* h is always a multiple of 32 */ + mb_h = h / 2; + mb_h = (mb_h / 32 + (mb_h % 32 ? 1 : 0)); + + mb_w = w / 2; + mb_w = (mb_w / 32 + (mb_w % 32 ? 1 : 0)); + + for (mb_y = 0; mb_y < (mb_h >> 1); mb_y++) + { + int step = 2; + int offset = 0; + int x = 0; + int rmb_x = 0; + int ry[2]; + + ry[0] = mb_y * 2 * 32; + ry[1] = ry[0] + 32; + + for (mb_x = 0; mb_x < mb_w * 2; mb_x++, rmb_x += 64 * 32) + { + _tex_sub_2d(x, ry[offset], 32, 32, + tex->ptuv->format, tex->ptuv->dataformat, + rows[mb_y + base_h] + rmb_x); + step++; + if ((step & 0x3) == 0) + { + offset = 1 - offset; + x -= 32; + } + else + { + x += 32; + } + } + } + + if (mb_h & 0x1) + { + int rmb_x = 0; + int x = 0; + int ry; + + ry = mb_y * 2 * 32; + + for (mb_x = 0; mb_x < mb_w; mb_x++, x += 32, rmb_x += 64 * 32) + _tex_sub_2d(x, ry, 64, 32, tex->ptuv->format, tex->ptuv->dataformat, rows[mb_y + base_h] + rmb_x); + } +} diff --git a/src/modules/engines/gl_common/shader/filter_blur.shd b/src/modules/engines/gl_common/shader/filter_blur.shd index 59b5809..873fbc1 100644 --- a/src/modules/engines/gl_common/shader/filter_blur.shd +++ b/src/modules/engines/gl_common/shader/filter_blur.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; uniform sampler1D gaussian; diff --git a/src/modules/engines/gl_common/shader/filter_blur_bgra.shd b/src/modules/engines/gl_common/shader/filter_blur_bgra.shd index efd7932..b1377a4 100644 --- a/src/modules/engines/gl_common/shader/filter_blur_bgra.shd +++ b/src/modules/engines/gl_common/shader/filter_blur_bgra.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; uniform sampler1D gaussian; diff --git a/src/modules/engines/gl_common/shader/filter_blur_bgra_nomul.shd b/src/modules/engines/gl_common/shader/filter_blur_bgra_nomul.shd index efd7932..b1377a4 100644 --- a/src/modules/engines/gl_common/shader/filter_blur_bgra_nomul.shd +++ b/src/modules/engines/gl_common/shader/filter_blur_bgra_nomul.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; uniform sampler1D gaussian; diff --git a/src/modules/engines/gl_common/shader/filter_blur_nomul.shd b/src/modules/engines/gl_common/shader/filter_blur_nomul.shd index efd7932..b1377a4 100644 --- a/src/modules/engines/gl_common/shader/filter_blur_nomul.shd +++ b/src/modules/engines/gl_common/shader/filter_blur_nomul.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; uniform sampler1D gaussian; diff --git a/src/modules/engines/gl_common/shader/filter_blur_vert.shd b/src/modules/engines/gl_common/shader/filter_blur_vert.shd index e2ca7d5..56ddc40 100644 --- a/src/modules/engines/gl_common/shader/filter_blur_vert.shd +++ b/src/modules/engines/gl_common/shader/filter_blur_vert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif attribute vec4 vertex; attribute vec4 color; diff --git a/src/modules/engines/gl_common/shader/filter_greyscale.shd b/src/modules/engines/gl_common/shader/filter_greyscale.shd index 014e510..9bb572d 100644 --- a/src/modules/engines/gl_common/shader/filter_greyscale.shd +++ b/src/modules/engines/gl_common/shader/filter_greyscale.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/filter_greyscale_bgra.shd b/src/modules/engines/gl_common/shader/filter_greyscale_bgra.shd index ec9ac11..5952aad 100644 --- a/src/modules/engines/gl_common/shader/filter_greyscale_bgra.shd +++ b/src/modules/engines/gl_common/shader/filter_greyscale_bgra.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/filter_greyscale_bgra_nomul.shd b/src/modules/engines/gl_common/shader/filter_greyscale_bgra_nomul.shd index b4dcc30..bf3dcb6 100644 --- a/src/modules/engines/gl_common/shader/filter_greyscale_bgra_nomul.shd +++ b/src/modules/engines/gl_common/shader/filter_greyscale_bgra_nomul.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec2 tex_c; diff --git a/src/modules/engines/gl_common/shader/filter_greyscale_nomul.shd b/src/modules/engines/gl_common/shader/filter_greyscale_nomul.shd index 327e311..e47d4a2 100644 --- a/src/modules/engines/gl_common/shader/filter_greyscale_nomul.shd +++ b/src/modules/engines/gl_common/shader/filter_greyscale_nomul.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec2 tex_c; diff --git a/src/modules/engines/gl_common/shader/filter_invert.shd b/src/modules/engines/gl_common/shader/filter_invert.shd index a405099..50ed6bb 100644 --- a/src/modules/engines/gl_common/shader/filter_invert.shd +++ b/src/modules/engines/gl_common/shader/filter_invert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/filter_invert_bgra.shd b/src/modules/engines/gl_common/shader/filter_invert_bgra.shd index 1e60507..cf8cf0e 100644 --- a/src/modules/engines/gl_common/shader/filter_invert_bgra.shd +++ b/src/modules/engines/gl_common/shader/filter_invert_bgra.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/filter_invert_bgra_nomul.shd b/src/modules/engines/gl_common/shader/filter_invert_bgra_nomul.shd index 2b37345..1f90a70 100644 --- a/src/modules/engines/gl_common/shader/filter_invert_bgra_nomul.shd +++ b/src/modules/engines/gl_common/shader/filter_invert_bgra_nomul.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/filter_invert_nomul.shd b/src/modules/engines/gl_common/shader/filter_invert_nomul.shd index a405099..50ed6bb 100644 --- a/src/modules/engines/gl_common/shader/filter_invert_nomul.shd +++ b/src/modules/engines/gl_common/shader/filter_invert_nomul.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/filter_sepia.shd b/src/modules/engines/gl_common/shader/filter_sepia.shd index 63b6208..70c49d8 100644 --- a/src/modules/engines/gl_common/shader/filter_sepia.shd +++ b/src/modules/engines/gl_common/shader/filter_sepia.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/filter_sepia_bgra.shd b/src/modules/engines/gl_common/shader/filter_sepia_bgra.shd index d267b9c..9a1926e 100644 --- a/src/modules/engines/gl_common/shader/filter_sepia_bgra.shd +++ b/src/modules/engines/gl_common/shader/filter_sepia_bgra.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/filter_sepia_bgra_nomul.shd b/src/modules/engines/gl_common/shader/filter_sepia_bgra_nomul.shd index f2be987..f9cf473 100644 --- a/src/modules/engines/gl_common/shader/filter_sepia_bgra_nomul.shd +++ b/src/modules/engines/gl_common/shader/filter_sepia_bgra_nomul.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/filter_sepia_nomul.shd b/src/modules/engines/gl_common/shader/filter_sepia_nomul.shd index cdd109e..5d1558c 100644 --- a/src/modules/engines/gl_common/shader/filter_sepia_nomul.shd +++ b/src/modules/engines/gl_common/shader/filter_sepia_nomul.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/font_frag.h b/src/modules/engines/gl_common/shader/font_frag.h index afe2222..f43af9a 100644 --- a/src/modules/engines/gl_common/shader/font_frag.h +++ b/src/modules/engines/gl_common/shader/font_frag.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "uniform sampler2D tex;\n" "varying vec4 col;\n" diff --git a/src/modules/engines/gl_common/shader/font_frag.shd b/src/modules/engines/gl_common/shader/font_frag.shd index cae4293..cad119d 100644 --- a/src/modules/engines/gl_common/shader/font_frag.shd +++ b/src/modules/engines/gl_common/shader/font_frag.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/img_bgra_frag.h b/src/modules/engines/gl_common/shader/img_bgra_frag.h index 29449f2..91edfa1 100644 --- a/src/modules/engines/gl_common/shader/img_bgra_frag.h +++ b/src/modules/engines/gl_common/shader/img_bgra_frag.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "uniform sampler2D tex;\n" "varying vec4 col;\n" diff --git a/src/modules/engines/gl_common/shader/img_bgra_frag.shd b/src/modules/engines/gl_common/shader/img_bgra_frag.shd index eb65760..d4cdf22 100644 --- a/src/modules/engines/gl_common/shader/img_bgra_frag.shd +++ b/src/modules/engines/gl_common/shader/img_bgra_frag.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/img_bgra_nomul_frag.h b/src/modules/engines/gl_common/shader/img_bgra_nomul_frag.h index d8a6338..26d3e0d 100644 --- a/src/modules/engines/gl_common/shader/img_bgra_nomul_frag.h +++ b/src/modules/engines/gl_common/shader/img_bgra_nomul_frag.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "uniform sampler2D tex;\n" "varying vec2 tex_c;\n" diff --git a/src/modules/engines/gl_common/shader/img_bgra_nomul_frag.shd b/src/modules/engines/gl_common/shader/img_bgra_nomul_frag.shd index 3f2ec6f..cfe1f1a 100644 --- a/src/modules/engines/gl_common/shader/img_bgra_nomul_frag.shd +++ b/src/modules/engines/gl_common/shader/img_bgra_nomul_frag.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec2 tex_c; diff --git a/src/modules/engines/gl_common/shader/img_bgra_nomul_vert.h b/src/modules/engines/gl_common/shader/img_bgra_nomul_vert.h index 3a44f1a..13d5edd 100644 --- a/src/modules/engines/gl_common/shader/img_bgra_nomul_vert.h +++ b/src/modules/engines/gl_common/shader/img_bgra_nomul_vert.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "attribute vec4 vertex;\n" "attribute vec2 tex_coord;\n" diff --git a/src/modules/engines/gl_common/shader/img_bgra_nomul_vert.shd b/src/modules/engines/gl_common/shader/img_bgra_nomul_vert.shd index f4489b3..74f3207 100644 --- a/src/modules/engines/gl_common/shader/img_bgra_nomul_vert.shd +++ b/src/modules/engines/gl_common/shader/img_bgra_nomul_vert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif attribute vec4 vertex; attribute vec2 tex_coord; diff --git a/src/modules/engines/gl_common/shader/img_bgra_vert.h b/src/modules/engines/gl_common/shader/img_bgra_vert.h index ef035c8..8921d9d 100644 --- a/src/modules/engines/gl_common/shader/img_bgra_vert.h +++ b/src/modules/engines/gl_common/shader/img_bgra_vert.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "attribute vec4 vertex;\n" "attribute vec4 color;\n" diff --git a/src/modules/engines/gl_common/shader/img_bgra_vert.shd b/src/modules/engines/gl_common/shader/img_bgra_vert.shd index cf98501..606c297 100644 --- a/src/modules/engines/gl_common/shader/img_bgra_vert.shd +++ b/src/modules/engines/gl_common/shader/img_bgra_vert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif attribute vec4 vertex; attribute vec4 color; diff --git a/src/modules/engines/gl_common/shader/img_frag.h b/src/modules/engines/gl_common/shader/img_frag.h index e665c30..c0c07a5 100644 --- a/src/modules/engines/gl_common/shader/img_frag.h +++ b/src/modules/engines/gl_common/shader/img_frag.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "uniform sampler2D tex;\n" "varying vec4 col;\n" diff --git a/src/modules/engines/gl_common/shader/img_frag.shd b/src/modules/engines/gl_common/shader/img_frag.shd index ce3b517..658ae1e 100644 --- a/src/modules/engines/gl_common/shader/img_frag.shd +++ b/src/modules/engines/gl_common/shader/img_frag.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/img_mask_frag.h b/src/modules/engines/gl_common/shader/img_mask_frag.h index 0571c72..58661d7 100644 --- a/src/modules/engines/gl_common/shader/img_mask_frag.h +++ b/src/modules/engines/gl_common/shader/img_mask_frag.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "uniform sampler2D tex, texm;\n" "varying vec4 col;\n" diff --git a/src/modules/engines/gl_common/shader/img_mask_frag.shd b/src/modules/engines/gl_common/shader/img_mask_frag.shd index 87aa2b7..1292c3a 100644 --- a/src/modules/engines/gl_common/shader/img_mask_frag.shd +++ b/src/modules/engines/gl_common/shader/img_mask_frag.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex, texm; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/img_mask_vert.h b/src/modules/engines/gl_common/shader/img_mask_vert.h index 5b52e41..7508c98 100644 --- a/src/modules/engines/gl_common/shader/img_mask_vert.h +++ b/src/modules/engines/gl_common/shader/img_mask_vert.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "attribute vec4 vertex;\n" "attribute vec4 color;\n" diff --git a/src/modules/engines/gl_common/shader/img_mask_vert.shd b/src/modules/engines/gl_common/shader/img_mask_vert.shd index f91b545..1414870 100644 --- a/src/modules/engines/gl_common/shader/img_mask_vert.shd +++ b/src/modules/engines/gl_common/shader/img_mask_vert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif attribute vec4 vertex; attribute vec4 color; diff --git a/src/modules/engines/gl_common/shader/img_nomul_frag.h b/src/modules/engines/gl_common/shader/img_nomul_frag.h index 44cd1f7..94f0a76 100644 --- a/src/modules/engines/gl_common/shader/img_nomul_frag.h +++ b/src/modules/engines/gl_common/shader/img_nomul_frag.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "uniform sampler2D tex;\n" "varying vec2 tex_c;\n" diff --git a/src/modules/engines/gl_common/shader/img_nomul_frag.shd b/src/modules/engines/gl_common/shader/img_nomul_frag.shd index 1513cd3..594299d 100644 --- a/src/modules/engines/gl_common/shader/img_nomul_frag.shd +++ b/src/modules/engines/gl_common/shader/img_nomul_frag.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec2 tex_c; diff --git a/src/modules/engines/gl_common/shader/img_nomul_vert.h b/src/modules/engines/gl_common/shader/img_nomul_vert.h index 3a44f1a..13d5edd 100644 --- a/src/modules/engines/gl_common/shader/img_nomul_vert.h +++ b/src/modules/engines/gl_common/shader/img_nomul_vert.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "attribute vec4 vertex;\n" "attribute vec2 tex_coord;\n" diff --git a/src/modules/engines/gl_common/shader/img_nomul_vert.shd b/src/modules/engines/gl_common/shader/img_nomul_vert.shd index f4489b3..74f3207 100644 --- a/src/modules/engines/gl_common/shader/img_nomul_vert.shd +++ b/src/modules/engines/gl_common/shader/img_nomul_vert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif attribute vec4 vertex; attribute vec2 tex_coord; diff --git a/src/modules/engines/gl_common/shader/img_vert.h b/src/modules/engines/gl_common/shader/img_vert.h index ef035c8..8921d9d 100644 --- a/src/modules/engines/gl_common/shader/img_vert.h +++ b/src/modules/engines/gl_common/shader/img_vert.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "attribute vec4 vertex;\n" "attribute vec4 color;\n" diff --git a/src/modules/engines/gl_common/shader/img_vert.shd b/src/modules/engines/gl_common/shader/img_vert.shd index cf98501..606c297 100644 --- a/src/modules/engines/gl_common/shader/img_vert.shd +++ b/src/modules/engines/gl_common/shader/img_vert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif attribute vec4 vertex; attribute vec4 color; diff --git a/src/modules/engines/gl_common/shader/rect_frag.h b/src/modules/engines/gl_common/shader/rect_frag.h index a879550..852a1b5 100644 --- a/src/modules/engines/gl_common/shader/rect_frag.h +++ b/src/modules/engines/gl_common/shader/rect_frag.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "uniform sampler2D tex;\n" "varying vec4 col;\n" diff --git a/src/modules/engines/gl_common/shader/rect_frag.shd b/src/modules/engines/gl_common/shader/rect_frag.shd index bb9221b..fe366c5 100644 --- a/src/modules/engines/gl_common/shader/rect_frag.shd +++ b/src/modules/engines/gl_common/shader/rect_frag.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/rect_vert.h b/src/modules/engines/gl_common/shader/rect_vert.h index 19e1b30..51d41aa 100644 --- a/src/modules/engines/gl_common/shader/rect_vert.h +++ b/src/modules/engines/gl_common/shader/rect_vert.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "attribute vec4 vertex;\n" "attribute vec4 color;\n" diff --git a/src/modules/engines/gl_common/shader/rect_vert.shd b/src/modules/engines/gl_common/shader/rect_vert.shd index ea2ed93..63fea5d 100644 --- a/src/modules/engines/gl_common/shader/rect_vert.shd +++ b/src/modules/engines/gl_common/shader/rect_vert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif attribute vec4 vertex; attribute vec4 color; diff --git a/src/modules/engines/gl_common/shader/tex_frag.h b/src/modules/engines/gl_common/shader/tex_frag.h index 29449f2..91edfa1 100644 --- a/src/modules/engines/gl_common/shader/tex_frag.h +++ b/src/modules/engines/gl_common/shader/tex_frag.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "uniform sampler2D tex;\n" "varying vec4 col;\n" diff --git a/src/modules/engines/gl_common/shader/tex_frag.shd b/src/modules/engines/gl_common/shader/tex_frag.shd index eb65760..d4cdf22 100644 --- a/src/modules/engines/gl_common/shader/tex_frag.shd +++ b/src/modules/engines/gl_common/shader/tex_frag.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/tex_nomul_frag.h b/src/modules/engines/gl_common/shader/tex_nomul_frag.h index d8a6338..26d3e0d 100644 --- a/src/modules/engines/gl_common/shader/tex_nomul_frag.h +++ b/src/modules/engines/gl_common/shader/tex_nomul_frag.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "uniform sampler2D tex;\n" "varying vec2 tex_c;\n" diff --git a/src/modules/engines/gl_common/shader/tex_nomul_frag.shd b/src/modules/engines/gl_common/shader/tex_nomul_frag.shd index 3f2ec6f..cfe1f1a 100644 --- a/src/modules/engines/gl_common/shader/tex_nomul_frag.shd +++ b/src/modules/engines/gl_common/shader/tex_nomul_frag.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex; varying vec2 tex_c; diff --git a/src/modules/engines/gl_common/shader/tex_nomul_vert.h b/src/modules/engines/gl_common/shader/tex_nomul_vert.h index 3a44f1a..13d5edd 100644 --- a/src/modules/engines/gl_common/shader/tex_nomul_vert.h +++ b/src/modules/engines/gl_common/shader/tex_nomul_vert.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "attribute vec4 vertex;\n" "attribute vec2 tex_coord;\n" diff --git a/src/modules/engines/gl_common/shader/tex_nomul_vert.shd b/src/modules/engines/gl_common/shader/tex_nomul_vert.shd index f4489b3..74f3207 100644 --- a/src/modules/engines/gl_common/shader/tex_nomul_vert.shd +++ b/src/modules/engines/gl_common/shader/tex_nomul_vert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif attribute vec4 vertex; attribute vec2 tex_coord; diff --git a/src/modules/engines/gl_common/shader/tex_vert.h b/src/modules/engines/gl_common/shader/tex_vert.h index ef035c8..8921d9d 100644 --- a/src/modules/engines/gl_common/shader/tex_vert.h +++ b/src/modules/engines/gl_common/shader/tex_vert.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "attribute vec4 vertex;\n" "attribute vec4 color;\n" diff --git a/src/modules/engines/gl_common/shader/tex_vert.shd b/src/modules/engines/gl_common/shader/tex_vert.shd index cf98501..606c297 100644 --- a/src/modules/engines/gl_common/shader/tex_vert.shd +++ b/src/modules/engines/gl_common/shader/tex_vert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif attribute vec4 vertex; attribute vec4 color; diff --git a/src/modules/engines/gl_common/shader/yuv_frag.h b/src/modules/engines/gl_common/shader/yuv_frag.h index f02d0be..4346e1d 100644 --- a/src/modules/engines/gl_common/shader/yuv_frag.h +++ b/src/modules/engines/gl_common/shader/yuv_frag.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "uniform sampler2D tex, texu, texv;\n" "varying vec4 col;\n" diff --git a/src/modules/engines/gl_common/shader/yuv_frag.shd b/src/modules/engines/gl_common/shader/yuv_frag.shd index a00cd6f..a1e1b8a 100644 --- a/src/modules/engines/gl_common/shader/yuv_frag.shd +++ b/src/modules/engines/gl_common/shader/yuv_frag.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex, texu, texv; varying vec4 col; diff --git a/src/modules/engines/gl_common/shader/yuv_nomul_frag.h b/src/modules/engines/gl_common/shader/yuv_nomul_frag.h index 9eeda68..6f70bec 100644 --- a/src/modules/engines/gl_common/shader/yuv_nomul_frag.h +++ b/src/modules/engines/gl_common/shader/yuv_nomul_frag.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "uniform sampler2D tex, texu, texv;\n" "varying vec2 tex_c, tex_c2, tex_c3;\n" diff --git a/src/modules/engines/gl_common/shader/yuv_nomul_frag.shd b/src/modules/engines/gl_common/shader/yuv_nomul_frag.shd index 3c2592d..bb5c825 100644 --- a/src/modules/engines/gl_common/shader/yuv_nomul_frag.shd +++ b/src/modules/engines/gl_common/shader/yuv_nomul_frag.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif uniform sampler2D tex, texu, texv; varying vec2 tex_c, tex_c2, tex_c3; diff --git a/src/modules/engines/gl_common/shader/yuv_nomul_vert.h b/src/modules/engines/gl_common/shader/yuv_nomul_vert.h index 8907f30..c3f585f 100644 --- a/src/modules/engines/gl_common/shader/yuv_nomul_vert.h +++ b/src/modules/engines/gl_common/shader/yuv_nomul_vert.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "attribute vec4 vertex;\n" "attribute vec2 tex_coord, tex_coord2, tex_coord3;\n" diff --git a/src/modules/engines/gl_common/shader/yuv_nomul_vert.shd b/src/modules/engines/gl_common/shader/yuv_nomul_vert.shd index 24b04e4..a83d505 100644 --- a/src/modules/engines/gl_common/shader/yuv_nomul_vert.shd +++ b/src/modules/engines/gl_common/shader/yuv_nomul_vert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif attribute vec4 vertex; attribute vec2 tex_coord, tex_coord2, tex_coord3; diff --git a/src/modules/engines/gl_common/shader/yuv_vert.h b/src/modules/engines/gl_common/shader/yuv_vert.h index 53b08bf..6ccf06d 100644 --- a/src/modules/engines/gl_common/shader/yuv_vert.h +++ b/src/modules/engines/gl_common/shader/yuv_vert.h @@ -1,5 +1,5 @@ "#ifdef GL_ES\n" -"precision mediump float;\n" +"precision highp float;\n" "#endif\n" "attribute vec4 vertex;\n" "attribute vec4 color;\n" diff --git a/src/modules/engines/gl_common/shader/yuv_vert.shd b/src/modules/engines/gl_common/shader/yuv_vert.shd index d69bf74..0ea0b2f 100644 --- a/src/modules/engines/gl_common/shader/yuv_vert.shd +++ b/src/modules/engines/gl_common/shader/yuv_vert.shd @@ -1,5 +1,5 @@ #ifdef GL_ES -precision mediump float; +precision highp float; #endif attribute vec4 vertex; attribute vec4 color; diff --git a/src/modules/engines/gl_sdl/evas_engine.c b/src/modules/engines/gl_sdl/evas_engine.c index 397f76a..332438a 100644 --- a/src/modules/engines/gl_sdl/evas_engine.c +++ b/src/modules/engines/gl_sdl/evas_engine.c @@ -467,6 +467,9 @@ eng_image_colorspace_set(void *data, void *image, int cspace) break; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: + case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: if (im->tex) evas_gl_common_texture_free(im->tex); im->tex = NULL; if (im->cs.data) @@ -598,9 +601,18 @@ eng_image_size_set(void *data, void *image, int w, int h) return image; } im_old = image; - if ((eng_image_colorspace_get(data, image) == EVAS_COLORSPACE_YCBCR422P601_PL) || - (eng_image_colorspace_get(data, image) == EVAS_COLORSPACE_YCBCR422P709_PL)) - w &= ~0x1; + + switch (eng_image_colorspace_get(data, image)) + { + case EVAS_COLORSPACE_YCBCR422P601_PL: + case EVAS_COLORSPACE_YCBCR422P709_PL: + case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: + w &= ~0x1; + break; + } + if ((im_old) && (im_old->im->cache_entry.w == w) && (im_old->im->cache_entry.h == h)) return image; if (im_old) @@ -686,6 +698,9 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i break; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: + case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: *image_data = im->cs.data; break; default: @@ -725,6 +740,9 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data) break; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: + case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: if (image_data != im->cs.data) { if (im->cs.data) diff --git a/src/modules/engines/gl_x11/evas_engine.c b/src/modules/engines/gl_x11/evas_engine.c index 9dd9923..58a131e 100644 --- a/src/modules/engines/gl_x11/evas_engine.c +++ b/src/modules/engines/gl_x11/evas_engine.c @@ -1064,6 +1064,9 @@ eng_image_colorspace_set(void *data, void *image, int cspace) break; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: + case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: if (im->tex) evas_gl_common_texture_free(im->tex); im->tex = NULL; if (im->cs.data) @@ -1707,9 +1710,18 @@ eng_image_size_set(void *data, void *image, int w, int h) return image; } im_old = image; - if ((eng_image_colorspace_get(data, image) == EVAS_COLORSPACE_YCBCR422P601_PL) || - (eng_image_colorspace_get(data, image) == EVAS_COLORSPACE_YCBCR422P709_PL)) - w &= ~0x1; + + switch (eng_image_colorspace_get(data, image)) + { + case EVAS_COLORSPACE_YCBCR422P601_PL: + case EVAS_COLORSPACE_YCBCR422P709_PL: + case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: + w &= ~0x1; + break; + } + if ((im_old) && ((int)im_old->im->cache_entry.w == w) && ((int)im_old->im->cache_entry.h == h)) @@ -1773,7 +1785,7 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) eng_window_use(re->win); - if ((im->tex) && (im->tex->pt) && (im->tex->pt->dyn.img)) + if ((im->tex) && (im->tex->pt) && (im->tex->pt->dyn.img) && (im->cs.space == EVAS_COLORSPACE_ARGB8888)) { *image_data = im->tex->pt->dyn.data = glsym_eglMapImageSEC(re->win->egl_disp, im->tex->pt->dyn.img); @@ -1798,6 +1810,16 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i eng_window_use(re->win); #endif + /* Engine can be fail to create texture after cache drop like eng_image_content_hint_set function, + so it is need to add code which check im->im's NULL value*/ + + if (!im->im) + { + *image_data = NULL; + if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + return NULL; + } + error = evas_cache_image_load_data(&im->im->cache_entry); switch (im->cs.space) { @@ -1817,7 +1839,7 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i { *image_data = NULL; if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; - return im; + return NULL; } evas_gl_common_image_free(im); im = im_new; @@ -1829,6 +1851,9 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i break; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: + case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: *image_data = im->cs.data; break; default: @@ -1850,13 +1875,16 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data) im = image; if (im->native.data) return image; eng_window_use(re->win); - if ((im->tex) && (im->tex->pt) && (im->tex->pt->dyn.data)) + if ((im->tex) && (im->tex->pt) + && (im->tex->pt->dyn.data) + && (im->cs.space == EVAS_COLORSPACE_ARGB8888)) { #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) glsym_eglUnmapImageSEC(re->win->egl_disp, im->tex->pt->dyn.img); #endif if (im->tex->pt->dyn.data == image_data) { + evas_gl_common_image_dirty(im, 0, 0, 0, 0); return image; } else @@ -1894,6 +1922,9 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data) break; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: + case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: if (image_data != im->cs.data) { if (im->cs.data) @@ -2571,6 +2602,7 @@ eng_gl_make_current(void *data, void *surface, void *context) ctx->current_sfc = NULL; sfc->current_ctx = NULL; + current_evgl_ctx = NULL; return ret; } @@ -2639,13 +2671,14 @@ eng_gl_make_current(void *data, void *surface, void *context) else // Bind FBO glBindFramebuffer(GL_FRAMEBUFFER, ctx->context_fbo); + + sfc->fbo_attached = 1; } // Set the current surface/context ctx->current_sfc = sfc; sfc->current_ctx = ctx; - - current_evgl_ctx = ctx; + current_evgl_ctx = ctx; return 1; } diff --git a/src/modules/engines/software_16_sdl/evas_engine.c b/src/modules/engines/software_16_sdl/evas_engine.c index 53e1995..02f9341 100644 --- a/src/modules/engines/software_16_sdl/evas_engine.c +++ b/src/modules/engines/software_16_sdl/evas_engine.c @@ -229,12 +229,19 @@ evas_engine_sdl16_output_free(void *data) if (re->tb) evas_common_tilebuf_free(re->tb); if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); if (re->tmp_out) evas_cache_image_drop(&re->tmp_out->cache_entry); - if (re->soft16_engine_image) evas_cache_engine_image_drop(&re->soft16_engine_image->cache_entry); + if (re->soft16_engine_image) + evas_cache_engine_image_drop(&re->soft16_engine_image->cache_entry); + if (re->cache) evas_cache_engine_image_shutdown(re->cache); + + if (re->update_rects) + free(re->update_rects); free(re); evas_common_font_shutdown(); evas_common_image_shutdown(); evas_common_soft16_image_shutdown(); + + SDL_QuitSubSystem(SDL_INIT_VIDEO); } static void @@ -243,7 +250,7 @@ evas_engine_sdl16_output_resize(void *data, int w, int h) Render_Engine *re = data; SDL_Surface *surface; - if ((re->w == w) && (re->h == h)) return; + if ((re->tb->outbuf_w == w) && (re->tb->outbuf_h == h)) return; evas_cache_engine_image_drop(&re->soft16_engine_image->cache_entry); @@ -335,6 +342,7 @@ evas_engine_sdl16_output_redraws_next_update_get(void *data, re->cur_rect = re->rects; if (re->rot != 0) _tmp_out_alloc(re); /* grows if required */ } + if (!re->cur_rect) { if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); @@ -528,6 +536,8 @@ evas_engine_sdl16_output_redraws_next_update_push(void *data, void *surface __UN _tmp_out_process(re, rect.x, rect.y, w, h); ++re->update_rects_count; + + evas_common_cpu_end_opt(); } static void @@ -571,7 +581,13 @@ evas_engine_sdl16_image_alpha_get(void *data __UNUSED__, void *image) if (!eim) return 1; im = (Soft16_Image *) eim->cache_entry.src; - if (im->cache_entry.flags.alpha) return 1; + switch (eim->cache_entry.src->space) + { + case EVAS_COLORSPACE_ARGB8888: + if (im->cache_entry.flags.alpha) return 1; + default: + break; + } return 0; } @@ -581,20 +597,28 @@ evas_engine_sdl16_image_size_get(void *data __UNUSED__, void *image, int *w, int SDL_Engine_Image_Entry *eim; eim = image; - if (w) *w = eim->cache_entry.w; - if (h) *h = eim->cache_entry.h; + if (w) *w = eim->cache_entry.src->w; + if (h) *h = eim->cache_entry.src->h; } static int evas_engine_sdl16_image_colorspace_get(void *data __UNUSED__, void *image __UNUSED__) { - return EVAS_COLORSPACE_RGB565_A5P; + SDL_Engine_Image_Entry *eim = image; + + if (!eim) return EVAS_COLORSPACE_RGB565_A5P; + return eim->cache_entry.src->space; } static void evas_engine_sdl16_image_colorspace_set(void *data __UNUSED__, void *image __UNUSED__, int cspace __UNUSED__) { - /* FIXME: Not implemented. */ + SDL_Engine_Image_Entry *eim = image; + + if (!eim) return; + if (eim->cache_entry.src->space == cspace) return; + + evas_cache_engine_image_colorspace(&eim->cache_entry, cspace, NULL); } static void* @@ -671,19 +695,20 @@ evas_engine_sdl16_image_data_get(void *data __UNUSED__, void *image, SDL_Engine_Image_Entry *eim = image; Soft16_Image *im; int error; - + if (!eim) { *image_data = NULL; + if (err) *err = EVAS_LOAD_ERROR_GENERIC; return NULL; } im = (Soft16_Image *) eim->cache_entry.src; - error = evas_cache_image_load_data(&im->cache_entry); if (to_write) - eim = (SDL_Engine_Image_Entry *) evas_cache_engine_image_alone(&eim->cache_entry, - NULL); + eim = (SDL_Engine_Image_Entry *) evas_cache_engine_image_dirty(&eim->cache_entry, + 0, 0, eim->cache_entry.src->w, eim->cache_entry.src->h); + error = evas_cache_image_load_data(&im->cache_entry); /* FIXME: Handle colorspace conversion correctly. */ if (image_data) *image_data = (DATA32 *) im->pixels; @@ -752,10 +777,8 @@ evas_engine_sdl16_image_alpha_set(void *data __UNUSED__, void *image, int has_al if (im->cache_entry.flags.alpha == has_alpha) return eim; - eim = (SDL_Engine_Image_Entry *) evas_cache_engine_image_alone(&eim->cache_entry, - NULL); - - im = (Soft16_Image *) eim->cache_entry.src; + //eim = (SDL_Engine_Image_Entry *) evas_cache_engine_image_alone(&eim->cache_entry, NULL); + //im = (Soft16_Image *) eim->cache_entry.src; im->cache_entry.flags.alpha = has_alpha; eim = (SDL_Engine_Image_Entry *) evas_cache_engine_image_dirty(&eim->cache_entry, 0, 0, eim->cache_entry.w, eim->cache_entry.h); @@ -810,6 +833,7 @@ evas_engine_sdl16_image_draw(void *data __UNUSED__, void *context, void *surface dst_region_x, dst_region_y, dst_region_w, dst_region_h, smooth); + evas_common_cpu_end_opt (); if (mustlock_im) SDL_UnlockSurface(eim->surface); @@ -882,10 +906,6 @@ evas_engine_sdl16_font_draw(void *data __UNUSED__, void *context, void *surface, Soft16_Image *dst = (Soft16_Image *) eim->cache_entry.src; int mustlock_im = 0; - if (!im) - im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get()); - evas_cache_image_surface_alloc(&im->cache_entry, dst->cache_entry.w, dst->cache_entry.h); - if (eim->surface && SDL_MUSTLOCK(eim->surface)) { mustlock_im = 1; @@ -897,7 +917,7 @@ evas_engine_sdl16_font_draw(void *data __UNUSED__, void *context, void *surface, evas_common_soft16_font_glyph_new, evas_common_soft16_font_glyph_free, evas_common_soft16_font_glyph_draw); - evas_common_font_draw(im, context, font, x, y, intl_props); + evas_common_font_draw((RGBA_Image *) eim->cache_entry.src, context, font, x, y, intl_props); evas_common_draw_context_font_ext_set(context, NULL, NULL, @@ -924,6 +944,7 @@ evas_engine_sdl16_line_draw(void *data __UNUSED__, void *context, void *surface, evas_common_soft16_line_draw((Soft16_Image *) eim->cache_entry.src, context, x1, y1, x2, y2); + evas_common_cpu_end_opt(); if (mustlock_im) SDL_UnlockSurface(eim->surface); @@ -955,6 +976,7 @@ evas_engine_sdl16_rectangle_draw(void *data __UNUSED__, void *context, void *sur im = (Soft16_Image *) eim->cache_entry.src; evas_common_soft16_rectangle_draw(im, context, x, y, w, h); + evas_common_cpu_end_opt(); if (mustlock_im) SDL_UnlockSurface(eim->surface); @@ -1004,6 +1026,7 @@ evas_engine_sdl16_polygon_draw(void *data __UNUSED__, void *context, void *surfa } evas_common_soft16_polygon_draw((Soft16_Image *) eim->cache_entry.src, context, polygon, x, y); + evas_common_cpu_end_opt(); if (mustlock_im) SDL_UnlockSurface(eim->surface); @@ -1144,15 +1167,20 @@ _sdl16_image_constructor(Engine_Image_Entry *ie, void* data __UNUSED__) im = (Soft16_Image *) ie->src; - if (im->pixels) + if (im) { - /* FIXME: Take care of CSPACE */ - sdl = SDL_CreateRGBSurfaceFrom(im->pixels, - ie->w, ie->h, - 16, ie->w * 2, - RMASK565, GMASK565, BMASK565, AMASK565); - eim->surface = sdl; - eim->flags.engine_surface = 0; + evas_cache_image_load_data(&im->cache_entry); + + if (im->pixels) + { + /* FIXME: Take care of CSPACE */ + sdl = SDL_CreateRGBSurfaceFrom(im->pixels, + ie->w, ie->h, + 16, ie->w * 2, + RMASK565, GMASK565, BMASK565, AMASK565); + eim->surface = sdl; + eim->flags.engine_surface = 0; + } } return EVAS_LOAD_ERROR_NONE; diff --git a/src/modules/engines/software_generic/evas_engine.c b/src/modules/engines/software_generic/evas_engine.c index 9663665..ceed58a 100644 --- a/src/modules/engines/software_generic/evas_engine.c +++ b/src/modules/engines/software_generic/evas_engine.c @@ -434,6 +434,8 @@ eng_image_data_get(void *data __UNUSED__, void *image, int to_write, DATA32 **im case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: *image_data = im->cs.data; break; default: @@ -470,6 +472,8 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data) case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: case EVAS_COLORSPACE_YCBCR422601_PL: + case EVAS_COLORSPACE_YCBCR420NV12601_PL: + case EVAS_COLORSPACE_YCBCR420TM12601_PL: if (image_data != im->cs.data) { if (im->cs.data) diff --git a/src/modules/engines/software_sdl/evas_engine.c b/src/modules/engines/software_sdl/evas_engine.c index 5a35db4..22c11b0 100644 --- a/src/modules/engines/software_sdl/evas_engine.c +++ b/src/modules/engines/software_sdl/evas_engine.c @@ -80,7 +80,6 @@ evas_engine_sdl_info_free (Evas* e __UNUSED__, void* info) Evas_Engine_Info_SDL* in; in = (Evas_Engine_Info_SDL*) info; free(in); - in = NULL; } /* SDL engine output manipulation function */ @@ -123,12 +122,14 @@ evas_engine_sdl_output_free (void *data) { Render_Engine* re = data; - if (re->cache) - evas_cache_engine_image_shutdown(re->cache); - - evas_common_tilebuf_free(re->tb); + if (re->tb) + evas_common_tilebuf_free(re->tb); if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); + if (re->rgba_engine_image) + evas_cache_engine_image_drop(&re->rgba_engine_image->cache_entry); + if (re->cache) + evas_cache_engine_image_shutdown(re->cache); if (re->update_rects) free(re->update_rects); @@ -233,7 +234,11 @@ evas_engine_sdl_output_redraws_next_update_get (void *data, re->cur_rect = EINA_INLIST_GET(re->rects); } if (!re->cur_rect) - return NULL; + { + if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); + re->rects = NULL; + return NULL; + } tb_rect = (Tilebuf_Rect*) re->cur_rect; *cx = *x = tb_rect->x; @@ -742,7 +747,7 @@ evas_engine_sdl_image_format_get(void *data __UNUSED__, void *image __UNUSED__) } static void -evas_engine_sdl_font_draw(void *data __UNUSED__, void *context, void *surface, void *font, int x, int y, int w __UNUSED__, int h __UNUSED__, int ow __UNUSED__, int oh __UNUSED__, const Eina_Unicode *text, const Evas_Text_Props *intl_props) +evas_engine_sdl_font_draw(void *data __UNUSED__, void *context, void *surface, void *font, int x, int y, int w __UNUSED__, int h __UNUSED__, int ow __UNUSED__, int oh __UNUSED__, const Evas_Text_Props *intl_props) { SDL_Engine_Image_Entry *eim = surface; int mustlock_im = 0; @@ -958,6 +963,9 @@ _sdl_output_setup (int w, int h, int fullscreen, int noframe, int alpha, int hw Render_Engine *re = calloc(1, sizeof(Render_Engine)); SDL_Surface *surface; + if (!re) + return NULL; + /* if we haven't initialized - init (automatic abort if already done) */ evas_common_cpu_init(); evas_common_blend_init(); @@ -977,8 +985,9 @@ _sdl_output_setup (int w, int h, int fullscreen, int noframe, int alpha, int hw re->cache = evas_cache_engine_image_init(&_sdl_cache_engine_image_cb, evas_common_image_cache_get()); if (!re->cache) { - CRIT("Evas_Cache_Engine_Image allocation failed!"); - exit(-1); + ERR("Evas_Cache_Engine_Image allocation failed!"); + free (re); + return NULL; } re->tb = evas_common_tilebuf_new(w, h); @@ -992,8 +1001,10 @@ _sdl_output_setup (int w, int h, int fullscreen, int noframe, int alpha, int hw if (!surface) { - CRIT("SDL_SetVideoMode [ %i x %i x 32 ] failed.", w, h); - exit(-1); + ERR("SDL_SetVideoMode [ %i x %i x 32 ] failed.", w, h); + evas_cache_engine_image_shutdown(re->cache); + free (re); + return NULL; } SDL_SetAlpha(surface, SDL_SRCALPHA | SDL_RLEACCEL, 0); @@ -1005,7 +1016,9 @@ _sdl_output_setup (int w, int h, int fullscreen, int noframe, int alpha, int hw if (!re->rgba_engine_image) { CRIT("RGBA_Image allocation from SDL failed"); - exit(-1); + evas_cache_engine_image_shutdown(re->cache); + free (re); + return NULL; } SDL_FillRect(surface, NULL, 0); diff --git a/src/modules/engines/software_x11/Makefile.am b/src/modules/engines/software_x11/Makefile.am index 9163fbe..5a2e345 100644 --- a/src/modules/engines/software_x11/Makefile.am +++ b/src/modules/engines/software_x11/Makefile.am @@ -40,6 +40,7 @@ AM_CPPFLAGS = \ @evas_engine_software_xcb_cflags@ SOFTWARE_X11_SOURCES += \ +evas_xcb_xdefaults.c \ evas_xcb_outbuf.c \ evas_xcb_buffer.c \ evas_xcb_color.c \ @@ -79,4 +80,6 @@ evas_xlib_buffer.h \ evas_xlib_color.h \ evas_xcb_outbuf.h \ evas_xcb_buffer.h \ -evas_xcb_color.h +evas_xcb_color.h \ +evas_xcb_xdefaults.h + diff --git a/src/modules/engines/software_x11/evas_engine.c b/src/modules/engines/software_x11/evas_engine.c index 908a84d..cb07032 100644 --- a/src/modules/engines/software_x11/evas_engine.c +++ b/src/modules/engines/software_x11/evas_engine.c @@ -12,6 +12,7 @@ #ifdef BUILD_ENGINE_SOFTWARE_XCB # include "evas_xcb_outbuf.h" # include "evas_xcb_color.h" +# include "evas_xcb_xdefaults.h" #endif int _evas_engine_soft_x11_log_dom = -1; @@ -242,6 +243,7 @@ _output_xcb_setup(int w, int h, int rot, xcb_connection_t *conn, int shape_dither, int destination_alpha) { Render_Engine *re; + int v = 0; if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL; @@ -250,7 +252,12 @@ _output_xcb_setup(int w, int h, int rot, xcb_connection_t *conn, evas_software_xcb_outbuf_init(); // FIXME: re->xrdb - re->xr.dpi = 75000; // dpy * 1000 + _evas_xcb_xdefaults_init(); + v = _evas_xcb_xdefaults_int_get("Xft", "dpi"); + _evas_xcb_xdefaults_shutdown(); + if (v) re->xr.dpi = (v * 1000); + else re->xr.dpi = 75000; // dpy * 1000 + evas_common_font_dpi_set(re->xr.dpi / 1000); re->ob = diff --git a/src/modules/loaders/generic/evas_image_load_generic.c b/src/modules/loaders/generic/evas_image_load_generic.c index 1a01714..54d9104 100644 --- a/src/modules/loaders/generic/evas_image_load_generic.c +++ b/src/modules/loaders/generic/evas_image_load_generic.c @@ -109,20 +109,27 @@ _load(Image_Entry *ie, const char *file, const char *key, int *error, Eina_Bool int w = 0, h = 0, alpha = 0; const char *dot1 = NULL, *dot2 = NULL, *end, *p; char *cmd = NULL, decoders[3][128], buf[4096]; - char *img_loader = "evas_image_loader"; // FIXME: specific path + char *loader = "/evas/utils/evas_image_loader"; + char *img_loader = NULL; + const char *libdir; // eg $libdir/evas/generic_loaders int cmd_len, len, decoders_num = 0, try_count = 0; int read_data = 0; char *tmpfname = NULL, *shmfname = NULL; - DATA32 *body; FILE *f; - // enough for command + params excluding filem key and loadopts - cmd_len = 1024 + strlen(img_loader); + libdir = _evas_module_libdir_get(); + cmd_len = strlen(libdir); + cmd_len += strlen(loader); + img_loader = alloca(cmd_len + 1); + strcpy(img_loader, libdir); + strcat(img_loader, loader); + // params excluding file, key and loadopts + cmd_len += 1024; cmd_len += strlen(file) * 2; if (key) cmd_len += strlen(key) * 2; - cmd = alloca(cmd_len); + cmd = alloca(cmd_len + 1); len = strlen(file); if (len < 1) diff --git a/src/modules/loaders/gif/evas_image_load_gif.c b/src/modules/loaders/gif/evas_image_load_gif.c index 220afe1..c350f97 100644 --- a/src/modules/loaders/gif/evas_image_load_gif.c +++ b/src/modules/loaders/gif/evas_image_load_gif.c @@ -371,7 +371,7 @@ _evas_image_load_frame_image_data(Image_Entry *ie, GifFileType *gif, Image_Entry *error = EVAS_LOAD_ERROR_CORRUPT_FILE; goto error; } - else /* find previous frame */ + else { Gif_Frame *gif_frame = NULL; ptr_src = new_frame->data; diff --git a/src/modules/loaders/jpeg/evas_image_load_jpeg.c b/src/modules/loaders/jpeg/evas_image_load_jpeg.c index 582b4e2..627f763 100644 --- a/src/modules/loaders/jpeg/evas_image_load_jpeg.c +++ b/src/modules/loaders/jpeg/evas_image_load_jpeg.c @@ -166,79 +166,52 @@ static const unsigned char App1[] = {0xff, 0xe1}; typedef enum { EXIF_BYTE_ALIGN_II, EXIF_BYTE_ALIGN_MM -}ExifByteAlign; +} ExifByteAlign; static int -_get_orientation(const char *path) +_get_orientation(void *map, size_t length) { - if (!path) return 0; - - /* open file and get 22type frome file */ - - FILE *f; - int size; - unsigned char buf[4096]; - unsigned char orientation[2]; + char *buf; + char orientation[2]; ExifByteAlign byte_align; - int num_directory = 0; - int i, j; + unsigned int num_directory = 0; + unsigned int i, j; int direction; - f = fopen (path, "rb"); - if (!f) return 0; - + /* open file and get 22 byte frome file */ + if (!map) return 0; /* 1. read 22byte */ - size = fread (buf, 1, 22, f); + if (length < 22) return 0; + buf = (char *)map; - if (size < 22) - { - fclose(f); - return 0; - } - - /* 2. check 2,3 bypte with APP1(0xFFE1) */ - if (memcmp(buf + 2, App1, sizeof (App1))) - { - fclose(f); - return 0; - } + /* 2. check 2,3 bypte with APP1(0xFFE1) */ + if (memcmp(buf + 2, App1, sizeof (App1))) return 0; /* 3. check 6~11bype with Exif Header (0x45786966 0000) */ - if (memcmp(buf + 6, ExifHeader, sizeof (ExifHeader))) - { - fclose(f); - return 0; - } + if (memcmp(buf + 6, ExifHeader, sizeof (ExifHeader))) return 0; /* 4. get 12&13 byte get info of "II(0x4949)" or "MM(0x4d4d)" */ /* 5. get [20]&[21] get directory entry # */ if (!strncmp(buf + 12, "MM", 2)) { byte_align = EXIF_BYTE_ALIGN_MM; - num_directory = ((buf[20] << 8) + buf[21]); + num_directory = ((*(buf + 20) << 8) + *(buf + 21)); orientation[0] = 0x01; orientation[1] = 0x12; } else if (!strncmp(buf + 12, "II", 2)) { byte_align = EXIF_BYTE_ALIGN_II; - num_directory = ((buf[21] << 8) + buf[20]); + num_directory = ((*(buf + 21) << 8) + *(buf + 20)); orientation[0] = 0x12; orientation[1] = 0x01; } - else - { - fclose(f); - return 0; - } + else return 0; + + buf = map + 22; + + if (length < (12 * num_directory + 22)) return 0; - if (fread(buf, 12, num_directory, f) > 4096) - { - fclose(f); - return 0; - } - /* we get all info from file, close file first */ - fclose(f); j = 0; for (i = 0; i < num_directory; i++ ) @@ -247,8 +220,8 @@ _get_orientation(const char *path) { /*get orientation tag */ if (byte_align == EXIF_BYTE_ALIGN_MM) - direction = buf[j + 11]; - else direction = buf[j + 8]; + direction = *(buf+ j + 11); + else direction = *(buf+ j + 8); switch (direction) { case 3: @@ -290,13 +263,13 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, jerr.pub.output_message = _JPEGErrorHandler; if (setjmp(jerr.setjmp_buffer)) { - jpeg_destroy_decompress(&cinfo); + jpeg_destroy_decompress(&cinfo); _evas_jpeg_membuf_src_term(&cinfo); - if (cinfo.saw_JFIF_marker) - *error = EVAS_LOAD_ERROR_CORRUPT_FILE; - else - *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; - return EINA_FALSE; + if (cinfo.saw_JFIF_marker) + *error = EVAS_LOAD_ERROR_CORRUPT_FILE; + else + *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; + return EINA_FALSE; } jpeg_create_decompress(&cinfo); @@ -315,10 +288,10 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, cinfo.dither_mode = JDITHER_ORDERED; jpeg_start_decompress(&cinfo); - /* head decoding */ + /* rotation decoding */ if (ie->load_opts.orientation) { - degree = _get_orientation(ie->file); + degree = _get_orientation(map, length); if (degree != 0) { ie->load_opts.degree = degree; @@ -329,6 +302,7 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, } } + /* head decoding */ w = cinfo.output_width; h = cinfo.output_height; @@ -337,21 +311,21 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, { jpeg_destroy_decompress(&cinfo); _evas_jpeg_membuf_src_term(&cinfo); - if (IMG_TOO_BIG(w, h)) - *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; - else - *error = EVAS_LOAD_ERROR_GENERIC; - return EINA_FALSE; + if (IMG_TOO_BIG(w, h)) + *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + else + *error = EVAS_LOAD_ERROR_GENERIC; + return EINA_FALSE; } if (ie->load_opts.scale_down_by > 1) { - w /= ie->load_opts.scale_down_by; - h /= ie->load_opts.scale_down_by; + w /= ie->load_opts.scale_down_by; + h /= ie->load_opts.scale_down_by; } else if (ie->load_opts.dpi > 0.0) { - w = (w * ie->load_opts.dpi) / 90.0; - h = (h * ie->load_opts.dpi) / 90.0; + w = (w * ie->load_opts.dpi) / 90.0; + h = (h * ie->load_opts.dpi) / 90.0; } else if ((ie->load_opts.w > 0) && (ie->load_opts.h > 0)) { @@ -366,26 +340,26 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, ie->load_opts.h = load_opts_w; } - if (ie->load_opts.w > 0) - { - w2 = ie->load_opts.w; - h2 = (ie->load_opts.w * h) / w; - if ((ie->load_opts.h > 0) && (h2 > ie->load_opts.h)) - { - unsigned int w3; - h2 = ie->load_opts.h; - w3 = (ie->load_opts.h * w) / h; - if (w3 > w2) - w2 = w3; - } - } - else if (ie->load_opts.h > 0) - { - h2 = ie->load_opts.h; - w2 = (ie->load_opts.h * w) / h; - } - w = w2; - h = h2; + if (ie->load_opts.w > 0) + { + w2 = ie->load_opts.w; + h2 = (ie->load_opts.w * h) / w; + if ((ie->load_opts.h > 0) && (h2 > ie->load_opts.h)) + { + unsigned int w3; + h2 = ie->load_opts.h; + w3 = (ie->load_opts.h * w) / h; + if (w3 > w2) + w2 = w3; + } + } + else if (ie->load_opts.h > 0) + { + h2 = ie->load_opts.h; + w2 = (ie->load_opts.h * w) / h; + } + w = w2; + h = h2; if (change_wh) { ie->load_opts.w = load_opts_w; @@ -397,26 +371,26 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, if ((w != cinfo.output_width) || (h != cinfo.output_height)) { - scalew = cinfo.output_width / w; - scaleh = cinfo.output_height / h; + scalew = cinfo.output_width / w; + scaleh = cinfo.output_height / h; - ie->scale = scalew; - if (scaleh < scalew) ie->scale = scaleh; + ie->scale = scalew; + if (scaleh < scalew) ie->scale = scaleh; - if (ie->scale > 8) ie->scale = 8; - else if (ie->scale < 1) ie->scale = 1; + if (ie->scale > 8) ie->scale = 8; + else if (ie->scale < 1) ie->scale = 1; - if (ie->scale == 3) ie->scale = 2; - else if (ie->scale == 5) ie->scale = 4; - else if (ie->scale == 6) ie->scale = 4; - else if (ie->scale == 7) ie->scale = 4; + if (ie->scale == 3) ie->scale = 2; + else if (ie->scale == 5) ie->scale = 4; + else if (ie->scale == 6) ie->scale = 4; + else if (ie->scale == 7) ie->scale = 4; } if (ie->scale > 1) { - jpeg_destroy_decompress(&cinfo); + jpeg_destroy_decompress(&cinfo); _evas_jpeg_membuf_src_term(&cinfo); - jpeg_create_decompress(&cinfo); + jpeg_create_decompress(&cinfo); if (_evas_jpeg_membuf_src(&cinfo, map, length)) { @@ -426,22 +400,22 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, return EINA_FALSE; } - jpeg_read_header(&cinfo, TRUE); - cinfo.do_fancy_upsampling = FALSE; - cinfo.do_block_smoothing = FALSE; - cinfo.scale_num = 1; - cinfo.scale_denom = ie->scale; - jpeg_calc_output_dimensions(&(cinfo)); - jpeg_start_decompress(&cinfo); + jpeg_read_header(&cinfo, TRUE); + cinfo.do_fancy_upsampling = FALSE; + cinfo.do_block_smoothing = FALSE; + cinfo.scale_num = 1; + cinfo.scale_denom = ie->scale; + jpeg_calc_output_dimensions(&(cinfo)); + jpeg_start_decompress(&cinfo); } ie->w = cinfo.output_width; ie->h = cinfo.output_height; - + // be nice and clip region to image. if its totally outside, fail load if ((ie->load_opts.region.w > 0) && (ie->load_opts.region.h > 0)) { - unsigned int load_region_x, load_region_y,load_region_w,load_region_h; + unsigned int load_region_x, load_region_y, load_region_w, load_region_h; if (ie->flags.rotated) { load_region_x = ie->load_opts.region.x; @@ -457,12 +431,12 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, ie->load_opts.region.w = load_region_h; ie->load_opts.region.h = load_region_w; break; - case 180: //done + case 180: ie->load_opts.region.x = w - (load_region_x+ load_region_w); ie->load_opts.region.y = h - (load_region_y + load_region_h); break; - case 270: //done + case 270: ie->load_opts.region.x = w - (load_region_y + load_region_h); ie->load_opts.region.y = load_region_x; ie->load_opts.region.w = load_region_h; @@ -480,8 +454,8 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, { jpeg_destroy_decompress(&cinfo); _evas_jpeg_membuf_src_term(&cinfo); - *error = EVAS_LOAD_ERROR_GENERIC; - return EINA_FALSE; + *error = EVAS_LOAD_ERROR_GENERIC; + return EINA_FALSE; } ie->w = ie->load_opts.region.w; ie->h = ie->load_opts.region.h; @@ -493,7 +467,8 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, ie->load_opts.region.h = load_region_h; } } - /* end head decoding */ +/* end head decoding */ + if (change_wh) { unsigned int tmp; @@ -508,15 +483,15 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, } /* - static double - get_time(void) - { +static double +get_time(void) +{ struct timeval timev; - + gettimeofday(&timev, NULL); return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000); - } - */ +} +*/ static Eina_Bool evas_image_load_file_data_jpeg_internal(Image_Entry *ie, @@ -530,28 +505,30 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, DATA32 *ptr2,*ptr_rotate; unsigned int x, y, l, i, scans; int region = 0; - unsigned int tmp, load_region_x, load_region_y, load_region_w, load_region_h;/* for rotation decoding */ /* rotation setting */ + unsigned int tmp, load_region_x, load_region_y, load_region_w, load_region_h; int degree = 0; Eina_Bool change_wh = EINA_FALSE; Eina_Bool line_done = EINA_FALSE; + if (ie->flags.rotated) { degree = ie->load_opts.degree; if (degree == 90 || degree == 270) change_wh = EINA_TRUE; } + cinfo.err = jpeg_std_error(&(jerr.pub)); jerr.pub.error_exit = _JPEGFatalErrorHandler; jerr.pub.emit_message = _JPEGErrorHandler2; jerr.pub.output_message = _JPEGErrorHandler; if (setjmp(jerr.setjmp_buffer)) { - jpeg_destroy_decompress(&cinfo); + jpeg_destroy_decompress(&cinfo); _evas_jpeg_membuf_src_term(&cinfo); - *error = EVAS_LOAD_ERROR_CORRUPT_FILE; - return EINA_FALSE; + *error = EVAS_LOAD_ERROR_CORRUPT_FILE; + return EINA_FALSE; } jpeg_create_decompress(&cinfo); @@ -571,8 +548,8 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, if (ie->scale > 1) { - cinfo.scale_num = 1; - cinfo.scale_denom = ie->scale; + cinfo.scale_num = 1; + cinfo.scale_denom = ie->scale; } /* Colorspace conversion options */ @@ -580,20 +557,20 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, /* GRAYSCLAE => RGB YCbCr => RGB and YCCK => CMYK */ switch (cinfo.jpeg_color_space) { - case JCS_UNKNOWN: - break; - case JCS_GRAYSCALE: - case JCS_RGB: - case JCS_YCbCr: - cinfo.out_color_space = JCS_RGB; - break; - case JCS_CMYK: - case JCS_YCCK: - cinfo.out_color_space = JCS_CMYK; - break; + case JCS_UNKNOWN: + break; + case JCS_GRAYSCALE: + case JCS_RGB: + case JCS_YCbCr: + cinfo.out_color_space = JCS_RGB; + break; + case JCS_CMYK: + case JCS_YCCK: + cinfo.out_color_space = JCS_CMYK; + break; } - /* head decoding */ +/* head decoding */ jpeg_calc_output_dimensions(&(cinfo)); jpeg_start_decompress(&cinfo); @@ -610,7 +587,6 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, if ((ie->load_opts.region.w > 0) && (ie->load_opts.region.h > 0)) { region = 1; -#ifdef BUILD_LOADER_JPEG_REGION if (ie->flags.rotated) { @@ -627,12 +603,12 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, ie->load_opts.region.w = load_region_h; ie->load_opts.region.h = load_region_w; break; - case 180: //done + case 180: ie->load_opts.region.x = w - (load_region_x+ load_region_w); ie->load_opts.region.y = h - (load_region_y + load_region_h); break; - case 270: //done + case 270: ie->load_opts.region.x = w - (load_region_y + load_region_h); ie->load_opts.region.y = load_region_x; ie->load_opts.region.w = load_region_h; @@ -643,6 +619,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, } } +#ifdef BUILD_LOADER_JPEG_REGION cinfo.region_x = ie->load_opts.region.x; cinfo.region_y = ie->load_opts.region.y; cinfo.region_w = ie->load_opts.region.w; @@ -651,12 +628,12 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, } if ((!region) && ((w != ie->w) || (h != ie->h))) { - // race condition, the file could have change from when we call header - // this test will not solve the problem with region code. - jpeg_destroy_decompress(&cinfo); + // race condition, the file could have change from when we call header + // this test will not solve the problem with region code. + jpeg_destroy_decompress(&cinfo); _evas_jpeg_membuf_src_term(&cinfo); - *error = EVAS_LOAD_ERROR_GENERIC; - return EINA_FALSE; + *error = EVAS_LOAD_ERROR_GENERIC; + return EINA_FALSE; } if ((region) && ((ie->w != ie->load_opts.region.w) || (ie->h != ie->load_opts.region.h))) @@ -669,28 +646,28 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, ((cinfo.output_components == 3) || (cinfo.output_components == 1))) || ((cinfo.out_color_space == JCS_CMYK) && (cinfo.output_components == 4)))) { - jpeg_destroy_decompress(&cinfo); + jpeg_destroy_decompress(&cinfo); _evas_jpeg_membuf_src_term(&cinfo); - *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; - return EINA_FALSE; + *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; + return EINA_FALSE; } - /* end head decoding */ - /* data decoding */ +/* end head decoding */ +/* data decoding */ if (cinfo.rec_outbuf_height > 16) { - jpeg_destroy_decompress(&cinfo); + jpeg_destroy_decompress(&cinfo); _evas_jpeg_membuf_src_term(&cinfo); - *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; - return EINA_FALSE; + *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; + return EINA_FALSE; } data = alloca(w * 16 * cinfo.output_components); evas_cache_image_surface_alloc(ie, ie->w, ie->h); if (ie->flags.loaded) { - jpeg_destroy_decompress(&cinfo); + jpeg_destroy_decompress(&cinfo); _evas_jpeg_membuf_src_term(&cinfo); - *error = EVAS_LOAD_ERROR_NONE; + *error = EVAS_LOAD_ERROR_NONE; if (region && ie->flags.rotated) { ie->load_opts.region.x = load_region_x; @@ -698,7 +675,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, ie->load_opts.region.w = load_region_w; ie->load_opts.region.h = load_region_h; } - return EINA_TRUE; + return EINA_TRUE; } if ((ie->flags.rotated) && change_wh) { @@ -706,7 +683,8 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, ptr_rotate = ptr2; } else - ptr2 = evas_cache_image_pixels(ie); + ptr2 = evas_cache_image_pixels(ie); + if (!ptr2) { *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; @@ -717,14 +695,14 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, if (cinfo.output_components == 4) { // FIXME: handle region - for (i = 0; (int)i < cinfo.rec_outbuf_height; i++) - line[i] = data + (i * w * 4); - for (l = 0; l < h; l += cinfo.rec_outbuf_height) - { - jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height); - scans = cinfo.rec_outbuf_height; - if ((h - l) < scans) scans = h - l; - ptr = data; + for (i = 0; (int)i < cinfo.rec_outbuf_height; i++) + line[i] = data + (i * w * 4); + for (l = 0; l < h; l += cinfo.rec_outbuf_height) + { + jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height); + scans = cinfo.rec_outbuf_height; + if ((h - l) < scans) scans = h - l; + ptr = data; if (!region) { for (y = 0; y < scans; y++) @@ -737,10 +715,10 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, /* that is C is replaces by 255 - C, etc...*/ /* See the comment below for the computation of RGB values from CMYK ones. */ *ptr2 = - (0xff000000) | - ((ptr[0] * ptr[3] / 255) << 16) | - ((ptr[1] * ptr[3] / 255) << 8) | - ((ptr[2] * ptr[3] / 255)); + (0xff000000) | + ((ptr[0] * ptr[3] / 255) << 16) | + ((ptr[1] * ptr[3] / 255) << 8) | + ((ptr[2] * ptr[3] / 255)); ptr += 4; ptr2++; } @@ -762,16 +740,16 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, /* B = (255 - Y) * (255 - K) / 255 */ /* with C, M, Y and K between 0 and 255. */ *ptr2 = - (0xff000000) | - (((255 - ptr[0]) * (255 - ptr[3]) / 255) << 16) | - (((255 - ptr[1]) * (255 - ptr[3]) / 255) << 8) | - (((255 - ptr[2]) * (255 - ptr[3]) / 255)); + (0xff000000) | + (((255 - ptr[0]) * (255 - ptr[3]) / 255) << 16) | + (((255 - ptr[1]) * (255 - ptr[3]) / 255) << 8) | + (((255 - ptr[2]) * (255 - ptr[3]) / 255)); ptr += 4; ptr2++; } } - } - } + } + } else { // if line # > region last line, break @@ -786,7 +764,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, return EINA_FALSE;*/ } // els if scan block intersects region start or later - else if ((l + scans) > + else if ((l + scans) > (ie->load_opts.region.y)) { for (y = 0; y < scans; y++) @@ -803,10 +781,10 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, /* that is C is replaces by 255 - C, etc...*/ /* See the comment below for the computation of RGB values from CMYK ones. */ *ptr2 = - (0xff000000) | - ((ptr[0] * ptr[3] / 255) << 16) | - ((ptr[1] * ptr[3] / 255) << 8) | - ((ptr[2] * ptr[3] / 255)); + (0xff000000) | + ((ptr[0] * ptr[3] / 255) << 16) | + ((ptr[1] * ptr[3] / 255) << 8) | + ((ptr[2] * ptr[3] / 255)); ptr += 4; ptr2++; } @@ -828,10 +806,10 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, /* B = (255 - Y) * (255 - K) / 255 */ /* with C, M, Y and K between 0 and 255. */ *ptr2 = - (0xff000000) | - (((255 - ptr[0]) * (255 - ptr[3]) / 255) << 16) | - (((255 - ptr[1]) * (255 - ptr[3]) / 255) << 8) | - (((255 - ptr[2]) * (255 - ptr[3]) / 255)); + (0xff000000) | + (((255 - ptr[0]) * (255 - ptr[3]) / 255) << 16) | + (((255 - ptr[1]) * (255 - ptr[3]) / 255) << 8) | + (((255 - ptr[2]) * (255 - ptr[3]) / 255)); ptr += 4; ptr2++; } @@ -843,35 +821,35 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, } } } - } + } } /* We handle then RGB with 3 components */ else if (cinfo.output_components == 3) { - /* - double t; - if (region) - { - // debug for now - printf("R| %p %5ix%5i %s: %5i %5i %5ix%5i - ", - ie, - ie->w, ie->h, - ie->file, - ie->load_opts.region.x, - ie->load_opts.region.y, - ie->load_opts.region.w, - ie->load_opts.region.h); - } +/* + double t; + if (region) + { + // debug for now + printf("R| %p %5ix%5i %s: %5i %5i %5ix%5i - ", + ie, + ie->w, ie->h, + ie->file, + ie->load_opts.region.x, + ie->load_opts.region.y, + ie->load_opts.region.w, + ie->load_opts.region.h); + } t = get_time(); - */ + */ for (i = 0; (int)i < cinfo.rec_outbuf_height; i++) - line[i] = data + (i * w * 3); - for (l = 0; l < h; l += cinfo.rec_outbuf_height) - { - jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height); - scans = cinfo.rec_outbuf_height; - if ((h - l) < scans) scans = h - l; - ptr = data; + line[i] = data + (i * w * 3); + for (l = 0; l < h; l += cinfo.rec_outbuf_height) + { + jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height); + scans = cinfo.rec_outbuf_height; + if ((h - l) < scans) scans = h - l; + ptr = data; if (!region) { for (y = 0; y < scans; y++) @@ -883,7 +861,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, ptr2++; } } - } + } else { // if line # > region last line, break @@ -895,7 +873,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, goto done; } // else if scan block intersects region start or later - else if ((l + scans) > + else if ((l + scans) > (ie->load_opts.region.y)) { for (y = 0; y < scans; y++) @@ -917,23 +895,23 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, } } } - } - /* - t = get_time() - t; - printf("%3.3f\n", t); - */ + } +/* + t = get_time() - t; + printf("%3.3f\n", t); + */ } /* We finally handle RGB with 1 component */ else if (cinfo.output_components == 1) { - for (i = 0; (int)i < cinfo.rec_outbuf_height; i++) - line[i] = data + (i * w); - for (l = 0; l < h; l += cinfo.rec_outbuf_height) - { - jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height); - scans = cinfo.rec_outbuf_height; - if ((h - l) < scans) scans = h - l; - ptr = data; + for (i = 0; (int)i < cinfo.rec_outbuf_height; i++) + line[i] = data + (i * w); + for (l = 0; l < h; l += cinfo.rec_outbuf_height) + { + jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height); + scans = cinfo.rec_outbuf_height; + if ((h - l) < scans) scans = h - l; + ptr = data; if (!region) { for (y = 0; y < scans; y++) @@ -945,7 +923,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, ptr2++; } } - } + } else { // if line # > region last line, break @@ -960,7 +938,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, return EINA_TRUE;*/ } // els if scan block intersects region start or later - else if ((l + scans) > + else if ((l + scans) > (ie->load_opts.region.y)) { for (y = 0; y < scans; y++) @@ -982,10 +960,11 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, } } } - } + } } /* if rotation operation need, rotate it */ done: + if (ie->flags.rotated) { DATA32 *data1, *data2, *to, *from; @@ -1061,7 +1040,6 @@ done: ie->load_opts.region.h = load_region_h; } } - if (line_done) { jpeg_destroy_decompress(&cinfo); @@ -1090,8 +1068,8 @@ evas_image_load_file_data_jpeg_alpha_internal(Image_Entry *ie, FILE *f, int *err if (!f) { - *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; - return EINA_FALSE; + *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; + return EINA_FALSE; } cinfo.err = jpeg_std_error(&(jerr.pub)); jerr.pub.error_exit = _JPEGFatalErrorHandler; @@ -1099,9 +1077,9 @@ evas_image_load_file_data_jpeg_alpha_internal(Image_Entry *ie, FILE *f, int *err jerr.pub.output_message = _JPEGErrorHandler; if (setjmp(jerr.setjmp_buffer)) { - jpeg_destroy_decompress(&cinfo); - *error = EVAS_LOAD_ERROR_CORRUPT_FILE; - return EINA_FALSE; + jpeg_destroy_decompress(&cinfo); + *error = EVAS_LOAD_ERROR_CORRUPT_FILE; + return EINA_FALSE; } jpeg_create_decompress(&cinfo); jpeg_stdio_src(&cinfo, f); @@ -1110,73 +1088,73 @@ evas_image_load_file_data_jpeg_alpha_internal(Image_Entry *ie, FILE *f, int *err cinfo.do_block_smoothing = FALSE; jpeg_start_decompress(&cinfo); - /* head decoding */ +/* head decoding */ ie->w = w = cinfo.output_width; ie->h = h = cinfo.output_height; - /* end head decoding */ - /* data decoding */ +/* end head decoding */ +/* data decoding */ if (cinfo.rec_outbuf_height > 16) { - jpeg_destroy_decompress(&cinfo); - *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; - return EINA_FALSE;; + jpeg_destroy_decompress(&cinfo); + *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; + return EINA_FALSE;; } data = alloca(w * 16 * 3); if (!ie->flags.loaded) { - jpeg_destroy_decompress(&cinfo); - *error = EVAS_LOAD_ERROR_NONE; - return EINA_TRUE; + jpeg_destroy_decompress(&cinfo); + *error = EVAS_LOAD_ERROR_NONE; + return EINA_TRUE; } ptr2 = evas_cache_image_pixels(ie); prevy = 0; if (cinfo.output_components == 3) { - for (i = 0; i < cinfo.rec_outbuf_height; i++) - line[i] = data + (i * w * 3); - for (l = 0; l < h; l += cinfo.rec_outbuf_height) - { - jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height); - scans = cinfo.rec_outbuf_height; - if ((h - l) < scans) scans = h - l; - ptr = data; - for (y = 0; y < scans; y++) - { - for (x = 0; x < w; x++) - { - *ptr2 = - ((*ptr2) & 0x00ffffff) | - (((ptr[0] + ptr[1] + ptr[2]) / 3) << 24); - ptr += 3; - ptr2++; - } - } - } + for (i = 0; i < cinfo.rec_outbuf_height; i++) + line[i] = data + (i * w * 3); + for (l = 0; l < h; l += cinfo.rec_outbuf_height) + { + jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height); + scans = cinfo.rec_outbuf_height; + if ((h - l) < scans) scans = h - l; + ptr = data; + for (y = 0; y < scans; y++) + { + for (x = 0; x < w; x++) + { + *ptr2 = + ((*ptr2) & 0x00ffffff) | + (((ptr[0] + ptr[1] + ptr[2]) / 3) << 24); + ptr += 3; + ptr2++; + } + } + } } else if (cinfo.output_components == 1) { - for (i = 0; i < cinfo.rec_outbuf_height; i++) - line[i] = data + (i * w); - for (l = 0; l < h; l += cinfo.rec_outbuf_height) - { - jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height); - scans = cinfo.rec_outbuf_height; - if ((h - l) < scans) scans = h - l; - ptr = data; - for (y = 0; y < scans; y++) - { - for (x = 0; x < w; x++) - { - *ptr2 = - ((*ptr2) & 0x00ffffff) | - ((ptr[0]) << 24); - ptr++; - ptr2++; - } - } - } + for (i = 0; i < cinfo.rec_outbuf_height; i++) + line[i] = data + (i * w); + for (l = 0; l < h; l += cinfo.rec_outbuf_height) + { + jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height); + scans = cinfo.rec_outbuf_height; + if ((h - l) < scans) scans = h - l; + ptr = data; + for (y = 0; y < scans; y++) + { + for (x = 0; x < w; x++) + { + *ptr2 = + ((*ptr2) & 0x00ffffff) | + ((ptr[0]) << 24); + ptr++; + ptr2++; + } + } + } } - /* end data decoding */ +/* end data decoding */ jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); *error = EVAS_LOAD_ERROR_NONE; @@ -1196,13 +1174,13 @@ evas_image_load_file_head_jpeg(Image_Entry *ie, f = eina_file_open(file, EINA_FALSE); if (!f) { - *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; - return EINA_FALSE; + *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; + return EINA_FALSE; } map = eina_file_map_all(f, EINA_FILE_WILLNEED); if (!map) { - *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; + *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; goto on_error; } @@ -1212,7 +1190,7 @@ evas_image_load_file_head_jpeg(Image_Entry *ie, eina_file_map_free(f, map); -on_error: + on_error: eina_file_close(f); return val; } @@ -1229,8 +1207,8 @@ evas_image_load_file_data_jpeg(Image_Entry *ie, f = eina_file_open(file, EINA_FALSE); if (!f) { - *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; - return EINA_FALSE; + *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; + return EINA_FALSE; } map = eina_file_map_all(f, EINA_FILE_WILLNEED); if (!map) @@ -1245,7 +1223,7 @@ evas_image_load_file_data_jpeg(Image_Entry *ie, eina_file_map_free(f, map); -on_error: + on_error: eina_file_close(f); return val; } @@ -1269,8 +1247,8 @@ static Evas_Module_Api evas_modapi = "jpeg", "none", { - module_open, - module_close + module_open, + module_close } }; diff --git a/src/tests/evas_test_textblock.c b/src/tests/evas_test_textblock.c index d868080..8252109 100644 --- a/src/tests/evas_test_textblock.c +++ b/src/tests/evas_test_textblock.c @@ -884,6 +884,14 @@ START_TEST(evas_textblock_format_removal) fnode = evas_textblock_node_format_next_get(fnode); fail_if (fnode); + /* Remove two pairs with the same name and same positions. */ + evas_object_textblock_text_markup_set(tb, "A"); + evas_textblock_cursor_pos_set(cur, 0); + evas_textblock_cursor_char_delete(cur); + + fnode = evas_textblock_node_format_first_get(tb); + fail_if (fnode); + /* Try to remove a format that doesn't have a pair (with a bad mkup) */ evas_object_textblock_text_markup_set(tb, "abcde"); evas_textblock_cursor_pos_set(cur, 2); -- 2.7.4