svn update: 58050 (latest:58050)
authorShinwoo Kim <cinoo.kim@samsung.com>
Tue, 29 Mar 2011 09:24:10 +0000 (18:24 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Tue, 29 Mar 2011 09:24:10 +0000 (18:24 +0900)
70 files changed:
AUTHORS
ChangeLog
README.in
configure.ac
doc/evas.dox.in
evas.spec.in
m4/evas_check_loader.m4
src/lib/Evas.h
src/lib/Makefile.am
src/lib/cache/evas_cache_image.c
src/lib/canvas/evas_clip.c
src/lib/canvas/evas_object_image.c
src/lib/canvas/evas_object_line.c
src/lib/canvas/evas_object_main.c
src/lib/canvas/evas_object_textblock.c
src/lib/canvas/evas_render.c
src/lib/engines/common/Makefile.am
src/lib/engines/common/evas_font_draw.c
src/lib/engines/common/evas_font_ot.c
src/lib/engines/common/evas_font_private.h
src/lib/engines/common/evas_image_load.c
src/lib/engines/common/evas_pipe.c
src/lib/engines/common/evas_text_utils.c
src/lib/engines/common_16/evas_soft16_line.c
src/lib/file/evas_module.c
src/lib/include/evas_cairo_common.h
src/lib/include/evas_common.h
src/lib/include/evas_inline.x
src/lib/include/evas_private.h
src/modules/engines/Makefile.am
src/modules/engines/buffer/Makefile.am
src/modules/engines/cairo_x11/Makefile.am
src/modules/engines/direct3d/Makefile.am
src/modules/engines/directfb/Makefile.am
src/modules/engines/fb/Makefile.am
src/modules/engines/gl_common/evas_gl_common.h
src/modules/engines/gl_common/evas_gl_context.c
src/modules/engines/gl_common/evas_gl_font.c
src/modules/engines/gl_common/evas_gl_image.c
src/modules/engines/gl_common/evas_gl_line.c
src/modules/engines/gl_common/evas_gl_polygon.c
src/modules/engines/gl_common/evas_gl_rectangle.c
src/modules/engines/gl_common/evas_gl_texture.c
src/modules/engines/gl_glew/Makefile.am
src/modules/engines/gl_glew/evas_engine.h
src/modules/engines/gl_sdl/Makefile.am
src/modules/engines/gl_sdl/evas_engine.h
src/modules/engines/gl_x11/Makefile.am
src/modules/engines/gl_x11/evas_engine.c
src/modules/engines/gl_x11/evas_engine.h
src/modules/engines/gl_x11/evas_x_main.c
src/modules/engines/quartz/Makefile.am
src/modules/engines/software_16/Makefile.am
src/modules/engines/software_16_ddraw/Makefile.am
src/modules/engines/software_16_sdl/Makefile.am
src/modules/engines/software_16_wince/Makefile.am
src/modules/engines/software_16_x11/Makefile.am
src/modules/engines/software_8/Makefile.am
src/modules/engines/software_8_x11/Makefile.am
src/modules/engines/software_ddraw/Makefile.am
src/modules/engines/software_gdi/Makefile.am
src/modules/engines/software_generic/Makefile.am
src/modules/engines/software_qtopia/Makefile.am
src/modules/engines/software_sdl/Makefile.am
src/modules/engines/software_x11/Makefile.am
src/modules/engines/xrender_x11/Makefile.am
src/modules/loaders/Makefile.am
src/modules/loaders/bmp/evas_image_load_bmp.c
src/modules/loaders/ico/Makefile.am [new file with mode: 0644]
src/modules/loaders/ico/evas_image_load_ico.c [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index d9c7f7b..75b5960 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -18,5 +18,7 @@ Tom Hacohen <tom@stosb.com>
 Mathieu Taillefumier <mathieu.taillefumier@free.fr>
 Iván Briano <ivan@profusion.mobi>
 Gustavo Lima Chaves <glima@profusion.mobi>
-Saumsung Electronics <tbd>
+Samsung Electronics <tbd>
 Samsung SAIT <tbd>
+Sung W. Park <sungwoo@gmail.com>
+Jiyoun Park <jy0703.park@samsung.com>
index 3e796e7..73dbbbc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 2011-02-27  Vincent Torri
 
        * Fixed static linking of the bmp, wbmp and tga loaders
+
+2011-03-07  Mike Blumenkrantz
+
+        * Fix segv when trying to set gl viewpoint with NULL ctx
+
+2011-03-08  Carsten Haitzler (The Rasterman)
+
+       * Fix problem with different x vsync api between SGI and EXT flavor
+        as they have the same base name, but different prototypes
+        * Add evas_object_ref() and evas_object_unref() to defer
+        deletion of objects until all references are removed
+
+2011-03-09  Carsten Haitzler (The Rasterman)
+
+       * Fix bug with evas_object_del() calling DEL callback BEFORE
+        the HIDE one.
+
+2011-03-10  Sung W. Park
+
+       * Fix bug with yinvert handling of native surfaces.
+
+2011-03-10  Carsten Haitzler (The Rasterman)
+
+       * Fix issue with loading alpha BMP's with "check if all pixel alpha
+        are 0 or not and then force alpha off if all are 0". This
+        means you can never have a 100% empty/transparent BMP though
+        in 32bpp mode.
+
+2011-03-11  Carsten Haitzler (The Rasterman)
+
+       * Add ICO loader to evas (also can load CUR cursor files in theory)
+
+2011-03-14  Carsten Haitzler (The Rasterman)
+
+       * Add "load from memory" API: evas_object_image_memfile_set() by
+        popular demand. Can load an image format from a memory address.
+
+2011-03-15  Cedric BAIL
+
+       * Fix issues with clipping and map.
+
+2011-03-18  Jiyoun Park
+
+       * Fix wrong call to free when using mempool for Evas_Object.
+
+2011-03-19  Carsten Haitzler (The Rasterman)
+
+       * Caching and timestamp checker for image files made much more
+        pedantic and it checks not just modified timestamp but also
+        inode number, size, and on linux, the nanonsecond resolution
+        timestamp as well.
+
+2011-03-19  Brett Nash (nash)
+
+       * Proxy: Bypass the clip on smart clipped objects.  This is probably
+       what you want if you are using proxies, as it means clips don't cause
+       the object to be invisible by the proxy.
+
+2011-03-22  Gustavo Sverzut Barbieri (k-s)
+
+       * Fix build of GL and static modules.
+       * Fix ico loader static build.
index 29a581d..bfcfaba 100644 (file)
--- a/README.in
+++ b/README.in
@@ -1,4 +1,4 @@
-Evas @VERSION@ BETA
+Evas @VERSION@
 
 ******************************************************************************
 
@@ -799,7 +799,8 @@ draw large runs effectively.
 
 However it is useless on GL and similar back-ends as the cost in
 sending a word sized texture kills the performance gain (and GL is
-pretty good at drawing lots of small things anyway).
+pretty good at drawing lots of small things anyway).  If it detects a GL
+backend is in use, it disables itself.
 
 By default words (strings) of more then 50 characters are not cached.
 The system caches 40 words by default, but this can be changed by
@@ -820,14 +821,15 @@ Metric caching saves character metrics between characters in words.
 This enables it to render words much quicker as it avoids things like
 space calculations and kerning calculation.
 
-The cache size is also controlled by  EVAS_WORD_CACHE_MAX_WORDS
+The cache size is also controlled by EVAS_WORD_CACHE_MAX_WORDS.
 
 It is useful for GL in particular, although software engines do get
 some gain.
 
-Generally it is recommended you enable either word or metric caching,
-depending on your engine use.  If you are using software, enable word
+Generally it is recommended you enable one or both of word or metric caching,
+depending on your engine use.  If you are only using software, enable word
 caching (and neon on arm if you can), for GL, turn on metric caching.
+A simple solution is enable both, and let the engine sort it out at run time.
 
 If you have any issues with metric caching, please report them to either
 the e-devel mailing list or Brett Nash <nash@nash.id.uau>
index d986ce2..72342ca 100644 (file)
@@ -126,6 +126,7 @@ want_evas_image_loader_xpm="yes"
 want_evas_image_loader_bmp="yes"
 want_evas_image_loader_tga="yes"
 want_evas_image_loader_wbmp="yes"
+want_evas_image_loader_ico="yes"
 
 want_evas_font_loader_eet="yes"
 
@@ -632,13 +633,17 @@ EVAS_CHECK_ENGINE([software-16-wince], [${want_evas_engine_software_16_wince}],
 
 # common gl
 have_evas_engine_gl_common="no"
+have_static_evas_engine_gl_common="no"
 if test "x$have_evas_engine_gl_x11" = "xyes" \
-   || test "x$have_evas_engine_gl_x11" = "xstatic" \
    || test "x$have_evas_engine_gl_glew" = "xyes" \
+   || test "x$have_evas_engine_gl_sdl" = "xyes"; then
+   have_evas_engine_gl_common="yes"
+fi
+if test "x$have_evas_engine_gl_x11" = "xstatic" \
    || test "x$have_evas_engine_gl_glew" = "xstatic" \
-   || test "x$have_evas_engine_gl_sdl" = "xyes" \
    || test "x$have_evas_engine_gl_sdl" = "xstatic"; then
    have_evas_engine_gl_common="yes"
+   have_static_evas_engine_gl_common="yes"
 fi
 
 if test "x$have_evas_engine_gl_common" = "xyes"; then
@@ -650,6 +655,11 @@ AC_SUBST([evas_engine_gl_common_libs])
 
 AM_CONDITIONAL(BUILD_ENGINE_GL_COMMON, [test "x$have_evas_engine_gl_common" = "xyes"])
 
+AM_CONDITIONAL(EVAS_STATIC_BUILD_GL_COMMON, test "x${have_static_evas_engine_gl_common}" = "xyes")
+if test "x${have_static_evas_engine_gl_common}" = "xyes"; then
+   AC_DEFINE(EVAS_STATIC_BUILD_GL_COMMON, [1], [Build GL generic engine as part of libevas])
+fi
+
 # gl_sdl
 if test "x$have_evas_engine_gl_sdl" = "xyes" || test "x$have_evas_engine_gl_sdl" = "xstatic" ; then
    AC_CHECK_DECL(SDL_GL_CONTEXT_MAJOR_VERSION,
@@ -686,6 +696,11 @@ AC_ARG_ENABLE([static-software-generic],
 AC_MSG_CHECKING([Whether to build software generic engine as part of libevas])
 AC_MSG_RESULT([${have_static_software_generic}])
 
+if test "x${have_static_module}" = "xyes" -a "x${have_static_software_generic}" = "xno"; then
+   AC_MSG_WARN([Forcing --enable-static-software-generic as engines must be compiled statically])
+   have_static_software_generic="yes"
+fi
+
 AM_CONDITIONAL(EVAS_STATIC_BUILD_SOFTWARE_GENERIC, test "x${have_static_software_generic}" = "xyes")
 if test "x${have_static_software_generic}" = "xyes"; then
    AC_DEFINE(EVAS_STATIC_BUILD_SOFTWARE_GENERIC, [1], [Build software generic engine as part of libevas])
@@ -820,6 +835,7 @@ EVAS_CHECK_IMAGE_LOADER([TGA], [${want_evas_image_loader_tga}])
 
 EVAS_CHECK_IMAGE_LOADER([WBMP], [${want_evas_image_loader_wbmp}])
 
+EVAS_CHECK_IMAGE_LOADER([ICO], [${want_evas_image_loader_ico}])
 
 #####################################################################
 ## Cpu based optimizations
@@ -1595,6 +1611,7 @@ src/modules/loaders/png/Makefile
 src/modules/loaders/tiff/Makefile
 src/modules/loaders/xpm/Makefile
 src/modules/loaders/bmp/Makefile
+src/modules/loaders/ico/Makefile
 src/modules/loaders/tga/Makefile
 src/modules/loaders/svg/Makefile
 src/modules/loaders/pmaps/Makefile
@@ -1690,18 +1707,19 @@ echo "  Software 16bit WinCE.......: $have_evas_engine_software_16_wince"
 echo "  Software 16bit SDL.........: $have_evas_engine_software_sdl (primitive: $sdl_primitive)"
 echo
 echo "Image Loaders:"
+echo "  BMP.....................: $have_evas_image_loader_bmp"
 echo "  EDB.....................: $have_evas_image_loader_edb"
 echo "  EET.....................: $have_evas_image_loader_eet"
 echo "  GIF.....................: $have_evas_image_loader_gif"
+echo "  ICO.....................: $have_evas_image_loader_ico"
 echo "  JPEG....................: $have_evas_image_loader_jpeg (region: $have_jpeg_region)"
 echo "  PMAPS...................: $have_evas_image_loader_pmaps"
 echo "  PNG.....................: $have_evas_image_loader_png"
 echo "  SVG.....................: $have_evas_image_loader_svg"
-echo "  TIFF....................: $have_evas_image_loader_tiff"
-echo "  XPM.....................: $have_evas_image_loader_xpm"
-echo "  BMP.....................: $have_evas_image_loader_bmp"
 echo "  TGA.....................: $have_evas_image_loader_tga"
+echo "  TIFF....................: $have_evas_image_loader_tiff"
 echo "  WBMP....................: $have_evas_image_loader_wbmp"
+echo "  XPM.....................: $have_evas_image_loader_xpm"
 echo
 echo "Font Sourcing Systems:"
 echo "  EET.....................: $have_evas_font_loader_eet"
@@ -1803,8 +1821,8 @@ echo "  prefix...............: $prefix"
 echo
 if test "x${have_static_module}" = "xyes" ; then
 echo -e "\0033\01331;31mWarning\0033\01331;0m: You are trying to link statically one or more modules to Evas."
-echo "         You must know what you are doing, or else you will have a lot of problems."
-echo "         And Kenny will be killed."
+echo "         You must know what you are doing, or else you will have a lot of"
+echo "         problems. And Kenny will be killed."
 echo "         Think about that."
 echo
 fi
index 9ec03a0..2721361 100644 (file)
@@ -27,6 +27,8 @@
 @author Gustavo Lima Chaves <glima@@profusion.mobi>
 @author Samsung Electronics <tbd>
 @author Samsung SAIT <tbd>
+@author Sung W. Park <sungwoo@@gmail.com>
+@author Jiyoun Park <jy0703.park@@samsung.com>
 @date 2000-2011
 
 @section toc Table of Contents
index 58d59bf..ff110f1 100644 (file)
@@ -44,6 +44,7 @@
 %bcond_without module_saver_eet
 %bcond_without module_loader_xpm
 %bcond_without module_loader_bmp
+%bcond_without module_loader_wbmp
 %bcond_without module_loader_tga
 
 # This just keeps a missing doxygen from killing the build.
@@ -60,6 +61,7 @@
 %define ac_with_module_loader_xpm --%{?with_module_loader_xpm:en}%{!?with_module_loader_xpm:dis}able-image-loader-xpm
 %define ac_with_module_loader_svg --%{?with_module_loader_svg:en}%{!?with_module_loader_svg:dis}able-image-loader-svg
 %define ac_with_module_loader_bmp --%{?with_module_loader_bmp:en}%{!?with_module_loader_bmp:dis}able-image-loader-bmp
+%define ac_with_module_loader_wbmp --%{?with_module_loader_wbmp:en}%{!?with_module_loader_wbmp:dis}able-image-loader-wbmp
 %define ac_with_module_loader_tga --%{?with_module_loader_tga:en}%{!?with_module_loader_tga:dis}able-image-loader-tga
 %define ac_with_module_saver_eet --%{?with_module_saver_eet:en}%{!?with_module_saver_eet:dis}able-image-saver-eet
 %define ac_with_module_saver_jpeg --%{?with_module_saver_jpeg:en}%{!?with_module_saver_jpeg:dis}able-image-saver-jpeg
@@ -247,6 +249,15 @@ BuildRequires: libjpeg-devel
 BMP Image loader module for Evas
 %endif
 
+%if %{with module_loader_wbmp}
+%package module_loader_wbmp
+Summary: WBMP Image loader module for Evas
+Group: System Environment/Libraries
+BuildRequires: libjpeg-devel
+%description module_loader_wbmp
+WBMP Image loader module for Evas
+%endif
+
 %if %{with module_loader_tga}
 %package module_loader_tga
 Summary: TGA Image loader module for Evas
@@ -547,6 +558,12 @@ test "x$RPM_BUILD_ROOT" != "x/" && rm -rf $RPM_BUILD_ROOT
 %{_libdir}/evas/modules/loaders/bmp/*/module.so
 %endif
 
+%if %{with module_loader_wbmp}
+%files module_loader_wbmp
+%defattr(-, root, root)
+%{_libdir}/evas/modules/loaders/wbmp/*/module.so
+%endif
+
 %if %{with module_loader_tga}
 %files module_loader_tga
 %defattr(-, root, root)
index 00a9618..17685e4 100644 (file)
@@ -328,6 +328,26 @@ fi
 
 ])
 
+dnl use: EVAS_CHECK_LOADER_DEP_ICO(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+
+AC_DEFUN([EVAS_CHECK_LOADER_DEP_ICO],
+[
+
+have_dep="yes"
+evas_image_loader_[]$1[]_cflags=""
+evas_image_loader_[]$1[]_libs=""
+
+AC_SUBST([evas_image_loader_$1_cflags])
+AC_SUBST([evas_image_loader_$1_libs])
+
+if test "x${have_dep}" = "xyes" ; then
+  m4_default([$3], [:])
+else
+  m4_default([$4], [:])
+fi
+
+])
+
 dnl use: EVAS_CHECK_LOADER_DEP_TGA(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
 
 AC_DEFUN([EVAS_CHECK_LOADER_DEP_TGA],
index d9fd805..4c26a95 100644 (file)
@@ -898,6 +898,9 @@ typedef void      (*Evas_Async_Events_Put_Cb)(void *target, Evas_Callback_Type t
    EAPI void              evas_object_name_set              (Evas_Object *obj, const char *name) EINA_ARG_NONNULL(1);
    EAPI const char       *evas_object_name_get              (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
 
+   EAPI void              evas_object_ref                   (Evas_Object *obj);
+   EAPI void              evas_object_unref                 (Evas_Object *obj);
+   
    EAPI void              evas_object_del                   (Evas_Object *obj) EINA_ARG_NONNULL(1);
    EAPI void              evas_object_move                  (Evas_Object *obj, Evas_Coord x, Evas_Coord y) EINA_ARG_NONNULL(1);
    EAPI void              evas_object_resize                (Evas_Object *obj, Evas_Coord w, Evas_Coord h) EINA_ARG_NONNULL(1);
@@ -1242,6 +1245,7 @@ typedef void (*Evas_Object_Image_Pixels_Get_Cb) (void *data, Evas_Object *o);
    EAPI Evas_Object             *evas_object_image_add                    (Evas *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
    EAPI Evas_Object             *evas_object_image_filled_add             (Evas *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
 
+   EAPI void                     evas_object_image_memfile_set            (Evas_Object *obj, void *data, int size, char *format, char *key) EINA_ARG_NONNULL(1, 2);
    EAPI void                     evas_object_image_file_set               (Evas_Object *obj, const char *file, const char *key) EINA_ARG_NONNULL(1);
    EAPI void                     evas_object_image_file_get               (const Evas_Object *obj, const char **file, const char **key) EINA_ARG_NONNULL(1, 2);
    EAPI void                     evas_object_image_border_set             (Evas_Object *obj, int l, int r, int t, int b) EINA_ARG_NONNULL(1);
index 382e26e..be84a2b 100644 (file)
@@ -133,6 +133,11 @@ SUBDIRS += ../modules/loaders/gif
 EVAS_STATIC_MODULE += ../modules/loaders/gif/libevas_loader_gif.la
 EVAS_STATIC_LIBADD += @evas_image_loader_gif_libs@
 endif
+if EVAS_STATIC_BUILD_ICO
+SUBDIRS += ../modules/loaders/ico
+EVAS_STATIC_MODULE += ../modules/loaders/ico/libevas_loader_ico.la
+EVAS_STATIC_LIBADD += @evas_image_loader_ico_libs@
+endif
 if EVAS_STATIC_BUILD_JPEG
 SUBDIRS += ../modules/loaders/jpeg
 EVAS_STATIC_MODULE += ../modules/loaders/jpeg/libevas_loader_jpeg.la
index b75261d..5dcbd9b 100644 (file)
@@ -281,10 +281,41 @@ _evas_cache_image_entry_delete(Evas_Cache_Image *cache, Image_Entry *ie)
    cache->func.dealloc(ie);
 }
 
+static Eina_Bool
+_timestamp_compare(Image_Timestamp *tstamp, struct stat *st)
+{
+   if (tstamp->mtime != st->st_mtime) return EINA_FALSE;
+   if (tstamp->size != st->st_size) return EINA_FALSE;
+   if (tstamp->ino != st->st_ino) return EINA_FALSE;
+#ifdef _STAT_VER_LINUX
+#if (defined __USE_MISC && defined st_mtime)
+   if (tstamp->mtime_nsec != (unsigned long int)st->st_mtim.tv_nsec) return EINA_FALSE;
+#else
+   if (tstamp->mtime_nsec != (unsigned long int)st->st_mtimensec) return EINA_FALSE;
+#endif
+#endif
+   return EINA_TRUE;
+}
+
+static void
+_timestamp_build(Image_Timestamp *tstamp, struct stat *st)
+{
+   tstamp->mtime = st->st_mtime;
+   tstamp->size = st->st_size;
+   tstamp->ino = st->st_ino;
+#ifdef _STAT_VER_LINUX
+#if (defined __USE_MISC && defined st_mtime)
+   tstamp->mtime_nsec = (unsigned long int)st->st_mtim.tv_nsec;
+#else
+   tstamp->mtime_nsec = (unsigned long int)st->st_mtimensec;
+#endif
+#endif
+}
+
 static Image_Entry *
 _evas_cache_image_entry_new(Evas_Cache_Image *cache,
                             const char *hkey,
-                            time_t timestamp,
+                            Image_Timestamp *tstamp,
                             const char *file,
                             const char *key,
                             RGBA_Image_Loadopts *lo,
@@ -322,8 +353,8 @@ _evas_cache_image_entry_new(Evas_Cache_Image *cache,
    ie->file = file ? eina_stringshare_add(file) : NULL;
    ie->key = key ? eina_stringshare_add(key) : NULL;
 
-   ie->timestamp = timestamp;
-   ie->laststat = time(NULL);
+   if (tstamp) ie->tstamp = *tstamp;
+   else memset(&ie->tstamp, 0, sizeof(Image_Timestamp));
 
    ie->load_opts.scale_down_by = 0;
    ie->load_opts.dpi = 0;
@@ -738,8 +769,6 @@ evas_cache_image_shutdown(Evas_Cache_Image *cache)
    free(cache);
 }
 
-#define STAT_GAP 2
-
 EAPI Image_Entry *
 evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *key, RGBA_Image_Loadopts *lo, int *error)
 {
@@ -752,6 +781,7 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
    size_t                file_length;
    size_t                key_length;
    struct stat           st;
+   Image_Timestamp       tstamp;
 
    assert(cache != NULL);
 
@@ -845,18 +875,12 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
 #endif
    if (im)
      {
-        time_t t;
-        int ok;
-
-        ok = 1;
-        t = time(NULL);
-        if ((t - im->laststat) > STAT_GAP)
+        int ok = 1;
+        
+        stat_done = 1;
+        if (stat(file, &st) < 0) goto on_stat_error;
           {
-             stat_done = 1;
-             if (stat(file, &st) < 0) goto on_stat_error;
-
-             im->laststat = t;
-             if (st.st_mtime != im->timestamp) ok = 0;
+             if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
           }
         if (ok) goto on_ok;
 
@@ -873,25 +897,16 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
 #endif
    if (im)
      {
-        int     ok;
+        int ok = 1;
 
-        ok = 1;
         if (!stat_done)
           {
-             time_t  t;
-
-             t = time(NULL);
-             if ((t - im->laststat) > STAT_GAP)
-               {
-                  stat_done = 1;
-                  if (stat(file, &st) < 0) goto on_stat_error;
-
-                  im->laststat = t;
-                  if (st.st_mtime != im->timestamp) ok = 0;
-               }
+             stat_done = 1;
+             if (stat(file, &st) < 0) goto on_stat_error;
+             if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
           }
         else
-          if (st.st_mtime != im->timestamp) ok = 0;
+           if (!_timestamp_compare(&(im->tstamp), &st)) ok = 0;
 
         if (ok)
           {
@@ -907,8 +922,8 @@ evas_cache_image_request(Evas_Cache_Image *cache, const char *file, const char *
      {
         if (stat(file, &st) < 0) goto on_stat_error;
      }
-
-   im = _evas_cache_image_entry_new(cache, hkey, st.st_mtime, file, key, lo, error);
+   _timestamp_build(&tstamp, &st);
+   im = _evas_cache_image_entry_new(cache, hkey, &tstamp, file, key, lo, error);
    if (!im) return NULL;
 
    if (cache->func.debug)
@@ -964,6 +979,7 @@ evas_cache_image_drop(Image_Entry *im)
    LKL(im->lock_references);
 #endif
    im->references--;
+   if (im->references < 0) im->references = 0;
    references = im->references;
 #ifdef EVAS_FRAME_QUEUING
    LKU(im->lock_references);
@@ -1070,18 +1086,6 @@ evas_cache_image_dirty(Image_Entry *im, unsigned int x, unsigned int y, unsigned
              error = cache->func.dirty(im_dirty, im);
              if (cache->func.debug)
                cache->func.debug("dirty-out", im_dirty);
-/*             
-             im_dirty = _evas_cache_image_entry_new(cache, NULL, im->timestamp, im->file, im->key, &im->load_opts, &error);
-             if (!im_dirty) goto on_error;
-
-             if (cache->func.debug)
-               cache->func.debug("dirty-src", im);
-             error = cache->func.dirty(im_dirty, im);
-             if (cache->func.debug)
-               cache->func.debug("dirty-out", im_dirty);
-
-             if (error != 0) goto on_error;
- */
 #ifdef EVAS_FRAME_QUEUING
              LKL(im_dirty->lock_references);
 #endif
@@ -1129,7 +1133,7 @@ evas_cache_image_alone(Image_Entry *im)
    LKU(im->lock_references);
 #endif
 
-   if (references == 1)
+   if (references <= 1)
      {
         if (!(im->flags.dirty))
           {
@@ -1152,18 +1156,6 @@ evas_cache_image_alone(Image_Entry *im)
         error = cache->func.dirty(im_dirty, im);
         if (cache->func.debug)
           cache->func.debug("dirty-out", im_dirty);
-/*        
-        im_dirty = _evas_cache_image_entry_new(cache, NULL, im->timestamp, im->file, im->key, &im->load_opts, &error);
-        if (!im_dirty) goto on_error;
-
-        if (cache->func.debug)
-          cache->func.debug("dirty-src", im);
-        error = cache->func.dirty(im_dirty, im);
-        if (cache->func.debug)
-          cache->func.debug("dirty-out", im_dirty);
-
-        if (error != 0) goto on_error;
- */
 #ifdef EVAS_FRAME_QUEUING
    LKL(im_dirty->lock_references);
 #endif
@@ -1194,7 +1186,7 @@ evas_cache_image_copied_data(Evas_Cache_Image *cache, unsigned int w, unsigned i
        (cspace == EVAS_COLORSPACE_YCBCR422P709_PL))
      w &= ~0x1;
 
-   im = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, NULL);
+   im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL);
    if (!im) return NULL;
 
    im->space = cspace;
@@ -1231,7 +1223,7 @@ evas_cache_image_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, D
        (cspace == EVAS_COLORSPACE_YCBCR422P709_PL))
      w &= ~0x1;
 
-   im = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, NULL);
+   im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL);
    im->w = w;
    im->h = h;
    im->flags.alpha = alpha;
@@ -1300,7 +1292,7 @@ evas_cache_image_size_set(Image_Entry *im, unsigned int w, unsigned int h)
 
    cache = im->cache;
 
-   new = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, &error);
+   new = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, &error);
    if (!new) goto on_error;
 
    new->flags.alpha = im->flags.alpha;
@@ -1551,7 +1543,7 @@ evas_cache_image_empty(Evas_Cache_Image *cache)
 {
    Image_Entry *im;
 
-   im = _evas_cache_image_entry_new(cache, NULL, 0, NULL, NULL, NULL, NULL);
+   im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL);
    if (!im) return NULL;
 
 #ifdef EVAS_FRAME_QUEUING
index 55f7dad..fc663fa 100644 (file)
@@ -7,6 +7,8 @@ evas_object_clip_dirty(Evas_Object *obj)
    Eina_List *l;
    Evas_Object *data;
 
+   if (obj->cur.cache.clip.dirty) return ;
+
    obj->cur.cache.clip.dirty = 1;
    EINA_LIST_FOREACH(obj->clip.clipees, l, data)
      evas_object_clip_dirty(data);
index 8f71561..2940f9d 100644 (file)
@@ -1,3 +1,8 @@
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+
 #include "evas_common.h"
 #include "evas_private.h"
 #include "../engines/common/evas_convert_color.h"
@@ -57,6 +62,9 @@ struct _Evas_Object_Image
       Evas_Object_Image_Pixels_Get_Cb  get_pixels;
       void                            *get_pixels_data;
    } func;
+   
+   const char             *tmpf;
+   int                     tmpf_fd;
 
    Evas_Image_Scale_Hint   scale_hint;
    Evas_Image_Content_Hint content_hint;
@@ -100,6 +108,7 @@ static void _proxy_unset(Evas_Object *proxy);
 static void _proxy_set(Evas_Object *proxy, Evas_Object *src);
 static void _proxy_error(Evas_Object *proxy, void *context, void *output, void *surface, int x, int y);
 
+static void _cleanup_tmpf(Evas_Object *obj);
 
 static const Evas_Object_Func object_func =
 {
@@ -179,6 +188,120 @@ evas_object_image_filled_add(Evas *e)
    return obj;
 }
 
+static void
+_cleanup_tmpf(Evas_Object *obj)
+{
+   Evas_Object_Image *o;
+   
+   o = (Evas_Object_Image *)(obj->object_data);
+   if (!o->tmpf) return;
+#ifdef __linux__
+#else
+   unlink(o->tmpf);
+#endif
+   if (o->tmpf_fd >= 0) close(o->tmpf_fd);
+   eina_stringshare_del(o->tmpf);
+   o->tmpf_fd = -1;
+   o->tmpf = NULL;
+}
+
+static void
+_create_tmpf(Evas_Object *obj, void *data, int size, char *format __UNUSED__)
+{
+   Evas_Object_Image *o;
+   char buf[4096];
+   void *dst;
+   int fd = -1;
+   
+   o = (Evas_Object_Image *)(obj->object_data);
+#ifdef __linux__
+   snprintf(buf, sizeof(buf), "/dev/shm/.evas-tmpf-%i-%p-%i-XXXXXX", 
+            (int)getpid(), data, (int)size);
+   fd = mkstemp(buf);
+#endif   
+   if (fd < 0)
+     {
+        snprintf(buf, sizeof(buf), "/tmp/.evas-tmpf-%i-%p-%i-XXXXXX", 
+                 (int)getpid(), data, (int)size);
+        fd = mkstemp(buf);
+     }
+   if (fd < 0) return;
+   if (ftruncate(fd, size) < 0)
+     {
+        unlink(buf);
+        close(fd);
+        return;
+     }
+   unlink(buf);
+   dst = mmap(NULL, size, 
+              PROT_READ | PROT_WRITE, 
+              MAP_SHARED, 
+              fd, 0);
+   if (dst == MAP_FAILED)
+     {
+        close(fd);
+        return;
+     }
+   o->tmpf_fd = fd;
+#ifdef __linux__
+   snprintf(buf, sizeof(buf), "/proc/%li/fd/%i", (long)getpid(), fd);
+#endif   
+   o->tmpf = eina_stringshare_add(buf);
+   memcpy(dst, data, size);
+   munmap(dst, size);
+}
+
+/**
+ * Sets the data for an image from memory to be loaded
+ *
+ * This is the same as evas_object_image_file_set() but the file to be loaded
+ * may exist at an address in memory (the data for the file, not the filename
+ * itself). The @p data at the address is copied and stored for future use, so
+ * no @p data needs to be kept after this call is made. It will be managed and
+ * freed for you when no longer needed. The @p size is limited to 2 gigabytes
+ * in size, and must be greater than 0. A NULL @p data pointer is also invalid.
+ * Set the filename to NULL to reset to empty state and have the image file
+ * data freed from memory using evas_object_image_file_set().
+ * 
+ * The @p format is optional (pass NULL if you don't need/use it). It is used
+ * to help Evas guess better which loader to use for the data. It may simply
+ * be the "extension" of the file as it would normally be on disk such as
+ * "jpg" or "png" or "gif" etc.
+ *
+ * @param obj The given image object.
+ * @param data The image file data address
+ * @param size The size of the image file data in bytes
+ * @param format The format of the file (optional), or NULL if not needed
+ * @param key The image key in file, or NULL.
+ */
+EAPI void
+evas_object_image_memfile_set(Evas_Object *obj, void *data, int size, char *format, char *key)
+{
+   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();
+   _cleanup_tmpf(obj);
+   evas_object_image_file_set(obj, NULL, NULL);
+   if ((size < 1) || (!data)) return;
+       
+   _create_tmpf(obj, data, size, format);
+   evas_object_image_file_set(obj, o->tmpf, key);
+   if (!o->engine_data)
+     {
+        _cleanup_tmpf(obj);
+        return;
+     }
+   // invalidate the cache effectively
+   evas_object_image_alpha_set(obj, !o->cur.has_alpha);
+   evas_object_image_alpha_set(obj, !o->cur.has_alpha);
+}
+
 /**
  * Sets the filename and key of the given image object.
  *
@@ -202,6 +325,7 @@ evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
    MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
    return;
    MAGIC_CHECK_END();
+   if ((o->tmpf) && (file != o->tmpf)) _cleanup_tmpf(obj);
    if ((o->cur.file) && (file) && (!strcmp(o->cur.file, file)))
      {
        if ((!o->cur.key) && (!key))
@@ -1303,7 +1427,7 @@ evas_object_image_alpha_set(Evas_Object *obj, Eina_Bool has_alpha)
    if (o->engine_data)
      {
         int stride = 0;
-        
+
 #ifdef EVAS_FRAME_QUEUING
         evas_common_pipe_op_image_flush(o->engine_data);
 #endif
@@ -2389,19 +2513,30 @@ _proxy_error(Evas_Object *proxy, void *context, void *output, void *surface,
    return;
 }
 
+
 static void
-_proxy_subrender_recurse(Evas_Object *obj, void *output, void *surface, void *ctx, int x, int y){
+_proxy_subrender_recurse(Evas_Object *obj, Evas_Object *clip, void *output, void *surface, void *ctx, int x, int y){
      Evas_Object *obj2;
      Evas *e;
      e = obj->layer->evas;
      if (obj->clip.clipees) return;
-     if (!evas_object_is_visible(obj)) return;
-     obj->pre_render_done = 1;
+     /* evas_object_is_visible, inline and tweaked to handle it's clip hidden*/
+     if (!obj->cur.visible) return;
+     if (!clip || clip != obj->cur.clipper)
+       {
+          if (!obj->cur.cache.clip.visible) return;
+          if (obj->cur.cache.clip.a == 0 &&
+              obj->cur.render_op == EVAS_RENDER_BLEND) return;
+       }
+     if (obj->func->is_visible && !obj->func->is_visible(obj)) return;
+
+     if (!obj->pre_render_done)
+        obj->func->render_pre(obj);
      ctx = e->engine.func->context_new(output);
      if (obj->smart.smart)
        {
           EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(obj), obj2){
-               _proxy_subrender_recurse(obj2, output, surface, ctx, x,y);
+               _proxy_subrender_recurse(obj2, clip, output, surface, ctx, x,y);
           }
        }
      else
@@ -2422,7 +2557,7 @@ static void
 _proxy_subrender(Evas *e, Evas_Object *source)
 {
    void *ctx;
-   Evas_Object *obj2;
+   Evas_Object *obj2, *clip;
    int w,h;
 
    if (!source) return;
@@ -2460,8 +2595,9 @@ _proxy_subrender(Evas *e, Evas_Object *source)
    ctx = e->engine.func->context_new(e->engine.data.output);
    if (source->smart.smart)
      {
+        clip = evas_object_smart_clipped_clipper_get(source);
         EINA_INLIST_FOREACH(evas_object_smart_members_get_direct(source), obj2){
-             _proxy_subrender_recurse(obj2, e->engine.data.output,
+             _proxy_subrender_recurse(obj2, clip, e->engine.data.output,
                                       source->proxy.surface,
                                       ctx,
                                       -source->cur.geometry.x,
@@ -2470,6 +2606,8 @@ _proxy_subrender(Evas *e, Evas_Object *source)
      }
    else
      {
+        if (!source->pre_render_done)
+           source->func->render_pre(source);
         source->func->render(source, e->engine.data.output, ctx,
                                     source->proxy.surface,
                                     -source->cur.geometry.x,
@@ -2659,6 +2797,7 @@ evas_object_image_new(void)
    o->cur.opaque_valid = 0;
    o->cur.source = NULL;
    o->prev = o->cur;
+   o->tmpf_fd = -1;
    return o;
 }
 
@@ -2674,6 +2813,7 @@ evas_object_image_free(Evas_Object *obj)
    return;
    MAGIC_CHECK_END();
    /* free obj */
+   _cleanup_tmpf(obj);
    if (o->cur.file) eina_stringshare_del(o->cur.file);
    if (o->cur.key) eina_stringshare_del(o->cur.key);
    if (o->cur.source) _proxy_unset(obj);
index f50df7e..f835aee 100644 (file)
@@ -280,7 +280,7 @@ evas_object_line_free(Evas_Object *obj)
    MAGIC_CHECK_END();
    /* free obj */
    o->magic = 0;
-   EVAS_MEMPOOL_FREE(_mp_obj,o);
+   EVAS_MEMPOOL_FREE(_mp_obj, o);
 }
 
 static void
index 5f44d72..531790e 100644 (file)
@@ -354,6 +354,53 @@ evas_object_was_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
 /* routines apps will call */
 
 /**
+ * Increments object reference count to defer deletion
+ * 
+ * This increments the reference count of an object, which if greater than
+ * 0 will defer deletion by evas_object_del() until all references are
+ * released back to 0. References cannot go below 0 and unreferencing more
+ * times that referencing will result in the reference count being limited
+ * to 0. References are limited to 2^32 - 1 for an object. Referencing it more
+ * than this will result in it being limited to this value.
+ * 
+ * @param obj The given evas object to reference
+ * @ingroup Evas_Object_Group_Basic
+ * @since 1.1.0
+ */
+EAPI void
+evas_object_ref(Evas_Object *obj)
+{
+   MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
+   return;
+   MAGIC_CHECK_END();
+   obj->ref++;
+   if (obj->ref == 0) obj->ref--;
+}
+
+/**
+ * Decrements object reference count to defer deletion
+ * 
+ * This decrements the reference count of an object. If the object has had
+ * evas_object_del() called on it while references were more than 0, it will
+ * be deleted at the time this function is called as it normally would have
+ * been. See evas_object_ref() for more information.
+ * 
+ * @param obj The given evas object to unreference
+ * @ingroup Evas_Object_Group_Basic
+ * @since 1.1.0
+ */
+EAPI void
+evas_object_unref(Evas_Object *obj)
+{
+   MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
+   return;
+   MAGIC_CHECK_END();
+   if (obj->ref == 0) return;
+   obj->ref--;
+   if ((obj->del_ref) && (obj->ref == 0)) evas_object_del(obj);
+}
+
+/**
  * Deletes the given evas object and frees its memory.
  *
  * The object's 'free' callback is called when this function is called.
@@ -372,12 +419,25 @@ evas_object_del(Evas_Object *obj)
 
    if (obj->delete_me) return;
 
+   if (obj->ref > 0)
+     {
+        obj->del_ref = 1;
+        return;
+     }
 #ifdef EVAS_FRAME_QUEUING
    evas_common_frameq_flush();
 #endif
 
+   evas_object_hide(obj);
+   if (obj->focused)
+     {
+       obj->focused = 0;
+       obj->layer->evas->focused = NULL;
+       _evas_object_event_new();
+       evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL);
+        _evas_post_event_callback_call(obj->layer->evas);
+     }
    _evas_object_event_new();
-
    evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL);
    _evas_post_event_callback_call(obj->layer->evas);
    if (obj->name) evas_object_name_set(obj, NULL);
@@ -386,18 +446,9 @@ evas_object_del(Evas_Object *obj)
        evas_object_free(obj, 1);
        return;
      }
-   if (obj->focused)
-     {
-       obj->focused = 0;
-       obj->layer->evas->focused = NULL;
-       _evas_object_event_new();
-       evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL);
-        _evas_post_event_callback_call(obj->layer->evas);
-     }
    obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
    obj->mouse_grabbed = 0;
    obj->mouse_in = 0;
-   evas_object_hide(obj);
    evas_object_grabs_cleanup(obj);
    while (obj->clip.clipees) 
      evas_object_clip_unset(obj->clip.clipees->data);
index 3f81b65..2604eff 100644 (file)
@@ -2023,7 +2023,7 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt)
  * @param c the context to work on - Not NULL.
  * @param fmt the format to free.
  * @return the next format in the stack, or format if there's none.
- * @see _layout_format_pop()
+ * @see _layout_format_push()
  */
 static Evas_Object_Textblock_Format *
 _layout_format_pop(Ctxt *c, Evas_Object_Textblock_Format *fmt)
@@ -2183,6 +2183,8 @@ _layout_line_order(Ctxt *c __UNUSED__, Evas_Object_Textblock_Line *line)
      }
 
    if (v_to_l) free(v_to_l);
+#else
+   line = NULL;
 #endif
 }
 
@@ -2818,11 +2820,14 @@ skip:
                    ti->parent.text_node->bidi_props, ti->parent.text_pos);
              evas_common_text_props_script_set (&ti->text_props,
                    ti->text);
-             c->ENFN->font_text_props_info_create(c->ENDT,
-                   ti->parent.format->font.font,
-                   ti->text, &ti->text_props,
-                   ti->parent.text_node->bidi_props,
-                   ti->parent.text_pos, tmp_len);
+             if (ti->parent.format->font.font)
+               {
+                  c->ENFN->font_text_props_info_create(c->ENDT,
+                        ti->parent.format->font.font,
+                        ti->text, &ti->text_props,
+                        ti->parent.text_node->bidi_props,
+                        ti->parent.text_pos, tmp_len);
+               }
           }
         str += tmp_len;
         cur_len -= tmp_len;
@@ -6533,6 +6538,9 @@ _evas_textblock_cursor_is_at_the_end(const Evas_Textblock_Cursor *cur)
  * This behavior is because visible formats are like characters and invisible
  * should be stacked in a way that the last one is added last.
  *
+ * This function works with native formats, that means that style defined
+ * tags like <br> won't work here. For those kind of things use markup prepend.
+ *
  * @param cur the cursor to where to add format at.
  * @param format the format to add.
  * @return Returns true if a visible format was added, false otherwise.
@@ -6663,6 +6671,9 @@ evas_textblock_cursor_format_append(Evas_Textblock_Cursor *cur, const char *form
  * should be stacked in a way that the last one is added last.
  * If the format is visible the cursor is advanced after it.
  *
+ * This function works with native formats, that means that style defined
+ * tags like <br> won't work here. For those kind of things use markup prepend.
+ *
  * @param cur the cursor to where to add format at.
  * @param format the format to add.
  * @return Returns true if a visible format was added, false otherwise.
index f3f07ee..b09f2bc 100644 (file)
@@ -2,8 +2,8 @@
 #include "evas_private.h"
 
 // debug rendering
-//#define REND_DGB 1
-//#define STDOUT_DBG 1
+/* #define REND_DGB 1 */
+/* #define STDOUT_DBG 1 */
 
 #ifdef REND_DGB
 static FILE *dbf = NULL;
@@ -881,6 +881,7 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
                                      obj->cur.geometry.y + off_y2,
                                      obj->cur.geometry.w,
                                      obj->cur.geometry.h);
+
                   e->engine.func->context_clip_set(e->engine.data.output,
                                                    ctx, x, y, w, h);
                   obj->func->render(obj, e->engine.data.output, ctx,
@@ -919,6 +920,11 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
                        y = obj->cur.cache.clip.y;
                        w = obj->cur.cache.clip.w;
                        h = obj->cur.cache.clip.h;
+                       RECTS_CLIP_TO_RECT(x, y, w, h,
+                              obj->cur.clipper->cur.cache.clip.x,
+                              obj->cur.clipper->cur.cache.clip.y,
+                              obj->cur.clipper->cur.cache.clip.w,
+                              obj->cur.clipper->cur.cache.clip.h);
                        e->engine.func->context_clip_set(e->engine.data.output,
                                                         e->engine.data.context,
                                                         x + off_x, y + off_y, w, h);
@@ -982,7 +988,33 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
                {
                   if (!obj->cur.map)
                     {
+                       int x, y, w, h;
+
                        RDI(level);
+
+                       x = obj->cur.cache.clip.x + off_x;
+                       y = obj->cur.cache.clip.y + off_y;
+                       w = obj->cur.cache.clip.w;
+                       h = obj->cur.cache.clip.h;
+
+                       if (obj->cur.clipper)
+                         {
+                            if (_evas_render_has_map(obj))
+                              evas_object_clip_recalc(obj);
+
+                            RD("        clipper: %i %i %ix%i\n",
+                               obj->cur.clipper->cur.cache.clip.x + off_x,
+                               obj->cur.clipper->cur.cache.clip.y + off_y,
+                               obj->cur.clipper->cur.cache.clip.w,
+                               obj->cur.clipper->cur.cache.clip.h);
+
+                            RECTS_CLIP_TO_RECT(x, y, w, h,
+                                               obj->cur.clipper->cur.cache.clip.x + off_x,
+                                               obj->cur.clipper->cur.cache.clip.y + off_y,
+                                               obj->cur.clipper->cur.cache.clip.w,
+                                               obj->cur.clipper->cur.cache.clip.h);
+                         }
+
                        RD("        clip: %i %i %ix%i [%i %i %ix%i]\n",
                           obj->cur.cache.clip.x + off_x,
                           obj->cur.cache.clip.y + off_y, 
@@ -993,11 +1025,7 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
                           obj->cur.geometry.w,
                           obj->cur.geometry.h);
                        e->engine.func->context_clip_set(e->engine.data.output,
-                                                        ctx,
-                                                        obj->cur.cache.clip.x + off_x,
-                                                        obj->cur.cache.clip.y + off_y, 
-                                                        obj->cur.cache.clip.w,
-                                                        obj->cur.cache.clip.h);
+                                                        ctx, x, y, w, h);
                     }
                   else
                     {
@@ -1020,6 +1048,26 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
           }
         else
           {
+             if (obj->cur.clipper)
+               {
+                  int x, y, w, h;
+
+                  if (_evas_render_has_map(obj))
+                    evas_object_clip_recalc(obj);
+                  x = obj->cur.cache.clip.x;
+                  y = obj->cur.cache.clip.y;
+                  w = obj->cur.cache.clip.w;
+                  h = obj->cur.cache.clip.h;
+                  RECTS_CLIP_TO_RECT(x, y, w, h,
+                                     obj->cur.clipper->cur.cache.clip.x,
+                                     obj->cur.clipper->cur.cache.clip.y,
+                                     obj->cur.clipper->cur.cache.clip.w,
+                                     obj->cur.clipper->cur.cache.clip.h);
+                  e->engine.func->context_clip_set(e->engine.data.output,
+                                                   e->engine.data.context,
+                                                   x + off_x, y + off_y, w, h);
+               }
+
              RDI(level);
              RD("        draw normal obj\n");
              obj->func->render(obj, e->engine.data.output, context, surface,
@@ -1064,10 +1112,10 @@ evas_render_updates_internal(Evas *e,
 
    /* phase 1. add extra updates for changed objects */
    if (e->invalidate || e->render_objects.count <= 0)
-     clean_them = _evas_render_phase1_process(e, 
-                                              &e->active_objects, 
-                                              &e->restack_objects, 
-                                              &e->delete_objects, 
+     clean_them = _evas_render_phase1_process(e,
+                                              &e->active_objects,
+                                              &e->restack_objects,
+                                              &e->delete_objects,
                                               &e->render_objects,
                                               &redraw_all);
 
@@ -1269,26 +1317,6 @@ evas_render_updates_internal(Evas *e,
                           (eina_array_data_get(&e->temporary_objects, offset) == obj))
                         offset++;
                       x = cx; y = cy; w = cw; h = ch;
-                       if (obj->cur.clipper)
-                         {
-                            if (_evas_render_has_map(obj))
-                              {
-                                 evas_object_clip_recalc(obj);
-                              }
-/* hmmmm clip seems to kill eweather in elm-test
-                            printf("clip: %4i %4i %4ix%4i to %4i %4i %4ix%4i\n",
-                                   x, y, w, h,
-                                   obj->cur.cache.clip.x + off_x,
-                                   obj->cur.cache.clip.y + off_y,
-                                   obj->cur.cache.clip.w,
-                                   obj->cur.cache.clip.h);
- */
-                            RECTS_CLIP_TO_RECT(x, y, w, h,
-                                               obj->cur.cache.clip.x + off_x,
-                                               obj->cur.cache.clip.y + off_y,
-                                               obj->cur.cache.clip.w,
-                                               obj->cur.cache.clip.h);
-                         }
                       if (((w > 0) && (h > 0)) || (obj->smart.smart))
                         {
                             if (!obj->smart.smart)
@@ -1358,9 +1386,6 @@ evas_render_updates_internal(Evas *e,
                                    }
                              }
 #endif
-                            e->engine.func->context_clip_set(e->engine.data.output,
-                                                             e->engine.data.context,
-                                                             x, y, w, h);
                             clean_them |= evas_render_mapped(e, obj, e->engine.data.context,
                                                             surface, off_x, off_y, 0
 #ifdef REND_DGB
index c3290b9..62b96aa 100644 (file)
@@ -82,6 +82,7 @@ evas_convert_rgb_8.h \
 evas_convert_yuv.h \
 evas_draw.h \
 evas_font.h \
+evas_font_default_walk.x \
 evas_font_private.h \
 evas_image.h \
 evas_image_private.h \
index 3be396a..daa6dfa 100644 (file)
@@ -263,6 +263,9 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt index)
 
    if (!fi->fash) fi->fash = _fash_gl_new();
    if (fi->fash) _fash_gl_add(fi->fash, index, fg);
+   /* This '+ 200' is just an estimation of how much memory freetype will use
+    * on it's size. This value is not really used anywhere in code - it's
+    * only for statistics. */
    size = sizeof(RGBA_Font_Glyph) + sizeof(Eina_List) +
     (fg->glyph_out->bitmap.width * fg->glyph_out->bitmap.rows) + 200;
    fi->usage += size;
@@ -496,7 +499,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
 #else
    (void) use_kerning;
 #endif
-/*
+
    if (fi->src->current_size != fi->size)
      {
         FTLOCK();
@@ -504,7 +507,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
         FTUNLOCK();
         fi->src->current_size = fi->size;
      }
-*/
+
 
    im = dst->image.data;
    /* Load the glyph according to the first letter of the script, preety
@@ -521,14 +524,6 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
         if (!*tmp && (tmp > text)) tmp--;
         evas_common_font_glyph_search(fn, &fi, *tmp);
      }
-   if (fi->src->current_size != fi->size)
-     {
-        FTLOCK();
-        FT_Activate_Size(fi->ft.size);
-        FTUNLOCK();
-        fi->src->current_size = fi->size;
-     }
-
    EVAS_FONT_WALK_TEXT_VISUAL_START()
      {
         FT_UInt index;
@@ -543,14 +538,6 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
          * the use of harfbuzz */
         index =
            evas_common_font_glyph_search(fn, &fi, text[EVAS_FONT_WALK_POS]);
-
-        if (fi->src->current_size != fi->size)
-          {
-             FTLOCK();
-             FT_Activate_Size(fi->ft.size);
-             FTUNLOCK();
-             fi->src->current_size = fi->size;
-          }
 #endif
         LKL(fi->ft_mutex);
         fg = evas_common_font_int_cache_glyph_get(fi, index);
@@ -841,14 +828,6 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, con
         evas_common_font_glyph_search(fn, &fi, *tmp);
      }
 
-   if (fi->src->current_size != fi->size)
-     {
-        FTLOCK();
-        FT_Activate_Size(fi->ft.size);
-        FTUNLOCK();
-        fi->src->current_size = fi->size;
-     }
-
    /* First pass: Work out how big and populate */
    /* It's a bit hackish to use index and fg here as they are internal,
     * but that'll have to be good enough ATM */
@@ -866,14 +845,6 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, con
          * the use of harfbuzz */
         index =
            evas_common_font_glyph_search(fn, &fi, text[EVAS_FONT_WALK_POS]);
-
-        if (fi->src->current_size != fi->size)
-          {
-             FTLOCK();
-             FT_Activate_Size(fi->ft.size);
-             FTUNLOCK();
-             fi->src->current_size = fi->size;
-          }
 #endif
         LKL(fi->ft_mutex);
         fg = evas_common_font_int_cache_glyph_get(fi, index);
index 62ed99a..6a6a4e4 100644 (file)
@@ -194,6 +194,8 @@ evas_common_font_ot_populate_text_props(void *_fn, const Eina_Unicode *text,
    hb_glyph_info_t *infos;
    int slen;
    unsigned int i;
+   Evas_Font_Glyph_Info *gl_itr;
+   Evas_Font_OT_Info *ot_itr;
 
    fi = fn->fonts->data;
    /* Load the font needed for this script */
@@ -246,13 +248,20 @@ evas_common_font_ot_populate_text_props(void *_fn, const Eina_Unicode *text,
               sizeof(Evas_Font_Glyph_Info));
    positions = hb_buffer_get_glyph_positions(buffer);
    infos = hb_buffer_get_glyph_infos(buffer);
+   gl_itr = props->info->glyph;
+   ot_itr = props->info->ot;
    for (i = 0 ; i < props->len ; i++)
      {
-        props->info->ot[i].source_cluster = infos[i].cluster;
-        props->info->ot[i].x_offset = positions[i].x_offset;
-        props->info->ot[i].y_offset = positions[i].y_offset;
-        props->info->glyph[i].index = infos[i].codepoint;
-        props->info->glyph[i].advance = positions[i].x_advance;
+        ot_itr->source_cluster = infos->cluster;
+        ot_itr->x_offset = positions->x_offset;
+        ot_itr->y_offset = positions->y_offset;
+        gl_itr->index = infos->codepoint;
+        gl_itr->advance = positions->x_advance;
+
+        ot_itr++;
+        gl_itr++;
+        infos++;
+        positions++;
      }
 
    hb_buffer_destroy(buffer);
index cc68578..eed3faf 100644 (file)
@@ -24,6 +24,11 @@ extern LK(lock_ot); // for harfbuzz calls
 #  define BIDILOCK()
 #  define BIDIUNLOCK()
 
+/* Macros for text walking */
+#  define OTLOCK()
+#  define OTUNLOCK()
+# endif
+
 void evas_common_font_source_unload(RGBA_Font_Source *fs);
 void evas_common_font_source_reload(RGBA_Font_Source *fs);
 
@@ -32,10 +37,6 @@ void evas_common_font_int_use_increase(int size);
 void evas_common_font_int_use_trim(void);
 void evas_common_font_int_unload(RGBA_Font_Int *fi);
 void evas_common_font_int_reload(RGBA_Font_Int *fi);
-/* Macros for text walking */
-#  define OTLOCK()
-#  define OTUNLOCK()
-# endif
 
 /* 6th bit is on is the same as frac part >= 0.5 */
 # define EVAS_FONT_ROUND_26_6_TO_INT(x) \
index b113040..ba6b38d 100644 (file)
@@ -30,12 +30,14 @@ static const struct ext_loader_s loaders[] =
    { "pnm", "pmaps" },
    { "bmp", "bmp" },
    { "tga", "tga" },
-   { "wbmp", "wbmp" }
+   { "wbmp", "wbmp" },
+   { "ico", "ico" },
+   { "cur", "ico" }
 };
 
 static const char *loaders_name[] =
 {
-  "png", "jpeg", "eet", "xpm", "tiff", "gif", "svg", "pmaps", "edb", "bmp", "tga", "wbmp"
+  "png", "jpeg", "eet", "xpm", "tiff", "gif", "svg", "pmaps", "edb", "bmp", "tga", "wbmp", "ico"
 };
 
 struct evas_image_foreach_loader_data
index bda94ee..1f1b030 100644 (file)
@@ -1,6 +1,7 @@
 // THIS IS DEPRECATED. WILL GO EVENTUALLTY. NO NEED TO SUPPORT ANYMORE
 
 #include "evas_common.h"
+#include <unistd.h>
 
 #ifdef BUILD_PIPE_RENDER
 
index fe54ca4..616cd7e 100644 (file)
@@ -175,7 +175,6 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
 {
    RGBA_Font *fn = (RGBA_Font *) _fn;
    RGBA_Font_Int *fi;
-   size_t char_index;
 
    if (text_props->info)
      {
@@ -200,6 +199,8 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
      }
 
 #ifdef OT_SUPPORT
+   size_t char_index;
+   Evas_Font_Glyph_Info *gl_itr;
    const Eina_Unicode *base_char;
    evas_common_font_ot_populate_text_props(fn, text, text_props, len);
 
@@ -217,19 +218,20 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
         evas_common_font_glyph_search(fn, &fi, *base_char);
      }
 
+   gl_itr = text_props->info->glyph;
    for (char_index = 0 ; char_index < text_props->len ; char_index++)
      {
         FT_UInt index;
         RGBA_Font_Glyph *fg;
         Eina_Bool is_replacement = EINA_FALSE;
         /* If we got a malformed index, show the replacement char instead */
-        if (text_props->info->glyph[char_index].index == 0)
+        if (gl_itr->index == 0)
           {
-             text_props->info->glyph[char_index].index =
+             gl_itr->index =
                 evas_common_font_glyph_search(fn, &fi, REPLACEMENT_CHAR);
              is_replacement = EINA_TRUE;
           }
-        index = text_props->info->glyph[char_index].index;
+        index = gl_itr->index;
         LKL(fi->ft_mutex);
         fg = evas_common_font_int_cache_glyph_get(fi, index);
         if (!fg)
@@ -241,25 +243,25 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
         if (is_replacement)
           {
              /* Update the advance accordingly */
-             text_props->info->glyph[char_index].advance =
+             gl_itr->advance =
                 fg->glyph->advance.x >> 10;
              /* FIXME: reload fi, a bit slow, but I have no choice. */
              evas_common_font_glyph_search(fn, &fi, *base_char);
           }
-        text_props->info->glyph[char_index].x_bear =
-           fg->glyph_out->left;
-        text_props->info->glyph[char_index].width =
-           fg->glyph_out->bitmap.width;
+        gl_itr->x_bear = fg->glyph_out->left;
+        gl_itr->width = fg->glyph_out->bitmap.width;
         /* text_props->info->glyph[char_index].advance =
          * text_props->info->glyph[char_index].index =
          * already done by the ot function */
         if (EVAS_FONT_CHARACTER_IS_INVISIBLE(
               text[text_props->info->ot[char_index].source_cluster]))
-           text_props->info->glyph[char_index].index = 0;
+           gl_itr->index = 0;
 
+        gl_itr++;
      }
 #else
    /* We are walking the string in visual ordering */
+   Evas_Font_Glyph_Info *gl_itr;
    Eina_Bool use_kerning;
    FT_UInt prev_index;
    FT_Face pface = NULL;
@@ -282,8 +284,9 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
      {
         adv_d = 1;
      }
-   char_index = 0;
-   for ( ; i > 0 ; char_index++, text += adv_d, i--)
+
+   gl_itr = text_props->info->glyph;
+   for ( ; i > 0 ; gl_itr++, text += adv_d, i--)
      {
         FT_UInt index;
         RGBA_Font_Glyph *fg;
@@ -331,8 +334,7 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
                {
                   if (evas_common_font_query_kerning(fi, index, prev_index, &kern))
                     {
-                       text_props->info->glyph[char_index - 1].advance +=
-                          kern;
+                       (gl_itr - 1)->advance += kern;
                     }
                }
              else
@@ -340,8 +342,7 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
                {
                   if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
                     {
-                       text_props->info->glyph[char_index - 1].advance +=
-                          kern;
+                       (gl_itr - 1)->advance += kern;
                     }
                }
           }
@@ -350,15 +351,12 @@ evas_common_text_props_content_create(void *_fn, const Eina_Unicode *text,
         LKU(fi->ft_mutex);
 
         if (EVAS_FONT_CHARACTER_IS_INVISIBLE(_gl))
-           text_props->info->glyph[char_index].index = 0;
-
-        text_props->info->glyph[char_index].index = index;
-        text_props->info->glyph[char_index].x_bear =
-           fg->glyph_out->left;
-        text_props->info->glyph[char_index].advance =
-           fg->glyph->advance.x >> 10;
-        text_props->info->glyph[char_index].width =
-           fg->glyph_out->bitmap.width;
+           gl_itr->index = 0;
+
+        gl_itr->index = index;
+        gl_itr->x_bear = fg->glyph_out->left;
+        gl_itr->advance = fg->glyph->advance.x >> 10;
+        gl_itr->width = fg->glyph_out->bitmap.width;
 
         prev_index = index;
      }
index 1884baf..b22a85d 100644 (file)
@@ -376,6 +376,7 @@ evas_common_soft16_line_draw(Soft16_Image *dst, RGBA_Draw_Context *dc, int x0, i
    int dx, dy;
    int  x, y, w, h;
 
+   c_tmp.mask = NULL;
    c_tmp.use = 1;
    c_tmp.x = 0;
    c_tmp.y = 0;
index 4e37f1a..6466abd 100644 (file)
@@ -125,6 +125,7 @@ EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, eet);
 EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, edb);
 EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, tga);
 EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, wbmp);
+EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, ico);
 EVAS_EINA_STATIC_MODULE_DEFINE(image_saver, edb);
 EVAS_EINA_STATIC_MODULE_DEFINE(image_saver, eet);
 EVAS_EINA_STATIC_MODULE_DEFINE(image_saver, jpeg);
@@ -240,6 +241,9 @@ static const struct {
 #ifdef EVAS_STATIC_BUILD_WBMP
   EVAS_EINA_STATIC_MODULE_USE(image_loader, wbmp),
 #endif
+#ifdef EVAS_STATIC_BUILD_ICO
+  EVAS_EINA_STATIC_MODULE_USE(image_loader, ico),
+#endif
 #ifdef EVAS_STATIC_BUILD_EDB
   EVAS_EINA_STATIC_MODULE_USE(image_saver, edb),
 #endif
index cdc5e96..57fc791 100644 (file)
@@ -116,44 +116,44 @@ struct _Evas_Cairo_Polygon_Point
 #endif
 
 /*
-Evas_GL_Context  *evas_gl_common_context_new(void);
-void              evas_gl_common_context_free(Evas_GL_Context *gc);
-void              evas_gl_common_context_use(Evas_GL_Context *gc);
-void              evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h);
-void              evas_gl_common_context_color_set(Evas_GL_Context *gc, int r, int g, int b, int a);
-void              evas_gl_common_context_blend_set(Evas_GL_Context *gc, int blend);
-void              evas_gl_common_context_dither_set(Evas_GL_Context *gc, int dither);
-void              evas_gl_common_context_texture_set(Evas_GL_Context *gc, Evas_GL_Texture *tex, int smooth, int w, int h);
-void              evas_gl_common_context_font_texture_set(Evas_GL_Context *gc, Evas_GL_Font_Texture *ft);
-void              evas_gl_common_context_clip_set(Evas_GL_Context *gc, int on, int x, int y, int w, int h);
-void              evas_gl_common_context_read_buf_set(Evas_GL_Context *gc, GLenum buf);
-void              evas_gl_common_context_write_buf_set(Evas_GL_Context *gc, GLenum buf);
-
-Evas_GL_Texture  *evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im, int smooth);
+Evas_Engine_GL_Context  *evas_gl_common_context_new(void);
+void              evas_gl_common_context_free(Evas_Engine_GL_Context *gc);
+void              evas_gl_common_context_use(Evas_Engine_GL_Context *gc);
+void              evas_gl_common_context_resize(Evas_Engine_GL_Context *gc, int w, int h);
+void              evas_gl_common_context_color_set(Evas_Engine_GL_Context *gc, int r, int g, int b, int a);
+void              evas_gl_common_context_blend_set(Evas_Engine_GL_Context *gc, int blend);
+void              evas_gl_common_context_dither_set(Evas_Engine_GL_Context *gc, int dither);
+void              evas_gl_common_context_texture_set(Evas_Engine_GL_Context *gc, Evas_GL_Texture *tex, int smooth, int w, int h);
+void              evas_gl_common_context_font_texture_set(Evas_Engine_GL_Context *gc, Evas_GL_Font_Texture *ft);
+void              evas_gl_common_context_clip_set(Evas_Engine_GL_Context *gc, int on, int x, int y, int w, int h);
+void              evas_gl_common_context_read_buf_set(Evas_Engine_GL_Context *gc, GLenum buf);
+void              evas_gl_common_context_write_buf_set(Evas_Engine_GL_Context *gc, GLenum buf);
+
+Evas_GL_Texture  *evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im, int smooth);
 void              evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im, int smooth);
 void              evas_gl_common_texture_free(Evas_GL_Texture *tex);
 void              evas_gl_common_texture_mipmaps_build(Evas_GL_Texture *tex, RGBA_Image *im, int smooth);
 
-Evas_GL_Image    *evas_gl_common_image_load(Evas_GL_Context *gc, char *file, char *key);
-Evas_GL_Image    *evas_gl_common_image_new_from_data(Evas_GL_Context *gc, int w, int h, int *data);
-Evas_GL_Image    *evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc, int w, int h, int *data);
-Evas_GL_Image    *evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h);
+Evas_GL_Image    *evas_gl_common_image_load(Evas_Engine_GL_Context *gc, char *file, char *key);
+Evas_GL_Image    *evas_gl_common_image_new_from_data(Evas_Engine_GL_Context *gc, int w, int h, int *data);
+Evas_GL_Image    *evas_gl_common_image_new_from_copied_data(Evas_Engine_GL_Context *gc, int w, int h, int *data);
+Evas_GL_Image    *evas_gl_common_image_new(Evas_Engine_GL_Context *gc, int w, int h);
 void              evas_gl_common_image_free(Evas_GL_Image *im);
 void              evas_gl_common_image_dirty(Evas_GL_Image *im);
 
 Evas_GL_Polygon  *evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, int y);
 Evas_GL_Polygon  *evas_gl_common_poly_points_clear(Evas_GL_Polygon *poly);
 
-void              evas_gl_common_swap_rect(Evas_GL_Context *gc, int x, int y, int w, int h);
+void              evas_gl_common_swap_rect(Evas_Engine_GL_Context *gc, int x, int y, int w, int h);
 
-void              evas_gl_common_rect_draw(Evas_GL_Context *gc, RGBA_Draw_Context *dc, int x, int y, int w, int h);
-void              evas_gl_common_image_draw(Evas_GL_Context *gc, RGBA_Draw_Context *dc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth);
-void              evas_gl_common_line_draw(Evas_GL_Context *gc, RGBA_Draw_Context *dc, int x1, int y1, int x2, int y2);
-void              evas_gl_common_poly_draw(Evas_GL_Context *gc, RGBA_Draw_Context *dc, Evas_GL_Polygon *poly);
+void              evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, RGBA_Draw_Context *dc, int x, int y, int w, int h);
+void              evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, RGBA_Draw_Context *dc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth);
+void              evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, RGBA_Draw_Context *dc, int x1, int y1, int x2, int y2);
+void              evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, RGBA_Draw_Context *dc, Evas_GL_Polygon *poly);
 
-Evas_GL_Font_Texture *evas_gl_font_texture_new(Evas_GL_Context *gc, RGBA_Font_Glyph *fg);
+Evas_GL_Font_Texture *evas_gl_font_texture_new(Evas_Engine_GL_Context *gc, RGBA_Font_Glyph *fg);
 void                  evas_gl_font_texture_free(Evas_GL_Font_Texture *ft);
-void                  evas_gl_font_texture_draw(Evas_GL_Context *gc, void *surface, RGBA_Draw_Context *dc, RGBA_Font_Glyph *fg, int x, int y);
+void                  evas_gl_font_texture_draw(Evas_Engine_GL_Context *gc, void *surface, RGBA_Draw_Context *dc, RGBA_Font_Glyph *fg, int x, int y);
 */
 
 #endif
index 6e9cb6d..eb5e9c7 100644 (file)
 #include <Eina.h>
 #include "Evas.h"
 
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 /* macros needed to log message through eina_log */
 extern EAPI int _evas_log_dom_global;
 #ifdef  _EVAS_DEFAULT_LOG_DOM
@@ -119,8 +123,8 @@ extern EAPI int _evas_log_dom_global;
 
 #ifdef BUILD_PTHREAD
 
-#ifndef __USE_GNU
-#define __USE_GNU
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
 #endif
 
 # include <pthread.h>
@@ -395,6 +399,7 @@ typedef unsigned char                   DATA8;
 
 typedef struct _Image_Entry             Image_Entry;
 typedef struct _Image_Entry_Flags      Image_Entry_Flags;
+typedef struct _Image_Timestamp         Image_Timestamp;
 typedef struct _Engine_Image_Entry      Engine_Image_Entry;
 typedef struct _Evas_Cache_Target       Evas_Cache_Target;
 typedef struct _Evas_Preload_Pthread    Evas_Preload_Pthread;
@@ -541,6 +546,16 @@ struct _Evas_Cache_Target
   void *data;
 };
 
+struct _Image_Timestamp
+{
+   time_t mtime;
+   off_t  size;
+   ino_t  ino;
+#ifdef _STAT_VER_LINUX
+   unsigned long int mtime_nsec;
+#endif   
+};
+
 struct _Image_Entry
 {
    EINA_INLIST;
@@ -553,10 +568,9 @@ struct _Image_Entry
    const char            *key;
 
    Evas_Cache_Target     *targets;
-   Evas_Preload_Pthread   *preload;
+   Evas_Preload_Pthread  *preload;
 
-   time_t                 timestamp;
-   time_t                 laststat;
+   Image_Timestamp        tstamp;
 
    int                    references;
 #ifdef EVAS_FRAME_QUEUING
index 73f3f42..3137579 100644 (file)
@@ -206,28 +206,33 @@ evas_object_clip_recalc(Evas_Object *obj)
    else cvis = obj->cur.visible;
    cr = obj->cur.color.r; cg = obj->cur.color.g;
    cb = obj->cur.color.b; ca = obj->cur.color.a;
-   if ((obj->cur.clipper) &&
-       (obj->cur.clipper->cur.map_parent == obj->cur.map_parent))
+   if (obj->cur.clipper)
      {
 // this causes problems... hmmm
-       if (obj->cur.clipper->cur.cache.clip.dirty)
-         evas_object_clip_recalc(obj->cur.clipper);
-       nx = obj->cur.clipper->cur.cache.clip.x;
-       ny = obj->cur.clipper->cur.cache.clip.y;
-       nw = obj->cur.clipper->cur.cache.clip.w;
-       nh = obj->cur.clipper->cur.cache.clip.h;
-       RECTS_CLIP_TO_RECT(cx, cy, cw, ch, nx, ny, nw, nh);
-
-       nvis = obj->cur.clipper->cur.cache.clip.visible;
-       nr = obj->cur.clipper->cur.cache.clip.r;
-       ng = obj->cur.clipper->cur.cache.clip.g;
-       nb = obj->cur.clipper->cur.cache.clip.b;
-       na = obj->cur.clipper->cur.cache.clip.a;
-       cvis = cvis * nvis;
-       cr = (cr * (nr + 1)) >> 8;
-       cg = (cg * (ng + 1)) >> 8;
-       cb = (cb * (nb + 1)) >> 8;
-       ca = (ca * (na + 1)) >> 8;
+        if (obj->cur.clipper->cur.cache.clip.dirty)
+          evas_object_clip_recalc(obj->cur.clipper);
+
+        // I don't know why this test was here in the first place. As I have
+        // no issue showing up due to this, I keep it and move color out of it.
+        if (obj->cur.clipper->cur.map_parent == obj->cur.map_parent)
+          {
+             nx = obj->cur.clipper->cur.cache.clip.x;
+             ny = obj->cur.clipper->cur.cache.clip.y;
+             nw = obj->cur.clipper->cur.cache.clip.w;
+             nh = obj->cur.clipper->cur.cache.clip.h;
+             RECTS_CLIP_TO_RECT(cx, cy, cw, ch, nx, ny, nw, nh);
+          }
+
+        nvis = obj->cur.clipper->cur.cache.clip.visible;
+        nr = obj->cur.clipper->cur.cache.clip.r;
+        ng = obj->cur.clipper->cur.cache.clip.g;
+        nb = obj->cur.clipper->cur.cache.clip.b;
+        na = obj->cur.clipper->cur.cache.clip.a;
+        cvis = cvis * nvis;
+        cr = (cr * (nr + 1)) >> 8;
+        cg = (cg * (ng + 1)) >> 8;
+        cb = (cb * (nb + 1)) >> 8;
+        ca = (ca * (na + 1)) >> 8;
      }
    if ((ca == 0 && obj->cur.render_op == EVAS_RENDER_BLEND) || (cw <= 0) || (ch <= 0)) cvis = 0;
    obj->cur.cache.clip.x = cx;
index 6103bfd..012a449 100644 (file)
@@ -460,6 +460,8 @@ struct _Evas_Object
    struct {
       int                      in_move, in_resize;
    } doing;
+   
+   unsigned int                ref;
 
    unsigned char               delete_me;
 
@@ -488,6 +490,7 @@ struct _Evas_Object
    Eina_Bool                   changed_move : 1;
    Eina_Bool                   changed_move_only : 1;
    Eina_Bool                   changed_nomove : 1;
+   Eina_Bool                   del_ref : 1;
 };
 
 struct _Evas_Func_Node
index bdc9ba1..40337a8 100644 (file)
@@ -17,15 +17,20 @@ endif
 if !EVAS_STATIC_BUILD_FB
 SUBDIRS += fb
 endif
+
+if !EVAS_STATIC_BUILD_GL_COMMON
+SUBDIRS += gl_common
+endif
 if !EVAS_STATIC_BUILD_GL_GLEW
-SUBDIRS += gl_common gl_glew
+SUBDIRS += gl_glew
 endif
 if !EVAS_STATIC_BUILD_GL_X11
-SUBDIRS += gl_common gl_x11
+SUBDIRS += gl_x11
 endif
 if !EVAS_STATIC_BUILD_GL_SDL
-SUBDIRS += gl_common gl_sdl
+SUBDIRS += gl_sdl
 endif
+
 if !EVAS_STATIC_BUILD_QUARTZ
 SUBDIRS += quartz
 endif
index 45d92cd..aa02fc6 100644 (file)
@@ -17,13 +17,13 @@ BUFFER_SOURCES = \
 evas_engine.c \
 evas_outbuf.c
 
-pkgdir = $(libdir)/evas/modules/engines/buffer/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_Buffer.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_BUFFER
 
+pkgdir = $(libdir)/evas/modules/engines/buffer/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 
 module_la_SOURCES = $(BUFFER_SOURCES)
index 33153ff..d2fa180 100644 (file)
@@ -18,13 +18,13 @@ evas_x_main.c
 
 CAIRO_X11_LIBADD = @evas_engine_cairo_x11_libs@ $(top_builddir)/src/modules/engines/cairo_common/libevas_engine_cairo_common.la
 
-pkgdir = $(libdir)/evas/modules/engines/cairo_x11/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_Cairo_X11.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_CAIRO_X11
 
+pkgdir = $(libdir)/evas/modules/engines/cairo_x11/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 
 module_la_SOURCES = $(CAIRO_X11_SOURCES)
index 5847494..6b64ef5 100644 (file)
@@ -29,13 +29,13 @@ evas_direct3d_vertex_buffer_cache.cpp
 
 DIRECT3D_LIBADD = @evas_engine_direct3d_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/direct3d/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_Direct3D.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_DIRECT3D
 
+pkgdir = $(libdir)/evas/modules/engines/direct3d/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 module_la_SOURCES = $(DIRECT3D_SOURCES)
 module_la_CXXFLAGS = -fno-exceptions
index ff571b5..fae87da 100644 (file)
@@ -17,13 +17,13 @@ if BUILD_ENGINE_DIRECTFB
 DIRECTFB_SOURCES = evas_engine.c polygon.c
 DIRECTFB_LIBADD = @evas_engine_directfb_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/directfb/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_DirectFB.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_DIRECTFB
 
+pkgdir = $(libdir)/evas/modules/engines/directfb/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 
 module_la_SOURCES  = $(DIRECTFB_SOURCES)
index 58c70ca..47527f7 100644 (file)
@@ -19,13 +19,13 @@ evas_outbuf.c
 
 FB_LIBADD = @evas_engine_fb_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/fb/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_FB.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_FB
 
+pkgdir = $(libdir)/evas/modules/engines/fb/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 module_la_SOURCES = $(FB_SOURCES)
 module_la_LIBADD = @EINA_LIBS@ $(FB_LIBADD) $(top_builddir)/src/lib/libevas.la
index d83bdd1..893e00f 100644 (file)
 typedef struct _Evas_GL_Program                      Evas_GL_Program;
 typedef struct _Evas_GL_Program_Source               Evas_GL_Program_Source;
 typedef struct _Evas_GL_Shared                       Evas_GL_Shared;
-typedef struct _Evas_GL_Context                      Evas_GL_Context;
+typedef struct _Evas_Engine_GL_Context               Evas_Engine_GL_Context;
 typedef struct _Evas_GL_Texture_Pool                 Evas_GL_Texture_Pool;
 typedef struct _Evas_GL_Texture                      Evas_GL_Texture;
 typedef struct _Evas_GL_Image                        Evas_GL_Image;
@@ -218,7 +218,7 @@ struct _Evas_GL_Shared
 
 
 
-struct _Evas_GL_Context
+struct _Evas_Engine_GL_Context
 {
    int                references;
    int                w, h;
@@ -297,7 +297,7 @@ struct _Evas_GL_Context
 
 struct _Evas_GL_Texture_Pool
 {
-   Evas_GL_Context *gc;
+   Evas_Engine_GL_Context *gc;
    GLuint           texture, fb;
    GLuint           intformat, format, dataformat;
    int              w, h;
@@ -318,7 +318,7 @@ struct _Evas_GL_Texture_Pool
 
 struct _Evas_GL_Texture
 {
-   Evas_GL_Context *gc;
+   Evas_Engine_GL_Context *gc;
    Evas_GL_Image   *im;
    Evas_GL_Texture_Pool *pt, *ptu, *ptv;
    int              x, y, w, h;
@@ -330,7 +330,7 @@ struct _Evas_GL_Texture
 
 struct _Evas_GL_Image
 {
-   Evas_GL_Context *gc;
+   Evas_Engine_GL_Context *gc;
    RGBA_Image      *im;
    Evas_GL_Texture *tex;
    RGBA_Image_Loadopts load_opts;
@@ -410,26 +410,29 @@ extern Evas_GL_Program_Source shader_tex_nomul_vert_src;
 
 void glerr(int err, const char *file, const char *func, int line, const char *op);
  
-Evas_GL_Context  *evas_gl_common_context_new(void);
-void              evas_gl_common_context_free(Evas_GL_Context *gc);
-void              evas_gl_common_context_use(Evas_GL_Context *gc);
-void              evas_gl_common_context_newframe(Evas_GL_Context *gc);
-void              evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h, int rot);
-void              evas_gl_common_context_target_surface_set(Evas_GL_Context *gc, Evas_GL_Image *surface);
-
-void              evas_gl_common_context_line_push(Evas_GL_Context *gc,
+Evas_Engine_GL_Context  *evas_gl_common_context_new(void);
+void              evas_gl_common_context_free(Evas_Engine_GL_Context *gc);
+void              evas_gl_common_context_use(Evas_Engine_GL_Context *gc);
+void              evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc);
+void              evas_gl_common_context_resize(Evas_Engine_GL_Context *gc, int w, int h, int rot);
+void              evas_gl_common_context_target_surface_set(Evas_Engine_GL_Context *gc, Evas_GL_Image *surface);
+
+void              evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc,
                                                    int x1, int y1, int x2, int y2,
                                                    int clip, int cx, int cy, int cw, int ch,
                                                    int r, int g, int b, int a);
-void              evas_gl_common_context_rectangle_push(Evas_GL_Context *gc,
+void              evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc,
                                                         int x, int y, int w, int h,
                                                         int r, int g, int b, int a);
-void              evas_gl_common_context_image_push(Evas_GL_Context *gc,
+void              evas_gl_common_context_image_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, Eina_Bool tex_only);
+<<<<<<< HEAD
+void              evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
+=======
 void              evas_gl_common_context_image_mask_push(Evas_GL_Context *gc,
                                                     Evas_GL_Texture *tex,
                                                     Evas_GL_Texture *texm,
@@ -441,17 +444,18 @@ void              evas_gl_common_context_image_mask_push(Evas_GL_Context *gc,
 
 
 void              evas_gl_common_context_font_push(Evas_GL_Context *gc,
+>>>>>>> EFL_upgrade[add]
                                                    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);
-void             evas_gl_common_context_yuv_push(Evas_GL_Context *gc,
+void             evas_gl_common_context_yuv_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_GL_Context *gc,
+void             evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
                                                        Evas_GL_Texture *tex,
                                                        int npoints,
                                                        RGBA_Map_Point *p,
@@ -460,7 +464,7 @@ void             evas_gl_common_context_image_map_push(Evas_GL_Context *gc,
                                                        Eina_Bool smooth, 
                                                        Eina_Bool tex_only,
                                                        Eina_Bool yuv);
-void              evas_gl_common_context_flush(Evas_GL_Context *gc);
+void              evas_gl_common_context_flush(Evas_Engine_GL_Context *gc);
 
 int               evas_gl_common_shader_program_init(Evas_GL_Program *p,
                                                      Evas_GL_Program_Source *vert,
@@ -468,39 +472,39 @@ int               evas_gl_common_shader_program_init(Evas_GL_Program *p,
                                                      const char *name);
 void              evas_gl_common_shader_program_shutdown(Evas_GL_Program *p);
     
-void              evas_gl_common_rect_draw(Evas_GL_Context *gc, int x, int y, int w, int h);
+void              evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h);
 
 void              evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt);
-Evas_GL_Texture  *evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im);
-Evas_GL_Texture  *evas_gl_common_texture_native_new(Evas_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_GL_Image *im);
-Evas_GL_Texture  *evas_gl_common_texture_render_new(Evas_GL_Context *gc, unsigned int w, unsigned int h, int alpha);
-Evas_GL_Texture  *evas_gl_common_texture_dynamic_new(Evas_GL_Context *gc, Evas_GL_Image *im);
+Evas_GL_Texture  *evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im);
+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);
+Evas_GL_Texture  *evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha);
+Evas_GL_Texture  *evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im);
 void              evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im);
 void              evas_gl_common_texture_free(Evas_GL_Texture *tex);
-Evas_GL_Texture  *evas_gl_common_texture_alpha_new(Evas_GL_Context *gc, DATA8 *pixels, unsigned int w, unsigned int h, int fh);
+Evas_GL_Texture  *evas_gl_common_texture_alpha_new(Evas_Engine_GL_Context *gc, DATA8 *pixels, unsigned int w, unsigned int h, int fh);
 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_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h);
+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);
 
-void              evas_gl_common_image_all_unload(Evas_GL_Context *gc);
+void              evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc);
 
 void              evas_gl_common_image_ref(Evas_GL_Image *im);
 void              evas_gl_common_image_unref(Evas_GL_Image *im);
-Evas_GL_Image    *evas_gl_common_image_load(Evas_GL_Context *gc, const char *file, const char *key, Evas_Image_Load_Opts *lo, int *error);
-Evas_GL_Image    *evas_gl_common_image_new_from_data(Evas_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, int cspace);
-Evas_GL_Image    *evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, int cspace);
-Evas_GL_Image    *evas_gl_common_image_new(Evas_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int cspace);
+Evas_GL_Image    *evas_gl_common_image_load(Evas_Engine_GL_Context *gc, const char *file, const char *key, Evas_Image_Load_Opts *lo, int *error);
+Evas_GL_Image    *evas_gl_common_image_new_from_data(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, int cspace);
+Evas_GL_Image    *evas_gl_common_image_new_from_copied_data(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, int cspace);
+Evas_GL_Image    *evas_gl_common_image_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int cspace);
 Evas_GL_Image    *evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha);
 void              evas_gl_common_image_native_enable(Evas_GL_Image *im);
 void              evas_gl_common_image_native_disable(Evas_GL_Image *im);
 void              evas_gl_common_image_scale_hint_set(Evas_GL_Image *im, int hint);
 void              evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint);
-void              evas_gl_common_image_cache_flush(Evas_GL_Context *gc);
+void              evas_gl_common_image_cache_flush(Evas_Engine_GL_Context *gc);
 void              evas_gl_common_image_free(Evas_GL_Image *im);
-Evas_GL_Image    *evas_gl_common_image_surface_new(Evas_GL_Context *gc, unsigned int w, unsigned int h, int alpha);
+Evas_GL_Image    *evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha);
 void              evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
-void              evas_gl_common_image_map_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int npoints, RGBA_Map_Point *p, int smooth, int level);
-void              evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth);
+void              evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int npoints, RGBA_Map_Point *p, int smooth, int level);
+void              evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth);
 
 void             *evas_gl_font_texture_new(void *gc, RGBA_Font_Glyph *fg);
 void              evas_gl_font_texture_free(void *);
@@ -508,9 +512,9 @@ void              evas_gl_font_texture_draw(void *gc, void *surface, void *dc, R
 
 Evas_GL_Polygon  *evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, int y);
 Evas_GL_Polygon  *evas_gl_common_poly_points_clear(Evas_GL_Polygon *poly);
-void              evas_gl_common_poly_draw(Evas_GL_Context *gc, Evas_GL_Polygon *poly, int x, int y);
+void              evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int x, int y);
 
-void              evas_gl_common_line_draw(Evas_GL_Context *gc, int x1, int y1, int x2, int y2);
+void              evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int y2);
 
 extern void (*glsym_glGenFramebuffers)      (GLsizei a, GLuint *b);
 extern void (*glsym_glBindFramebuffer)      (GLenum a, GLuint b);
index 5eceb64..5991b78 100644 (file)
@@ -107,9 +107,9 @@ gl_symbols(void)
 #endif   
 }
 
-static void shader_array_flush(Evas_GL_Context *gc);
+static void shader_array_flush(Evas_Engine_GL_Context *gc);
 
-static Evas_GL_Context *_evas_gl_common_context = NULL;
+static Evas_Engine_GL_Context *_evas_gl_common_context = NULL;
 static Evas_GL_Shared *shared = NULL;
 
 void
@@ -287,11 +287,12 @@ _evas_gl_common_version_check()
 }
 
 static void
-_evas_gl_common_viewport_set(Evas_GL_Context *gc)
+_evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
 {
    GLfloat proj[16];
    int w = 1, h = 1, m = 1, rot = 1, foc = 0;
 
+   EINA_SAFETY_ON_NULL_RETURN(gc);
    foc = gc->foc;
    // surface in pipe 0 will be the same as all pipes
    if ((gc->pipe[0].shader.surface == gc->def_surface) ||
@@ -476,23 +477,23 @@ _evas_gl_common_viewport_set(Evas_GL_Context *gc)
    GLERR(__FUNCTION__, __FILE__, __LINE__, "");
 }
 
-Evas_GL_Context *
+Evas_Engine_GL_Context *
 evas_gl_common_context_new(void)
 {
-   Evas_GL_Context *gc;
+   Evas_Engine_GL_Context *gc;
    const char *s;
    int i;
 
 #if 1
    if (_evas_gl_common_context)
      {
-       _evas_gl_common_context->references++;
-       return _evas_gl_common_context;
+        _evas_gl_common_context->references++;
+        return _evas_gl_common_context;
      }
 #endif
    if (!_evas_gl_common_version_check())
      return NULL;
-   gc = calloc(1, sizeof(Evas_GL_Context));
+   gc = calloc(1, sizeof(Evas_Engine_GL_Context));
    if (!gc) return NULL;
 
    gl_symbols();
@@ -776,7 +777,7 @@ evas_gl_common_context_new(void)
 }
 
 void
-evas_gl_common_context_free(Evas_GL_Context *gc)
+evas_gl_common_context_free(Evas_Engine_GL_Context *gc)
 {
    int i, j;
    Eina_List *l;
@@ -840,7 +841,7 @@ evas_gl_common_context_free(Evas_GL_Context *gc)
 }
 
 void
-evas_gl_common_context_use(Evas_GL_Context *gc)
+evas_gl_common_context_use(Evas_Engine_GL_Context *gc)
 {
    if (_evas_gl_common_context == gc) return;
    _evas_gl_common_context = gc;
@@ -848,7 +849,7 @@ evas_gl_common_context_use(Evas_GL_Context *gc)
 }
 
 void
-evas_gl_common_context_newframe(Evas_GL_Context *gc)
+evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
 {
    int i;
 
@@ -959,7 +960,7 @@ evas_gl_common_context_newframe(Evas_GL_Context *gc)
 }
 
 void
-evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h, int rot)
+evas_gl_common_context_resize(Evas_Engine_GL_Context *gc, int w, int h, int rot)
 {
    if ((gc->w == w) && (gc->h == h) && (gc->rot == rot)) return;
    evas_gl_common_context_flush(gc);
@@ -971,7 +972,7 @@ evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h, int rot)
 }
 
 void
-evas_gl_common_context_target_surface_set(Evas_GL_Context *gc,
+evas_gl_common_context_target_surface_set(Evas_Engine_GL_Context *gc,
                                           Evas_GL_Image *surface)
 {
    if (surface == gc->pipe[0].shader.surface) return;
@@ -1039,7 +1040,7 @@ evas_gl_common_context_target_surface_set(Evas_GL_Context *gc,
 
 
 static inline void
-array_alloc(Evas_GL_Context *gc, int n)
+array_alloc(Evas_Engine_GL_Context *gc, int n)
 {
    gc->havestuff = EINA_TRUE;
    if (gc->pipe[n].array.num <= gc->pipe[n].array.alloc) return;
@@ -1065,7 +1066,7 @@ array_alloc(Evas_GL_Context *gc, int n)
 }
 
 static int
-pipe_region_intersects(Evas_GL_Context *gc, int n,
+pipe_region_intersects(Evas_Engine_GL_Context *gc, int n,
                        int x, int y, int w, int h)
 {
    int i, rx, ry, rw, rh, ii;
@@ -1104,7 +1105,7 @@ pipe_region_intersects(Evas_GL_Context *gc, int n,
 }
 
 static void
-pipe_region_expand(Evas_GL_Context *gc, int n,
+pipe_region_expand(Evas_Engine_GL_Context *gc, int n,
                    int x, int y, int w, int h)
 {
    int x1, y1, x2, y2;
@@ -1132,7 +1133,7 @@ pipe_region_expand(Evas_GL_Context *gc, int n,
 }
 
 static Eina_Bool
-vertex_array_size_check(Evas_GL_Context *gc, int pn, int n)
+vertex_array_size_check(Evas_Engine_GL_Context *gc, int pn, int n)
 {
    return 1;
 // this fixup breaks for expedite test 32. why?
@@ -1145,7 +1146,7 @@ vertex_array_size_check(Evas_GL_Context *gc, int pn, int n)
 }
 
 void
-evas_gl_common_context_line_push(Evas_GL_Context *gc, 
+evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc, 
                                  int x1, int y1, int x2, int y2,
                                  int clip, int cx, int cy, int cw, int ch,
                                  int r, int g, int b, int a)
@@ -1201,7 +1202,11 @@ evas_gl_common_context_line_push(Evas_GL_Context *gc,
 }
 
 void
+<<<<<<< HEAD
+evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc, 
+=======
 evas_gl_common_context_rectangle_push(Evas_GL_Context *gc,
+>>>>>>> EFL_upgrade[add]
                                       int x, int y, int w, int h,
                                       int r, int g, int b, int a)
 {
@@ -1348,7 +1353,7 @@ again:
 }
 
 void
-evas_gl_common_context_image_push(Evas_GL_Context *gc,
+evas_gl_common_context_image_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,
@@ -1554,9 +1559,9 @@ again:
    if ((tex->im) && (tex->im->native.data) && (!tex->im->native.yinvert))
      {
         tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w;
-        ty1 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h;
+        ty1 = 1.0 - ((double)(tex->y) + sy) / (double)tex->pt->h;
         tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w;
-        ty2 = ((double)(tex->y) + sy) / (double)tex->pt->h;
+        ty2 = 1.0 - ((double)(tex->y) + sy + sh) / (double)tex->pt->h;
      }
    else
      {
@@ -1839,7 +1844,7 @@ again:
 
 
 void
-evas_gl_common_context_font_push(Evas_GL_Context *gc,
+evas_gl_common_context_font_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,
@@ -1998,7 +2003,7 @@ again:
 }
 
 void
-evas_gl_common_context_yuv_push(Evas_GL_Context *gc,
+evas_gl_common_context_yuv_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,
@@ -2185,7 +2190,7 @@ again:
 }
 
 void
-evas_gl_common_context_image_map_push(Evas_GL_Context *gc,
+evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
                                       Evas_GL_Texture *tex,
                                       int npoints,
                                       RGBA_Map_Point *p,
@@ -2580,13 +2585,13 @@ again:
 }
 
 void
-evas_gl_common_context_flush(Evas_GL_Context *gc)
+evas_gl_common_context_flush(Evas_Engine_GL_Context *gc)
 {
    shader_array_flush(gc);
 }
 
 static void
-shader_array_flush(Evas_GL_Context *gc)
+shader_array_flush(Evas_Engine_GL_Context *gc)
 {
    int i, gw, gh, setclip, cy, fbo = 0, done = 0;
 
index ac0edf8..d867a09 100644 (file)
@@ -3,7 +3,7 @@
 void *
 evas_gl_font_texture_new(void *context, RGBA_Font_Glyph *fg)
 {
-   Evas_GL_Context *gc = context;
+   Evas_Engine_GL_Context *gc = context;
    Evas_GL_Texture *tex;
    DATA8 *data;
    int w, h, j, nw;
@@ -99,7 +99,7 @@ evas_gl_font_texture_free(void *tex)
 void
 evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_context, RGBA_Font_Glyph *fg, int x, int y)
 {
-   Evas_GL_Context *gc = context;
+   Evas_Engine_GL_Context *gc = context;
    RGBA_Draw_Context *dc = draw_context;
    Evas_GL_Texture *tex;
    Cutout_Rects *rects;
index e119df9..75e9ce6 100644 (file)
@@ -1,7 +1,7 @@
 #include "evas_gl_private.h"
 
 void
-evas_gl_common_image_all_unload(Evas_GL_Context *gc)
+evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc)
 {
    Eina_List *l;
    Evas_GL_Image *im;
@@ -21,7 +21,7 @@ evas_gl_common_image_all_unload(Evas_GL_Context *gc)
 }
 
 static void
-_evas_gl_image_cache_trim(Evas_GL_Context *gc)
+_evas_gl_image_cache_trim(Evas_Engine_GL_Context *gc)
 {
    int size = evas_common_image_get_cache();
 
@@ -97,7 +97,7 @@ evas_gl_common_image_unref(Evas_GL_Image *im)
 }
 
 Evas_GL_Image *
-evas_gl_common_image_load(Evas_GL_Context *gc, const char *file, const char *key, Evas_Image_Load_Opts *lo, int *error)
+evas_gl_common_image_load(Evas_Engine_GL_Context *gc, const char *file, const char *key, Evas_Image_Load_Opts *lo, int *error)
 {
    Evas_GL_Image        *im;
    RGBA_Image           *im_im;
@@ -142,7 +142,7 @@ evas_gl_common_image_load(Evas_GL_Context *gc, const char *file, const char *key
 }
 
 Evas_GL_Image *
-evas_gl_common_image_new_from_data(Evas_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, int cspace)
+evas_gl_common_image_new_from_data(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, int cspace)
 {
    Evas_GL_Image *im;
    Eina_List *l;
@@ -196,7 +196,7 @@ evas_gl_common_image_new_from_data(Evas_GL_Context *gc, unsigned int w, unsigned
 }
 
 Evas_GL_Image *
-evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, int cspace)
+evas_gl_common_image_new_from_copied_data(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, int cspace)
 {
    Evas_GL_Image *im;
 
@@ -237,7 +237,7 @@ evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc, unsigned int w, u
 }
 
 Evas_GL_Image *
-evas_gl_common_image_new(Evas_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int cspace)
+evas_gl_common_image_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int cspace)
 {
    Evas_GL_Image *im;
 
@@ -425,7 +425,7 @@ evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint)
 }
 
 void
-evas_gl_common_image_cache_flush(Evas_GL_Context *gc)
+evas_gl_common_image_cache_flush(Evas_Engine_GL_Context *gc)
 {
    _evas_gl_image_cache_trim(gc);
 }
@@ -453,7 +453,7 @@ evas_gl_common_image_free(Evas_GL_Image *im)
 }
 
 Evas_GL_Image *
-evas_gl_common_image_surface_new(Evas_GL_Context *gc, unsigned int w, unsigned int h, int alpha)
+evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha)
 {
    Evas_GL_Image *im;
 
@@ -486,7 +486,7 @@ evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, un
 }
 
 static void
-_evas_gl_common_image_update(Evas_GL_Context *gc, Evas_GL_Image *im)
+_evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
 {
    if (!im->im) return;
 /*   
@@ -553,7 +553,7 @@ _evas_gl_common_image_update(Evas_GL_Context *gc, Evas_GL_Image *im)
 }
 
 void
-evas_gl_common_image_map_draw(Evas_GL_Context *gc, Evas_GL_Image *im, 
+evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, 
                               int npoints, RGBA_Map_Point *p, int smooth, int level __UNUSED__)
 {
    RGBA_Draw_Context *dc;
@@ -590,7 +590,7 @@ evas_gl_common_image_map_draw(Evas_GL_Context *gc, Evas_GL_Image *im,
 }
 
 void
-evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth)
+evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth)
 {
    RGBA_Draw_Context *dc;
    Evas_GL_Image *imm;
index 33a3187..a76fa6a 100644 (file)
@@ -1,7 +1,7 @@
 #include "evas_gl_private.h"
 
 void
-evas_gl_common_line_draw(Evas_GL_Context *gc, int x1, int y1, int x2, int y2)
+evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int y2)
 {
    RGBA_Draw_Context *dc;
    int r, g, b, a;
index fda1400..fa6b312 100644 (file)
@@ -120,7 +120,7 @@ polygon_edge_sorter(const void *a, const void *b)
 }
 
 void
-evas_gl_common_poly_draw(Evas_GL_Context *gc, Evas_GL_Polygon *poly, int dx, int dy)
+evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int dx, int dy)
 {
    Cutout_Rects *rects;
    Cutout_Rect  *r;
index a5cbece..2714cfd 100644 (file)
@@ -1,7 +1,7 @@
 #include "evas_gl_private.h"
 
 void
-evas_gl_common_rect_draw(Evas_GL_Context *gc, int x, int y, int w, int h)
+evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h)
 {
    Cutout_Rects *rects;
    Cutout_Rect  *r;
index 0810472..6e8246b 100644 (file)
@@ -63,7 +63,7 @@ _nearest_pow2(int num)
 }
 
 static void
-_tex_adjust(Evas_GL_Context *gc, int *w, int *h)
+_tex_adjust(Evas_Engine_GL_Context *gc, int *w, int *h)
 {
    if (gc->shared->info.tex_npo2) return;
    /*if (gc->shared->info.tex_rect) return;*/
@@ -72,7 +72,7 @@ _tex_adjust(Evas_GL_Context *gc, int *w, int *h)
 }
 
 static int
-_tex_round_slot(Evas_GL_Context *gc, int h)
+_tex_round_slot(Evas_Engine_GL_Context *gc, int h)
 {
    if (!gc->shared->info.tex_npo2)
      h = _nearest_pow2(h);
@@ -117,7 +117,7 @@ _tex_sub_2d(int x, int y, int w, int h, int fmt, int type, const void *pix)
 }
 
 static Evas_GL_Texture_Pool *
-_pool_tex_new(Evas_GL_Context *gc, int w, int h, int intformat, GLenum format)
+_pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum format)
 {
    Evas_GL_Texture_Pool *pt;
    
@@ -215,7 +215,7 @@ _pool_tex_alloc(Evas_GL_Texture_Pool *pt, int w, int h __UNUSED__, int *u, int *
 }
 
 static Evas_GL_Texture_Pool *
-_pool_tex_find(Evas_GL_Context *gc, int w, int h, 
+_pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h, 
                int intformat, int format, int *u, int *v, 
                Eina_List **l_after, int atlas_w)
 {
@@ -264,7 +264,7 @@ _pool_tex_find(Evas_GL_Context *gc, int w, int h,
 }
 
 Evas_GL_Texture *
-evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im)
+evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im)
 {
    Evas_GL_Texture *tex;
    Eina_List *l_after = NULL;
@@ -331,7 +331,7 @@ evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im)
 }
 
 static Evas_GL_Texture_Pool *
-_pool_tex_render_new(Evas_GL_Context *gc, int w, int h, int intformat, int format)
+_pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format)
 {
    Evas_GL_Texture_Pool *pt;
    
@@ -396,7 +396,7 @@ _pool_tex_render_new(Evas_GL_Context *gc, int w, int h, int intformat, int forma
 }
 
 static Evas_GL_Texture_Pool *
-_pool_tex_native_new(Evas_GL_Context *gc, int w, int h, int intformat, int format, Evas_GL_Image *im)
+_pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format, Evas_GL_Image *im)
 {
    Evas_GL_Texture_Pool *pt;
    
@@ -457,7 +457,7 @@ _pool_tex_native_new(Evas_GL_Context *gc, int w, int h, int intformat, int forma
 }
 
 static Evas_GL_Texture_Pool *
-_pool_tex_dynamic_new(Evas_GL_Context *gc, int w, int h, int intformat, int format)
+_pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format)
 {
    Evas_GL_Texture_Pool *pt = NULL;
    
@@ -696,7 +696,7 @@ pt_unref(Evas_GL_Texture_Pool *pt)
 }
 
 Evas_GL_Texture *
-evas_gl_common_texture_native_new(Evas_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_GL_Image *im)
+evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_GL_Image *im)
 {
    Evas_GL_Texture *tex;
 
@@ -734,7 +734,7 @@ evas_gl_common_texture_native_new(Evas_GL_Context *gc, unsigned int w, unsigned
 }
 
 Evas_GL_Texture *
-evas_gl_common_texture_render_new(Evas_GL_Context *gc, unsigned int w, unsigned int h, int alpha)
+evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha)
 {
    Evas_GL_Texture *tex;
 
@@ -772,7 +772,7 @@ evas_gl_common_texture_render_new(Evas_GL_Context *gc, unsigned int w, unsigned
 }
 
 Evas_GL_Texture *
-evas_gl_common_texture_dynamic_new(Evas_GL_Context *gc, Evas_GL_Image *im)
+evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
 {
    Evas_GL_Texture *tex;
 
@@ -916,7 +916,7 @@ evas_gl_common_texture_free(Evas_GL_Texture *tex)
 }
 
 Evas_GL_Texture *
-evas_gl_common_texture_alpha_new(Evas_GL_Context *gc, DATA8 *pixels,
+evas_gl_common_texture_alpha_new(Evas_Engine_GL_Context *gc, DATA8 *pixels,
                                  unsigned int w, unsigned int h, int fh)
 {
    Evas_GL_Texture *tex;
@@ -973,7 +973,7 @@ evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels,
 }
 
 Evas_GL_Texture *
-evas_gl_common_texture_yuv_new(Evas_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h)
+evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h)
 {
    Evas_GL_Texture *tex;
 
index 2042b4a..13307f7 100644 (file)
@@ -18,13 +18,13 @@ evas_glew_win32_main.c
 
 GL_GLEW_LIBADD = @evas_engine_gl_glew_libs@ $(top_builddir)/src/modules/engines/gl_common/libevas_engine_gl_common.la
 
-pkgdir = $(libdir)/evas/modules/engines/gl_glew/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_GL_Glew.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_GL_GLEW
 
+pkgdir = $(libdir)/evas/modules/engines/gl_glew/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 
 module_la_SOURCES  = $(GL_GLEW_SOURCES)
index d38c4fa..46393fb 100644 (file)
@@ -48,7 +48,7 @@ struct _Evas_GL_Glew_Window
    int              width;
    int              height;
    int              depth;
-   Evas_GL_Context *gl_context;
+   Evas_Engine_GL_Context *gl_context;
    struct {
       int           x1;
       int           y1;
index 4af0ed5..57da21b 100644 (file)
@@ -17,13 +17,13 @@ evas_engine.c
 
 GL_SDL_LIBADD = @evas_engine_gl_sdl_libs@ $(top_builddir)/src/modules/engines/gl_common/libevas_engine_gl_common.la 
 
-pkgdir = $(libdir)/evas/modules/engines/gl_sdl/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_GL_SDL.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_GL_SDL
 
+pkgdir = $(libdir)/evas/modules/engines/gl_sdl/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 
 module_la_SOURCES = $(GL_SDL_SOURCES)
index 36d91b4..7d46720 100644 (file)
@@ -55,7 +55,7 @@ struct _Render_Engine
    Evas_Engine_Info_GL_SDL     *info;
    int                 w, h;
 
-   Evas_GL_Context *gl_context;
+   Evas_Engine_GL_Context *gl_context;
    struct {
       int              redraw : 1;
       int              drew : 1;
index de391da..91cd0d4 100644 (file)
@@ -18,13 +18,13 @@ evas_x_main.c
 
 GL_X11_LIBADD = @evas_engine_gl_x11_libs@ $(top_builddir)/src/modules/engines/gl_common/libevas_engine_gl_common.la 
 
-pkgdir = $(libdir)/evas/modules/engines/gl_x11/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_GL_X11.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_GL_X11
 
+pkgdir = $(libdir)/evas/modules/engines/gl_x11/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 
 module_la_SOURCES = $(GL_X11_SOURCES)
index 8523df4..f943209 100644 (file)
@@ -66,7 +66,8 @@ int      (*glsym_glXWaitVideoSync)   (int a, int b, unsigned int *c) = NULL;
 XID      (*glsym_glXCreatePixmap)    (Display *a, void *b, Pixmap c, const int *d) = NULL;
 void     (*glsym_glXDestroyPixmap)   (Display *a, XID b) = NULL;
 void     (*glsym_glXQueryDrawable)   (Display *a, XID b, int c, unsigned int *d) = NULL;
-void     (*glsym_glxSwapInterval)    (int a) = NULL;
+int      (*glsym_glxSwapIntervalSGI) (int a) = NULL;
+void     (*glsym_glxSwapIntervalEXT) (Display *s, GLXDrawable b, int c) = NULL;
 #endif
 
 static void
@@ -140,10 +141,10 @@ _sym_init(void)
    FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawableEXT", glsym_func_void);
    FINDSYM(glsym_glXQueryDrawable, "glXQueryDrawableARB", glsym_func_void);
 
-   FINDSYM(glsym_glxSwapInterval, "glxSwapInterval", glsym_func_void);
-   FINDSYM(glsym_glxSwapInterval, "glxSwapIntervalEXT", glsym_func_void);
-   FINDSYM(glsym_glxSwapInterval, "glxSwapIntervalARB", glsym_func_void);
-   FINDSYM(glsym_glxSwapInterval, "glxSwapIntervalSGI", glsym_func_void);
+   FINDSYM(glsym_glxSwapIntervalSGI, "glXSwapIntervalMESA", glsym_func_int);
+   FINDSYM(glsym_glxSwapIntervalSGI, "glXSwapIntervalSGI", glsym_func_int);
+   
+   FINDSYM(glsym_glxSwapIntervalEXT, "glXSwapIntervalEXT", glsym_func_void);
 #endif
 }
 
@@ -668,12 +669,21 @@ eng_output_flush(void *data)
 #ifdef VSYNC_TO_SCREEN   
    if ((re->info->vsync)/* || (1)*/)
      {
-        if (glsym_glxSwapInterval)
+        if (glsym_glxSwapIntervalEXT)
+          {
+             if (!re->vsync)
+               {
+                  if (re->info->vsync) glsym_glxSwapIntervalEXT(re->win->disp, re->win->win, 1);
+                  else glsym_glxSwapIntervalEXT(re->win->disp, re->win->win, 0);
+                  re->vsync = 1;
+               }
+          }
+        if (glsym_glxSwapIntervalSGI)
           {
              if (!re->vsync)
                {
-                  if (re->info->vsync) glsym_glxSwapInterval(1);
-                  else glsym_glxSwapInterval(0);
+                  if (re->info->vsync) glsym_glxSwapIntervalSGI(1);
+                  else glsym_glxSwapIntervalSGI(0);
                   re->vsync = 1;
                }
           }
index 30a0c04..0d63f9d 100644 (file)
@@ -82,7 +82,7 @@ struct _Evas_GL_X11_Window
    int              depth;
    int              alpha;
    int              rot;
-   Evas_GL_Context *gl_context;
+   Evas_Engine_GL_Context *gl_context;
    struct {
       int              redraw : 1;
       int              drew : 1;
index 95437dd..e370e75 100644 (file)
@@ -285,6 +285,7 @@ eng_window_new(Display *disp,
      {
         int i, j,  num;
         GLXFBConfig *fbc;
+        int blacklist = 0;
 
         if (gw->glxwin)
           {
@@ -317,20 +318,99 @@ eng_window_new(Display *disp,
              fprintf(stderr, "renderer: %s\n", renderer);
              fprintf(stderr, "version: %s\n", version);
           }
-        if (strstr((const char*)vendor, "NVIDIA"))
-           // FIXME: also same as tegra2 - maybe check renderer too
-           // 
-           // vendor: NVIDIA Corporation
-           // renderer: NVIDIA Tegra
-           // version: OpenGL ES 2.0
-           // 
-           // vs (for example)
-           // 
-           // vendor: NVIDIA Corporation
-           // renderer: GeForce GT 220/PCI/SSE2
-           // version: 3.2.0 NVIDIA 195.36.24
+        //   examples:
+        // vendor: NVIDIA Corporation
+        // renderer: NVIDIA Tegra
+        // version: OpenGL ES 2.0
+        //   or
+        // vendor: Imagination Technologies
+        // renderer: PowerVR SGX 540
+        // version: OpenGL ES 2.0
+        //   or
+        // vendor: NVIDIA Corporation
+        // renderer: GeForce GT 330M/PCI/SSE2
+        // version: 3.3.0 NVIDIA 256.53
+        //   or
+        // vendor: NVIDIA Corporation
+        // renderer: GeForce GT 220/PCI/SSE2
+        // version: 3.2.0 NVIDIA 195.36.24
+        //   or
+        // vendor: NVIDIA Corporation
+        // renderer: GeForce 8600 GTS/PCI/SSE2
+        // version: 3.3.0 NVIDIA 260.19.36
+        //   or
+        // vendor: ATI Technologies Inc.
+        // renderer: ATI Mobility Radeon HD 4650
+        // version: 3.2.9756 Compatibility Profile Context
+        //   or
+        // vendor: Tungsten Graphics, Inc
+        // renderer: Mesa DRI Mobile Intel® GM45 Express Chipset GEM 20100330 DEVELOPMENT x86/MMX/SSE2
+        // version: 2.1 Mesa 7.9-devel
+        //   or
+        // vendor: Advanced Micro Devices, Inc.
+        // renderer: Mesa DRI R600 (RS780 9610) 20090101  TCL DRI2
+        // version: 2.1 Mesa 7.9-devel
+        //   or
+        // vendor: NVIDIA Corporation
+        // renderer: GeForce 9600 GT/PCI/SSE2
+        // version: 3.3.0 NVIDIA 260.19.29
+        //   or
+        // vendor: ATI Technologies Inc.
+        // renderer: ATI Radeon HD 4800 Series
+        // version: 3.3.10237 Compatibility Profile Context
+        //   or
+        // vendor: Advanced Micro Devices, Inc.
+        // renderer: Mesa DRI R600 (RV770 9442) 20090101  TCL DRI2
+        // version: 2.0 Mesa 7.8.2
+        //   or
+        // vendor: Tungsten Graphics, Inc
+        // renderer: Mesa DRI Mobile Intel® GM45 Express Chipset GEM 20100330 DEVELOPMENT 
+        // version: 2.1 Mesa 7.9-devel
+        //   or (bad - software renderer)
+        // vendor: Mesa Project
+        // renderer: Software Rasterizer
+        // version: 2.1 Mesa 7.9-devel
+        //   or (bad - software renderer)
+        // vendor: VMware, Inc.
+        // renderer: Gallium 0.4 on softpipe
+        // version: 2.1 Mesa 7.9-devel
+        
+        if (strstr((const char *)vendor, "Mesa Project"))
+          {
+             if (strstr((const char *)renderer, "Software Rasterizer"))
+                blacklist = 1;
+          }
+        if (strstr((const char *)renderer, "softpipe"))
+           blacklist = 1;
+        if (blacklist)
+          {
+             ERR("OpenGL Driver blacklisted:");
+             ERR("Vendor: %s", (const char *)vendor);
+             ERR("Renderer: %s", (const char *)renderer);
+             ERR("Version: %s", (const char *)version);
+             eng_window_free(gw);
+             return NULL;
+          }
+        if (strstr((const char *)vendor, "NVIDIA"))
           {
-             gw->detected.loose_binding = 1;
+             if (!strstr((const char *)renderer, "NVIDIA Tegra"))
+               {
+                  int v1 = 0, v2 = 0, v3 = 0;
+
+                  if (sscanf((const char *)version, 
+                             "%*s %*s %i.%i.%i",
+                             &v1, &v2, &v3) != 3)
+                    {
+                       v1 = v2 = v3 = 0;
+                       if (sscanf((const char *)version, 
+                                  "%*s %*s %i.%i",
+                                  &v1, &v2) != 2)
+                          v1 = 0;
+                    }
+                  // ALSO as of some nvidia driver version loose binding is
+                  // probably not needed
+                  if (v1 < 195) gw->detected.loose_binding = 1;
+               }
           }
         else
           {
index df92e17..17be2de 100644 (file)
@@ -14,13 +14,13 @@ if BUILD_ENGINE_QUARTZ
 QUARTZ_SOURCES = evas_engine.c
 QUARTZ_LIBADD = @evas_engine_quartz_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/quartz/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_Quartz.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_QUARTZ
 
+pkgdir = $(libdir)/evas/modules/engines/quartz/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 
 module_la_SOURCES = $(QUARTZ_SOURCES)
index 47eaf10..1735d7b 100644 (file)
@@ -15,10 +15,10 @@ if BUILD_ENGINE_SOFTWARE_16
 
 SOFTWARE_16_SOURCES = evas_engine.c
 
-pkgdir = $(libdir)/evas/modules/engines/software_16/$(MODULE_ARCH)
 
 if !EVAS_STATIC_BUILD_SOFTWARE_16
 
+pkgdir = $(libdir)/evas/modules/engines/software_16/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 module_la_SOURCES = $(SOFTWARE_16_SOURCES)
 module_la_LIBADD = @EINA_LIBS@ $(top_builddir)/src/lib/libevas.la
index c075691..d32019e 100644 (file)
@@ -20,13 +20,13 @@ evas_ddraw_main.cpp
 
 SOFTWARE_16_DDRAW_LIBADD = @evas_engine_software_16_ddraw_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/software_16_ddraw/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_Software_16_DDraw.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_SOFTWARE_16_DDRAW
 
+pkgdir = $(libdir)/evas/modules/engines/software_16_ddraw/$(MODULE_ARCH)
 pkg_LTLIBRARIES        = module.la
 
 module_la_SOURCES = $(SOFTWARE_16_DDRAW_SOURCES)
index bcaa15b..5a8dc2f 100644 (file)
@@ -10,13 +10,13 @@ SOFTWARE_SDL_SOURCES = \
 evas_engine.c \
 evas_engine.h
 
-pkgdir = $(libdir)/evas/modules/engines/software_16_sdl/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_SDL_16.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_SOFTWARE_SDL
 
+pkgdir = $(libdir)/evas/modules/engines/software_16_sdl/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 
 module_la_SOURCES = $(SOFTWARE_SDL_SOURCES)
index 984b418..d7e39b4 100644 (file)
@@ -22,13 +22,13 @@ evas_wince_gdi_buffer.c
 
 SOFTWARE_16_WINCE_LIBADD = @evas_engine_software_16_wince_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/software_16_wince/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_Software_16_WinCE.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_SOFTWARE_16_WINCE
 
+pkgdir = $(libdir)/evas/modules/engines/software_16_wince/$(MODULE_ARCH)
 pkg_LTLIBRARIES        = module.la
 
 module_la_SOURCES = $(SOFTWARE_16_WINCE_SOURCE)
index 979f315..dc24584 100644 (file)
@@ -19,13 +19,13 @@ evas_x_buffer.c
 
 SOFTWARE_16_X11_LIBADD = @evas_engine_software_16_x11_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/software_16_x11/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_Software_16_X11.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_SOFTWARE_16_X11
 
+pkgdir = $(libdir)/evas/modules/engines/software_16_x11/$(MODULE_ARCH)
 pkg_LTLIBRARIES        = module.la
 
 module_la_SOURCES = $(SOFTWARE_16_X11_SOURCES)
index 9f100f6..4c48018 100644 (file)
@@ -15,10 +15,10 @@ if BUILD_ENGINE_SOFTWARE_8
 
 SOFTWARE_8_SOURCES = evas_engine.c
 
-pkgdir = $(libdir)/evas/modules/engines/software_8/$(MODULE_ARCH)
 
 if !EVAS_STATIC_BUILD_SOFTWARE_8_X11
 
+pkgdir = $(libdir)/evas/modules/engines/software_8/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 module_la_SOURCES = $(SOFTWARE_8_SOURCES)
 module_la_LIBADD = @EINA_LIBS@ $(top_builddir)/src/lib/libevas.la
index 497fe84..bfb2b9b 100644 (file)
@@ -20,13 +20,13 @@ evas_x_buffer.c
 
 SOFTWARE_8_X11_LIBADD = @evas_engine_software_8_x11_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/software_8_x11/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_Software_8_X11.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_SOFTWARE_8_X11
 
+pkgdir = $(libdir)/evas/modules/engines/software_8_x11/$(MODULE_ARCH)
 pkg_LTLIBRARIES        = module.la
 
 module_la_SOURCES = $(SOFTWARE_8_X11_SOURCES)
index 440e291..7a5856e 100644 (file)
@@ -20,13 +20,13 @@ evas_ddraw_main.cpp
 
 SOFTWARE_DDRAW_LIBADD = @evas_engine_software_ddraw_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/software_ddraw/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_Software_DDraw.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_SOFTWARE_DDRAW
 
+pkgdir = $(libdir)/evas/modules/engines/software_ddraw/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 module_la_SOURCES = $(SOFTWARE_DDRAW_SOURCES)
 module_la_CXXFLAGS = -fno-rtti -fno-exceptions
index dfebabe..02a60c0 100644 (file)
@@ -20,13 +20,13 @@ evas_gdi_main.c
 
 SOFTWARE_GDI_LIBADD = @evas_engine_software_gdi_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/software_gdi/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_Software_Gdi.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_SOFTWARE_GDI
 
+pkgdir = $(libdir)/evas/modules/engines/software_gdi/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 module_la_SOURCES = $(SOFTWARE_GDI_SOURCES)
 module_la_LIBADD = $(top_builddir)/src/lib/libevas.la @EINA_LIBS@ $(SOFTWARE_GDI_LIBADD)
index de7f982..8278969 100644 (file)
@@ -13,10 +13,10 @@ AM_CFLAGS = @WIN32_CFLAGS@
 
 SOFTWARE_GENERIC_SOURCES = evas_engine.c
 
-pkgdir = $(libdir)/evas/modules/engines/software_generic/$(MODULE_ARCH)
 
 if !EVAS_STATIC_BUILD_SOFTWARE_GENERIC
 
+pkgdir = $(libdir)/evas/modules/engines/software_generic/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 
 module_la_SOURCES  = $(SOFTWARE_GENERIC_SOURCES)
index a4202a9..fdbd47c 100644 (file)
@@ -21,13 +21,13 @@ evas_qt_main.cpp
 
 SOFTWARE_QTOPIA_LIBADD = @evas_engine_software_qtopia_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/software_qtopia/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_Software_Qtopia.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_SOFTWARE_QTOPIA
 
+pkgdir = $(libdir)/evas/modules/engines/software_qtopia/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 module_la_SOURCES = $(SOFTWARE_QTOPIA_SOURCES)
 module_la_LIBADD = @EINA_LIBS@ $(SOFTWARE_QTOPIA_LIBADD) $(top_builddir)/src/lib/libevas.la
index 4e3e386..57892f6 100644 (file)
@@ -17,13 +17,13 @@ if BUILD_ENGINE_SOFTWARE_SDL
 SOFTWARE_SDL_SOURCES = evas_engine.c
 SOFTWARE_SDL_LIBADD = @evas_engine_software_sdl_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/software_sdl/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_SDL.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_SOFTWARE_SDL
 
+pkgdir = $(libdir)/evas/modules/engines/software_sdl/$(MODULE_ARCH)
 pkg_LTLIBRARIES = module.la
 
 module_la_SOURCES  = $(SOFTWARE_SDL_SOURCES)
index 7e20f2d..86960b7 100644 (file)
@@ -37,13 +37,12 @@ evas_xcb_main.c
 
 endif
 
-pkgdir = $(libdir)/evas/modules/engines/software_x11/$(MODULE_ARCH)
-
 includes_HEADERS = Evas_Engine_Software_X11.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_SOFTWARE_X11
 
+pkgdir = $(libdir)/evas/modules/engines/software_x11/$(MODULE_ARCH)
 pkg_LTLIBRARIES        = module.la
 
 module_la_SOURCES = $(SOFTWARE_X11_SOURCES)
index 74df4bd..4ad72a7 100644 (file)
@@ -32,13 +32,13 @@ endif
 
 XRENDER_X11_LIBADD = @evas_engine_xrender_xcb_libs@ @evas_engine_xrender_x11_libs@
 
-pkgdir = $(libdir)/evas/modules/engines/xrender_x11/$(MODULE_ARCH)
 
 includes_HEADERS = Evas_Engine_XRender_X11.h
 includesdir = $(includedir)/evas-@VMAJ@
 
 if !EVAS_STATIC_BUILD_XRENDER_X11
 
+pkgdir = $(libdir)/evas/modules/engines/xrender_x11/$(MODULE_ARCH)
 pkg_LTLIBRARIES        = module.la
 
 module_la_SOURCES = $(XRENDER_X11_SOURCES)
index e1ed01d..222bef1 100644 (file)
@@ -2,6 +2,12 @@ MAINTAINERCLEANFILES = Makefile.in
 
 SUBDIRS =
 
+if BUILD_LOADER_BMP
+if !EVAS_STATIC_BUILD_BMP
+SUBDIRS += bmp
+endif
+endif
+
 if BUILD_LOADER_EDB
 if !EVAS_STATIC_BUILD_EDB
 SUBDIRS += edb
@@ -20,6 +26,12 @@ SUBDIRS += gif
 endif
 endif
 
+if BUILD_LOADER_ICO
+if !EVAS_STATIC_BUILD_ICO
+SUBDIRS += ico
+endif
+endif
+
 if BUILD_LOADER_JPEG
 if !EVAS_STATIC_BUILD_JPEG
 SUBDIRS += jpeg
@@ -44,33 +56,27 @@ SUBDIRS += svg
 endif
 endif
 
-if BUILD_LOADER_TIFF
-if !EVAS_STATIC_BUILD_TIFF
-SUBDIRS += tiff
-endif
-endif
-
-if BUILD_LOADER_XPM
-if !EVAS_STATIC_BUILD_XPM
-SUBDIRS += xpm
-endif
-endif
-
-if BUILD_LOADER_BMP
-if !EVAS_STATIC_BUILD_BMP
-SUBDIRS += bmp
-endif
-endif
-
 if BUILD_LOADER_TGA
 if !EVAS_STATIC_BUILD_TGA
 SUBDIRS += tga
 endif
 endif
 
+if BUILD_LOADER_TIFF
+if !EVAS_STATIC_BUILD_TIFF
+SUBDIRS += tiff
+endif
+endif
+
 if BUILD_LOADER_WBMP
 if !EVAS_STATIC_BUILD_WBMP
 SUBDIRS += wbmp
 endif
 endif
 
+if BUILD_LOADER_XPM
+if !EVAS_STATIC_BUILD_XPM
+SUBDIRS += xpm
+endif
+endif
+
index a06d807..465df6f 100644 (file)
@@ -161,6 +161,7 @@ evas_image_load_file_head_bmp(Image_Entry *ie, const char *file, const char *key
         if (!read_int(f, &tmp2)) goto close_file;
         important_colors = tmp2; // number of important colors - 0 if all
         if (image_size == 0) image_size = fsize - offset;
+        if ((comp == 0) && (bit_count == 32)) hasa = 1; // GIMP seems to store it this way
      }
    else if (head_size == 108) // Windows 95/NT4 + (v4)
      {
@@ -435,6 +436,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
         if (!read_int(f, &tmp2)) goto close_file;
         important_colors = tmp2; // number of important colors - 0 if all
         if (image_size == 0) image_size = fsize - offset;
+        if ((comp == 0) && (bit_count == 32)) hasa = 1; // GIMP seems to store it this way
      }
    else if (head_size == 108) // Windows 95/NT4 + (v4)
      {
@@ -949,6 +951,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
                }
              else if (bit_count == 32)
                {
+                  int none_zero_alpha = 0;
                   pix = surface;
                   for (y = 0; y < h; y++)
                     {
@@ -959,6 +962,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
                             g = p[1];
                             r = p[2];
                             a = p[3];
+                            if (a) none_zero_alpha = 1;
                             if (!hasa) a = 0xff;
                             *pix = ARGB_JOIN(a, r, g, b);
                             p += 4;
@@ -969,6 +973,17 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
                        if (fix > 0) p += 4 - fix; // align row read
                        if (p >= buffer_end) break;
                     }
+                  if (!none_zero_alpha)
+                    {
+                       ie->flags.alpha = 0;
+                       if (hasa)
+                         {
+                            unsigned int *pixend = pix + (w * h);
+                            
+                            for (pix = surface; pix < pixend; pix++)
+                               A_VAL(pix) = 0xff;
+                         }
+                    }
                }
              else
                goto close_file;
diff --git a/src/modules/loaders/ico/Makefile.am b/src/modules/loaders/ico/Makefile.am
new file mode 100644 (file)
index 0000000..c06866d
--- /dev/null
@@ -0,0 +1,32 @@
+
+MAINTAINERCLEANFILES = Makefile.in
+
+AM_CPPFLAGS = \
+-I. \
+-I$(top_srcdir)/src/lib \
+-I$(top_srcdir)/src/lib/include \
+@FREETYPE_CFLAGS@ \
+@EINA_CFLAGS@ \
+@EVIL_CFLAGS@ \
+@WIN32_CPPFLAGS@
+
+if BUILD_LOADER_ICO
+if !EVAS_STATIC_BUILD_ICO
+
+pkgdir = $(libdir)/evas/modules/loaders/ico/$(MODULE_ARCH)
+pkg_LTLIBRARIES = module.la
+
+module_la_SOURCES = evas_image_load_ico.c
+
+module_la_LIBADD = @EINA_LIBS@ @EVIL_LIBS@ $(top_builddir)/src/lib/libevas.la
+module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version
+module_la_LIBTOOLFLAGS = --tag=disable-static
+
+else
+
+noinst_LTLIBRARIES = libevas_loader_ico.la
+libevas_loader_ico_la_SOURCES = evas_image_load_ico.c
+libevas_loader_ico_la_LIBADD = 
+
+endif
+endif
diff --git a/src/modules/loaders/ico/evas_image_load_ico.c b/src/modules/loaders/ico/evas_image_load_ico.c
new file mode 100644 (file)
index 0000000..1885c15
--- /dev/null
@@ -0,0 +1,769 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef HAVE_EVIL
+# include <Evil.h>
+#endif
+
+#include "evas_common.h"
+#include "evas_private.h"
+
+static Eina_Bool evas_image_load_file_head_ico(Image_Entry *ie, const char *file, const char *key, int *error) EINA_ARG_NONNULL(1, 2, 4);
+static Eina_Bool evas_image_load_file_data_ico(Image_Entry *ie, const char *file, const char *key, int *error) EINA_ARG_NONNULL(1, 2, 4);
+
+static Evas_Image_Load_Func evas_image_load_ico_func =
+{
+  EINA_TRUE,
+  evas_image_load_file_head_ico,
+  evas_image_load_file_data_ico
+};
+
+static int
+read_ushort(FILE *file, unsigned short *ret)
+{
+   unsigned char b[2];
+   if (fread(b, sizeof(unsigned char), 2, file) != 2) return 0;
+   *ret = (b[1] << 8) | b[0];
+   return 1;
+}
+
+static int
+read_uint(FILE *file, unsigned int *ret)
+{
+   unsigned char       b[4];
+   if (fread(b, sizeof(unsigned char), 4, file) != 4) return 0;
+   *ret = ARGB_JOIN(b[3], b[2], b[1], b[0]);
+   return 1;
+}
+
+enum
+{
+   SMALLEST, 
+   BIGGEST, 
+   SMALLER, 
+   BIGGER
+};
+
+enum
+{
+   ICON = 1,
+   CURSOR = 2
+};
+
+static Eina_Bool
+evas_image_load_file_head_ico(Image_Entry *ie, const char *file, const char *key, int *error)
+{
+   unsigned short word;
+   unsigned char byte;
+   FILE *f;
+   int wanted_w = 0, wanted_h = 0, w, h, cols, i, planes = 0,
+      hot_x = 0, hot_y = 0, bpp = 0, pdelta, search = -1, have_choice = 0,
+      hasa = 1;
+   unsigned int bmoffset, bmsize, fsize;
+   unsigned short reserved, type, count;
+   struct {
+      int pdelta;
+      int w, h;
+      int cols;
+      int bpp, planes;
+      int hot_x, hot_y;
+      unsigned int bmoffset, bmsize;
+   } chosen = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+   f = fopen(file, "rb");
+   if (!f)
+     {
+       *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
+       return EINA_FALSE;
+     }
+
+   *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
+   fseek(f, 0, SEEK_END);
+   fsize = ftell(f);
+   fseek(f, 0, SEEK_SET);
+   if (fsize < (6 + 16 + 40)) goto close_file;
+
+   // key:
+   //   NULL == highest res
+   //   biggest == highest res
+   //   smallest == lowest res
+   //   
+   //   smaller == next size SMALLER than load opts WxH (if possible)
+   //   bigger == next size BIGGER than load opts WxH (if possible)
+   //   more ?
+
+   search = BIGGEST;
+   if ((ie->load_opts.w > 0) && (ie->load_opts.h > 0))
+     {
+        wanted_w = ie->load_opts.w;
+        wanted_h = ie->load_opts.h;
+        search = SMALLER;
+     }
+   
+   if (!read_ushort(f, &reserved)) goto close_file;
+   if (!read_ushort(f, &type)) goto close_file;
+   if (!read_ushort(f, &count)) goto close_file;
+   if (!((reserved == 0) && 
+         ((type == ICON) || (type == CURSOR)) && (count > 0)))
+      goto close_file;
+   *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
+
+   if (key)
+     {
+        if (!strcmp(key, "biggest"))
+          {
+             wanted_w = 0;
+             wanted_h = 0;
+             search = BIGGEST;
+             chosen.pdelta = 0;
+          }
+        else if (!strcmp(key, "smallest"))
+          {
+             wanted_w = 1;
+             wanted_h = 1;
+             search = SMALLEST;
+             chosen.pdelta = 0x7fffffff;
+          }
+        else if (!strcmp(key, "smaller"))
+          {
+             chosen.pdelta = 0x7fffffff;
+             search = SMALLER;
+          }
+        else if (!strcmp(key, "bigger"))
+          {
+             chosen.pdelta = 0x7fffffff;
+             search = BIGGER;
+          }
+     }
+   for (i = 0; i < count; i++)
+     {
+        if (fread(&byte, 1, 1, f) != 1) goto close_file;
+        w = byte;
+        if (w <= 0) w = 256;
+        if (fread(&byte, 1, 1, f) != 1) goto close_file;
+        h = byte;
+        if (h <= 0) h = 256;
+        if (fread(&byte, 1, 1, f) != 1) goto close_file;
+        cols = byte;
+        if (cols <= 0) cols = 256;
+        if (fread(&byte, 1, 1, f) != 1) goto close_file;
+        if (!read_ushort(f, &word)) goto close_file;
+        if (type == CURSOR) planes = word;
+        else hot_x = word;
+        if (!read_ushort(f, &word)) goto close_file;
+        if (type == CURSOR) bpp = word;
+        else hot_y = word;
+        if (!read_uint(f, &bmsize)) goto close_file;
+        if (!read_uint(f, &bmoffset)) goto close_file;
+        if ((bmsize <= 0) || (bmoffset <= 0) || (bmoffset >= fsize)) goto close_file;
+        if (search == BIGGEST)
+          {
+             pdelta = w * h;
+             if ((!have_choice) ||
+                 ((pdelta >= chosen.pdelta) &&
+                     (((bpp >= 3) && (bpp >= chosen.bpp)) ||
+                         ((bpp < 3) && (cols >= chosen.cols)))))
+               {
+                  have_choice = 1;
+                  chosen.pdelta = pdelta;
+                  chosen.w = w;
+                  chosen.h = h;
+                  chosen.cols = cols;
+                  chosen.bpp = bpp;
+                  chosen.planes = planes;
+                  chosen.bmsize = bmsize;
+                  chosen.bmoffset = bmoffset;
+               }
+          }
+        else
+          {
+             if (search == SMALLEST)
+               {
+                  pdelta = w * h;
+                  if ((!have_choice) ||
+                       ((pdelta <= chosen.pdelta) &&
+                           (((bpp >= 3) && (bpp >= chosen.bpp)) ||
+                               ((bpp < 3) && (cols >= chosen.cols)))))
+                    {
+                       have_choice = 1;
+                       chosen.pdelta = pdelta;
+                       chosen.w = w;
+                       chosen.h = h;
+                       chosen.cols = cols;
+                       chosen.bpp = bpp;
+                       chosen.planes = planes;
+                       chosen.bmsize = bmsize;
+                       chosen.bmoffset = bmoffset;
+                    }
+               }
+             else if (search == SMALLER)
+               {
+                  pdelta = (wanted_w * wanted_h) - (w * h);
+                  if ((!have_choice) ||
+                      ((w <= wanted_w) && (h <= wanted_h) &&
+                          (pdelta <= chosen.pdelta) &&
+                          (((bpp >= 3) && (bpp >= chosen.bpp)) ||
+                              ((bpp < 3) && (cols >= chosen.cols)))))
+                     {
+                        have_choice = 1;
+                        if (pdelta < 0) pdelta = 0x7fffffff;
+                        chosen.pdelta = pdelta;
+                        chosen.w = w;
+                        chosen.h = h;
+                        chosen.cols = cols;
+                        chosen.bpp = bpp;
+                        chosen.planes = planes;
+                        chosen.bmsize = bmsize;
+                        chosen.bmoffset = bmoffset;
+                    }
+               }
+             else if (search == BIGGER)
+               {
+                  pdelta = (w * h) - (wanted_w * wanted_h);
+                  if ((!have_choice) ||
+                      ((w >= wanted_w) && (h >= wanted_h) &&
+                          (pdelta <= chosen.pdelta) &&
+                          (((bpp >= 3) && (bpp >= chosen.bpp)) ||
+                              ((bpp < 3) && (cols >= chosen.cols)))))
+                     {
+                        have_choice = 1;
+                        if (pdelta < 0) pdelta = 0x7fffffff;
+                        chosen.pdelta = pdelta;
+                        chosen.w = w;
+                        chosen.h = h;
+                        chosen.cols = cols;
+                        chosen.bpp = bpp;
+                        chosen.planes = planes;
+                        chosen.bmsize = bmsize;
+                        chosen.bmoffset = bmoffset;
+                    }
+               }
+          }
+     }
+   if (chosen.bmoffset == 0) goto close_file;
+   if (fseek(f, chosen.bmoffset, SEEK_SET) != 0) goto close_file;
+
+   w = chosen.w;
+   h = chosen.h;
+   if ((w > 256) || (h > 256)) goto close_file;
+   if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) ||
+       IMG_TOO_BIG(w, h))
+     {
+        if (IMG_TOO_BIG(w, h))
+           *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
+        else
+           *error = EVAS_LOAD_ERROR_GENERIC;
+        goto close_file;
+     }
+
+   ie->w = w;
+   ie->h = h;
+   if (hasa) ie->flags.alpha = 1;
+   
+   fclose(f);
+   *error = EVAS_LOAD_ERROR_NONE;
+   return EINA_TRUE;
+
+ close_file:
+   fclose(f);
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+evas_image_load_file_data_ico(Image_Entry *ie, const char *file, const char *key, int *error)
+{
+   unsigned short word;
+   unsigned char byte;
+   unsigned int dword;
+   FILE *f;
+   int wanted_w = 0, wanted_h = 0, w, h, cols, i, planes = 0,
+      hot_x = 0, hot_y = 0, bpp = 0, pdelta, search = -1, have_choice = 0,
+      stride, pstride, j, right_way_up = 0, diff_size = 0, cols2;
+   unsigned int bmoffset, bmsize, bitcount, compression, imagesize, fsize, 
+      colorsused, colorsimportant, *pal, *surface, *pix, none_zero_alpha = 0;
+   unsigned short reserved, type, count, planes2;
+   unsigned char *maskbuf, *pixbuf, *p;
+   struct {
+      int pdelta;
+      int w, h;
+      int cols;
+      int bpp, planes;
+      int hot_x, hot_y;
+      unsigned int bmoffset, bmsize;
+   } chosen = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+   f = fopen(file, "rb");
+   if (!f)
+     {
+       *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
+       return EINA_FALSE;
+     }
+
+   *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
+   fseek(f, 0, SEEK_END);
+   fsize = ftell(f);
+   fseek(f, 0, SEEK_SET);
+   if (fsize < (6 + 16 + 40)) goto close_file;
+
+   // key:
+   //   NULL == highest res
+   //   biggest == highest res
+   //   smallest == lowest res
+   //   
+   //   smaller == next size SMALLER than load opts WxH (if possible)
+   //   bigger == next size BIGGER than load opts WxH (if possible)
+   //   more ?
+
+   search = BIGGEST;
+   if ((ie->load_opts.w > 0) && (ie->load_opts.h > 0))
+     {
+        wanted_w = ie->load_opts.w;
+        wanted_h = ie->load_opts.h;
+        search = SMALLER;
+     }
+   
+   if (!read_ushort(f, &reserved)) goto close_file;
+   if (!read_ushort(f, &type)) goto close_file;
+   if (!read_ushort(f, &count)) goto close_file;
+   if (!((reserved == 0) && 
+         ((type == ICON) || (type == CURSOR)) && (count > 0)))
+      goto close_file;
+   *error = EVAS_LOAD_ERROR_CORRUPT_FILE;
+
+   if (key)
+     {
+        if (!strcmp(key, "biggest"))
+          {
+             wanted_w = 0;
+             wanted_h = 0;
+             search = BIGGEST;
+             chosen.pdelta = 0;
+          }
+        else if (!strcmp(key, "smallest"))
+          {
+             wanted_w = 1;
+             wanted_h = 1;
+             search = SMALLEST;
+             chosen.pdelta = 0x7fffffff;
+          }
+        else if (!strcmp(key, "smaller"))
+          {
+             chosen.pdelta = 0x7fffffff;
+             search = SMALLER;
+          }
+        else if (!strcmp(key, "bigger"))
+          {
+             chosen.pdelta = 0x7fffffff;
+             search = BIGGER;
+          }
+     }
+   for (i = 0; i < count; i++)
+     {
+        if (fread(&byte, 1, 1, f) != 1) goto close_file;
+        w = byte;
+        if (w <= 0) w = 256;
+        if (fread(&byte, 1, 1, f) != 1) goto close_file;
+        h = byte;
+        if (h <= 0) h = 256;
+        if (fread(&byte, 1, 1, f) != 1) goto close_file;
+        cols = byte;
+        if (cols <= 0) cols = 256;
+        if (fread(&byte, 1, 1, f) != 1) goto close_file;
+        if (!read_ushort(f, &word)) goto close_file;
+        if (type == 1) planes = word;
+        else hot_x = word;
+        if (!read_ushort(f, &word)) goto close_file;
+        if (type == 1) bpp = word;
+        else hot_y = word;
+        if (!read_uint(f, &bmsize)) goto close_file;
+        if (!read_uint(f, &bmoffset)) goto close_file;
+        if ((bmsize <= 0) || (bmoffset <= 0) || (bmoffset >= fsize)) goto close_file;
+        if (search == BIGGEST)
+          {
+             pdelta = w * h;
+             if ((!have_choice) ||
+                 ((pdelta >= chosen.pdelta) &&
+                     (((bpp >= 3) && (bpp >= chosen.bpp)) ||
+                         ((bpp < 3) && (cols >= chosen.cols)))))
+               {
+                  have_choice = 1;
+                  chosen.pdelta = pdelta;
+                  chosen.w = w;
+                  chosen.h = h;
+                  chosen.cols = cols;
+                  chosen.bpp = bpp;
+                  chosen.planes = planes;
+                  chosen.bmsize = bmsize;
+                  chosen.bmoffset = bmoffset;
+               }
+          }
+        else
+          {
+             if (search == SMALLEST)
+               {
+                  pdelta = w * h;
+                  if ((!have_choice) ||
+                       ((pdelta <= chosen.pdelta) &&
+                           (((bpp >= 3) && (bpp >= chosen.bpp)) ||
+                               ((bpp < 3) && (cols >= chosen.cols)))))
+                    {
+                       have_choice = 1;
+                       chosen.pdelta = pdelta;
+                       chosen.w = w;
+                       chosen.h = h;
+                       chosen.cols = cols;
+                       chosen.bpp = bpp;
+                       chosen.planes = planes;
+                       chosen.bmsize = bmsize;
+                       chosen.bmoffset = bmoffset;
+                    }
+               }
+             else if (search == SMALLER)
+               {
+                  pdelta = (wanted_w * wanted_h) - (w * h);
+                  if ((!have_choice) ||
+                      ((w <= wanted_w) && (h <= wanted_h) &&
+                          (pdelta <= chosen.pdelta) &&
+                          (((bpp >= 3) && (bpp >= chosen.bpp)) ||
+                              ((bpp < 3) && (cols >= chosen.cols)))))
+                     {
+                        have_choice = 1;
+                        if (pdelta < 0) pdelta = 0x7fffffff;
+                        chosen.pdelta = pdelta;
+                        chosen.w = w;
+                        chosen.h = h;
+                        chosen.cols = cols;
+                        chosen.bpp = bpp;
+                        chosen.planes = planes;
+                        chosen.bmsize = bmsize;
+                        chosen.bmoffset = bmoffset;
+                    }
+               }
+             else if (search == BIGGER)
+               {
+                  pdelta = (w * h) - (wanted_w * wanted_h);
+                  if ((!have_choice) ||
+                      ((w >= wanted_w) && (h >= wanted_h) &&
+                          (pdelta <= chosen.pdelta) &&
+                          (((bpp >= 3) && (bpp >= chosen.bpp)) ||
+                              ((bpp < 3) && (cols >= chosen.cols)))))
+                     {
+                        have_choice = 1;
+                        if (pdelta < 0) pdelta = 0x7fffffff;
+                        chosen.pdelta = pdelta;
+                        chosen.w = w;
+                        chosen.h = h;
+                        chosen.cols = cols;
+                        chosen.bpp = bpp;
+                        chosen.planes = planes;
+                        chosen.bmsize = bmsize;
+                        chosen.bmoffset = bmoffset;
+                    }
+               }
+          }
+     }
+   if (chosen.bmoffset == 0) goto close_file;
+   if (fseek(f, chosen.bmoffset, SEEK_SET) != 0) goto close_file;
+
+   w = chosen.w;
+   h = chosen.h;
+   cols = chosen.cols;
+   bpp = chosen.bpp;
+   // changed since we loaded header?
+   if (((int)ie->w != w) || ((int)ie->h != h)) goto close_file;
+   
+   // read bmp header time... let's do some checking
+   if (!read_uint(f, &dword)) goto close_file; // headersize - dont care
+   if (!read_uint(f, &dword)) goto close_file; // width
+   if (dword > 0)
+     {
+        if ((int)dword != w)
+          {
+             w = dword;
+             diff_size = 1;
+          }
+     }
+   if (!read_uint(f, &dword)) goto close_file; // height
+   if (dword > 0)
+     {
+        if ((int)dword != (h * 2))
+          {
+             h = dword / 2;
+             diff_size = 1;
+          }
+     }
+   if (diff_size)
+     {
+        ERR("Broken ICO file: %s - "
+            "  Reporting size of %ix%i in index, but bitmap is %ix%i. "
+            "  May be expanded or cropped.",
+            file, ie->w, ie->h, w, h);
+     }
+   if (!read_ushort(f, &word)) goto close_file; // planes
+   planes2 = word;
+   if (!read_ushort(f, &word)) goto close_file; // bitcount
+   bitcount = word;
+   if (!read_uint(f, &dword)) goto close_file; // compression
+   compression = dword;
+   if (!read_uint(f, &dword)) goto close_file; // imagesize
+   imagesize = dword;
+   if (!read_uint(f, &dword)) goto close_file; // z pixels per m
+   if (!read_uint(f, &dword)) goto close_file; // y pizels per m
+   if (!read_uint(f, &dword)) goto close_file; // colors used
+   colorsused = dword;
+   if (!read_uint(f, &dword)) goto close_file; // colors important
+   colorsimportant = dword;
+
+   evas_cache_image_surface_alloc(ie, ie->w, ie->h);
+   surface = evas_cache_image_pixels(ie);
+   if (!surface)
+     {
+        *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
+        goto close_file;
+     }
+   memset(surface, 0, ie->w * ie->h * 4);
+
+   if (!((bitcount == 1) || (bitcount == 4) || (bitcount == 8) ||
+         (bitcount == 24) || (bitcount == 32)))
+      goto close_file;
+   if (bitcount <= 8)
+     {
+        cols2 = 1 << bitcount;
+        if (cols == 0) cols = cols2;
+        if (cols > cols2) cols = cols2;
+        if (cols > 256) cols = 256;
+     }
+   else
+      cols = 0;
+   if (bitcount > 8) cols = 0;
+
+   pal = alloca(256 * 4);
+   for (i = 0; i < cols; i++)
+     {
+        unsigned char a, r, g, b;
+        
+        if (fread(&b, 1, 1, f) != 1) goto close_file;
+        if (fread(&g, 1, 1, f) != 1) goto close_file;
+        if (fread(&r, 1, 1, f) != 1) goto close_file;
+        if (fread(&a, 1, 1, f) != 1) goto close_file;
+        a = 0xff;
+        pal[i] = ARGB_JOIN(a, r, g, b);
+     }
+   stride = ((w + 31) / 32);
+   maskbuf = alloca(stride * h);
+   pixbuf = alloca(stride * 32 * 4); // more than enough
+   if (bitcount == 1)
+     {
+        pstride = stride * 4;
+        for (i = 0; i < h; i++)
+          {
+             pix = surface + (i * ie->w);
+             if (!right_way_up) pix = surface + ((ie->h - 1 - i) * ie->w);
+             if (fread(pixbuf, pstride, 1, f) != 1) goto close_file;
+             p = pixbuf;
+             if (i >= (int)ie->h) continue;
+             for (j = 0; j < w; j++)
+               {
+                  if (j >= (int)ie->w) break;
+                  if ((j & 0x7) == 0x0)
+                    {
+                       *pix = pal[*p >> 7];
+                    }
+                  else if ((j & 0x7) == 0x1)
+                    {
+                       *pix = pal[(*p >> 6) & 0x1];
+                    }
+                  else if ((j & 0x7) == 0x2)
+                    {
+                       *pix = pal[(*p >> 5) & 0x1];
+                    }
+                  else if ((j & 0x7) == 0x3)
+                    {
+                       *pix = pal[(*p >> 4) & 0x1];
+                    }
+                  else if ((j & 0x7) == 0x4)
+                    {
+                       *pix = pal[(*p >> 3) & 0x1];
+                    }
+                  else if ((j & 0x7) == 0x5)
+                    {
+                       *pix = pal[(*p >> 2) & 0x1];
+                    }
+                  else if ((j & 0x7) == 0x6)
+                    {
+                       *pix = pal[(*p >> 1) & 0x1];
+                    }
+                  else
+                    {
+                       *pix = pal[*p & 0x1];
+                       p++;
+                    }
+                  pix++;
+               }
+          }
+     }
+   else if (bitcount == 4)
+     {
+        pstride = ((w + 7) / 8) * 4;
+        for (i = 0; i < h; i++)
+          {
+             pix = surface + (i * ie->w);
+             if (!right_way_up) pix = surface + ((ie->h - 1 - i) * ie->w);
+             if (fread(pixbuf, pstride, 1, f) != 1) goto close_file;
+             p = pixbuf;
+             if (i >= (int)ie->h) continue;
+             for (j = 0; j < w; j++)
+               {
+                  if (j >= (int)ie->w) break;
+                  if ((j & 0x1) == 0x1)
+                    {
+                       *pix = pal[*p & 0x0f];
+                       p++;
+                    }
+                  else
+                    {
+                       *pix = pal[*p >> 4];
+                    }
+                  pix++;
+               }
+          }
+     }
+   else if (bitcount == 8)
+     {
+        pstride = ((w + 3) / 4) * 4;
+        for (i = 0; i < h; i++)
+          {
+             pix = surface + (i * ie->w);
+             if (!right_way_up) pix = surface + ((ie->h - 1 - i) * ie->w);
+             if (fread(pixbuf, pstride, 1, f) != 1) goto close_file;
+             p = pixbuf;
+             if (i >= (int)ie->h) continue;
+             for (j = 0; j < w; j++)
+               {
+                  if (j >= (int)ie->w) break;
+                  *pix = pal[*p];
+                  p++;
+                  pix++;
+               }
+          }
+     }
+   else if (bitcount == 24)
+     {
+        pstride = w * 3;
+        for (i = 0; i < h; i++)
+          {
+             pix = surface + (i * ie->w);
+             if (!right_way_up) pix = surface + ((ie->h - 1 - i) * ie->w);
+             if (fread(pixbuf, pstride, 1, f) != 1) goto close_file;
+             p = pixbuf;
+             if (i >= (int)ie->h) continue;
+             for (j = 0; j < w; j++)
+               {
+                  unsigned char a, r, g, b;
+                  
+                  if (j >= (int)ie->w) break;
+                  b = p[0];
+                  g = p[1];
+                  r = p[2];
+                  p += 3;
+                  a = 0xff;
+                  *pix = ARGB_JOIN(a, r, g, b);
+                  pix++;
+               }
+          }
+     }
+   else if (bitcount == 32)
+     {
+        pstride = w * 4;
+        for (i = 0; i < h; i++)
+          {
+             pix = surface + (i * ie->w);
+             if (!right_way_up) pix = surface + ((ie->h - 1 - i) * ie->w);
+             if (fread(pixbuf, pstride, 1, f) != 1) goto close_file;
+             p = pixbuf;
+             if (i >= (int)ie->h) continue;
+             for (j = 0; j < w; j++)
+               {
+                  unsigned char a, r, g, b;
+                  
+                  if (j >= (int)ie->w) break;
+                  b = p[0];
+                  g = p[1];
+                  r = p[2];
+                  a = p[3];
+                  p += 4;
+                  if (a) none_zero_alpha = 1;
+                  *pix = ARGB_JOIN(a, r, g, b);
+                  pix++;
+               }
+          }
+     }
+   if (!none_zero_alpha)
+     {
+        if (fread(maskbuf, stride * 4 * h, 1, f) != 1) goto close_file;
+        // apply mask
+        pix = surface;
+        for (i = 0; i < h; i++)
+          {
+             unsigned char *m;
+             
+             pix = surface + (i * ie->w);
+             if (!right_way_up) pix = surface + ((ie->h - 1 - i) * ie->w);
+             m = maskbuf + (stride * i * 4);
+             if (i >= (int)ie->h) continue;
+             for (j = 0; j < w; j++)
+               {
+                  if (j >= (int)ie->w) break;
+                  if (*m & (1 << (7 - (j & 0x7))))
+                     A_VAL(pix) = 0x00;
+                  else
+                     A_VAL(pix) = 0xff;
+                  if ((j & 0x7) == 0x7) m++;
+                  pix++;
+               }
+          }
+     }
+   
+   fclose(f);
+   
+   evas_common_image_premul(ie);
+   *error = EVAS_LOAD_ERROR_NONE;
+   return EINA_TRUE;
+
+ close_file:
+   fclose(f);
+   return EINA_FALSE;
+}
+
+static int
+module_open(Evas_Module *em)
+{
+   if (!em) return 0;
+   em->functions = (void *)(&evas_image_load_ico_func);
+   return 1;
+}
+
+static void
+module_close(Evas_Module *em __UNUSED__)
+{
+}
+
+static Evas_Module_Api evas_modapi =
+{
+   EVAS_MODULE_API_VERSION,
+   "ico",
+   "none",
+   {
+     module_open,
+     module_close
+   }
+};
+
+EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_IMAGE_LOADER, image_loader, ico);
+
+#ifndef EVAS_STATIC_BUILD_ICO
+EVAS_EINA_MODULE_DEFINE(image_loader, ico);
+#endif