#ifndef EVAS_COMMON_H
#define EVAS_COMMON_H
-#ifdef HAVE_CONFIG_H
-# include "config.h" /* so that EAPI in Evas.h is correctly defined */
+//#ifdef HAVE_CONFIG_H
+#include "config.h" /* so that EAPI in Evas.h is correctly defined */
+//#endif
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#elif !defined alloca
+# ifdef __GNUC__
+# define alloca __builtin_alloca
+# elif defined _AIX
+# define alloca __alloca
+# elif defined _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# elif !defined HAVE_ALLOCA
+# ifdef __cplusplus
+extern "C"
+# endif
+void *alloca (size_t);
+# endif
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <ctype.h>
+
+#ifndef _MSC_VER
+# include <stdint.h>
+#include <unistd.h>
#endif
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
+#ifdef HAVE_ESCAPE
+# include <Escape.h>
+#endif
+
+#ifdef HAVE_PIXMAN
+#include <pixman.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#ifdef HAVE_EXOTIC
+# include <Exotic.h>
+#endif
+
#include <Eina.h>
#include "Evas.h"
+//#include "Evas_GL.h"
+
+#ifndef HAVE_LROUND
+/* right now i dont care about rendering bugs on platforms without lround
+ (e.g. windows/vc++... yay!)
+ FIXME: http://cgit.freedesktop.org/cairo/tree/src/cairo-misc.c#n487
+*/
+#define lround(x) (((x) < 0) ? (long int)ceil((x) - 0.5) : (long int)floor((x) + 0.5))
+#endif
/* macros needed to log message through eina_log */
extern EAPI int _evas_log_dom_global;
# define BUILD_PTHREAD
#endif
-#ifdef BUILD_PTHREAD
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-# include <pthread.h>
-# include <sched.h>
-#ifdef __linux__
-# include <sys/time.h>
-# include <sys/resource.h>
-# include <errno.h>
-#endif
+#define LK(x) Eina_Lock x
+#define LKI(x) eina_lock_new(&(x))
+#define LKD(x) eina_lock_free(&(x))
+#define LKL(x) eina_lock_take(&(x))
+#define LKT(x) eina_lock_take_try(&(x))
+#define LKU(x) eina_lock_release(&(x))
+#define LKDBG(x) eina_lock_debug(&(x))
-//#define LKDEBUG 1
+/* for rwlocks */
+#define RWLK(x) Eina_RWLock x
+#define RWLKI(x) eina_rwlock_new(&(x))
+#define RWLKD(x) eina_rwlock_free(&(x))
+#define RDLKL(x) eina_rwlock_take_read(&(x))
+#define WRLKL(x) eina_rwlock_take_write(&(x))
+#define RWLKU(x) eina_rwlock_release(&(x))
-#ifdef LKDEBUG
-EAPI Eina_Bool lockdebug;
-EAPI int lockmax;
-#endif
+#ifdef BUILD_PTHREAD
-#define LK(x) pthread_mutex_t x
-#ifndef EVAS_FRAME_QUEUING
-# define LKI(x) pthread_mutex_init(&(x), NULL)
-#else
-# define LKI(x) do {pthread_mutexattr_t __attr;\
- pthread_mutexattr_init(&__attr); \
- pthread_mutexattr_settype(&__attr, PTHREAD_MUTEX_RECURSIVE); \
- pthread_mutex_init(&(x), &__attr);} while (0)
-#endif
-# define LKD(x) pthread_mutex_destroy(&(x))
-# ifdef LKDEBUG
-# define LKL(x) \
- do { \
- if (lockdebug) { \
- struct timeval t0, t1; \
- int dt; \
- gettimeofday(&t0, NULL); \
- pthread_mutex_lock(&(x)); \
- gettimeofday(&t1, NULL); \
- dt = (t1.tv_sec - t0.tv_sec) * 1000000; \
- if (t1.tv_usec > t0.tv_usec) dt += (t1.tv_usec - t0.tv_usec); \
- else dt -= t0.tv_usec - t1.tv_usec; \
- dt /= 1000; \
- if (dt > lockmax) { \
- fprintf(stderr, "HANG %ims - %s:%i - %s()\n", \
- dt, __FILE__, __LINE__, __FUNCTION__); \
- } \
- } \
- else { \
- pthread_mutex_lock(&(x)); \
- } \
- } while (0)
-# else
-# define LKL(x) pthread_mutex_lock(&(x))
-# endif
-# define LKT(x) pthread_mutex_trylock(&(x))
-# define LKU(x) pthread_mutex_unlock(&(x))
# define TH(x) pthread_t x
# define THI(x) int x
# define TH_MAX 8
-/* for rwlocks */
-#define RWLK(x) pthread_rwlock_t x
-#define RWLKI(x) pthread_rwlock_init(&(x), NULL);
-#define RWLKD(x) pthread_rwlock_destroy(&(x));
-#define RDLKL(x) pthread_rwlock_rdlock(&(x));
-#define WRLKL(x) pthread_rwlock_wrlock(&(x));
-#define RWLKU(x) pthread_rwlock_unlock(&(x));
-
-
-// even though in theory having every Nth rendered line done by a different
-// thread might even out load across threads - it actually slows things down.
-//#define EVAS_SLI 1
-
#else
-# define LK(x)
-# define LKI(x)
-# define LKD(x)
-# define LKL(x)
-# define LKT(x) 0
-# define LKU(x)
# define TH(x)
# define THI(x)
# define TH_MAX 0
-/* for rwlocks */
-#define RWLK(x)
-#define RWLKI(x)
-#define RWLKD(x)
-#define RDLKL(x)
-#define WRLKL(x)
-#define RWLKU(x)
-
-#endif
-
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#elif defined __GNUC__
-# define alloca __builtin_alloca
-#elif defined _AIX
-# define alloca __alloca
-#elif defined _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-#else
-# include <stddef.h>
-# ifdef __cplusplus
-extern "C"
-# endif
-void *alloca (size_t);
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <ctype.h>
-
-#ifndef _MSC_VER
-# include <stdint.h>
#endif
#include <ft2build.h>
#define pld(addr, off)
#endif /* __ARMEL__ */
+// these here are in config.h - just here for documentation
+//#ifdef __ARM_ARCH__
+// *IF* you enable pixman, this determines which things pixman will do
+////#define PIXMAN_FONT 1
+////#define PIXMAN_RECT 1
+////#define PIXMAN_LINE 1
+////#define PIXMAN_POLY 1
+//#define PIXMAN_IMAGE 1
+//#define PIXMAN_IMAGE_SCALE_SAMPLE 1
+//#endif
+// not related to pixman but an alternate rotate code
+//#define TILE_ROTATE 1
+
+#define TILE_CACHE_LINE_SIZE 64
+
/*****************************************************************************/
#define UNROLL2(op...) op op
typedef unsigned char DATA8;
typedef struct _Image_Entry Image_Entry;
-typedef struct _Image_Entry_Flags Image_Entry_Flags;
+typedef struct _Image_Entry_Flags Image_Entry_Flags;
+typedef struct _Image_Entry_Frame Image_Entry_Frame;
+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;
typedef void (*Gfx_Func_Convert) (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal);
#include "../cache/evas_cache.h"
+#ifdef EVAS_CSERVE2
+#include "../cache2/evas_cache2.h"
+#endif
/*****************************************************************************/
CPU_FEATURE_ALTIVEC = (1 << 3),
CPU_FEATURE_VIS = (1 << 4),
CPU_FEATURE_VIS2 = (1 << 5),
- CPU_FEATURE_NEON = (1 << 6)
+ CPU_FEATURE_NEON = (1 << 6),
+ CPU_FEATURE_SSE3 = (1 << 7)
} CPU_Features;
typedef enum _Font_Hint_Flags
FONT_BYTECODE_HINT
} Font_Hint_Flags;
+typedef enum _Font_Rend_Flags
+{
+ FONT_REND_REGULAR = 0,
+ FONT_REND_SLANT = (1 << 0),
+ FONT_REND_WEIGHT = (1 << 1),
+} Font_Rend_Flags;
+
/*****************************************************************************/
+#if 0 // filtering disabled
+typedef struct _Filtered_Image Filtered_Image;
+#endif
+
struct _RGBA_Image_Loadopts
{
int scale_down_by; // if > 1 then use this
double dpi; // if > 0.0 use this
unsigned int w, h; // if > 0 use this
+ unsigned int degree;//if>0 there is some info related with rotation
struct {
unsigned int x, y, w, h;
} region;
+
+ Eina_Bool orientation; // if EINA_TRUE => should honor orientation information provided by file (like jpeg exif info)
};
struct _Image_Entry_Flags
Eina_Bool in_progress : 1;
Eina_Bool dirty : 1;
Eina_Bool activ : 1;
+
Eina_Bool need_data : 1;
Eina_Bool lru_nodata : 1;
Eina_Bool cached : 1;
Eina_Bool alpha : 1;
+
+ Eina_Bool lru : 1;
Eina_Bool alpha_sparse : 1;
#ifdef BUILD_ASYNC_PRELOAD
Eina_Bool preload_done : 1;
Eina_Bool delete_me : 1;
Eina_Bool pending : 1;
#endif
+ Eina_Bool animated : 1;
+ Eina_Bool rotated : 1;
+};
+
+struct _Image_Entry_Frame
+{
+ int index;
+ DATA32 *data; /* frame decoding data */
+ void *info; /* special image type info */
+ Eina_Bool loaded : 1;
};
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;
Evas_Cache_Image *cache;
+#ifdef EVAS_CSERVE2
+ Evas_Cache2 *cache2;
+#endif
const char *cache_key;
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
- LK(lock_references); // needed for accessing references
-#endif
#ifdef BUILD_PIPE_RENDER
RGBA_Pipe *pipe;
-#ifdef EVAS_FRAME_QUEUING
- LK(ref_fq_add);
- LK(ref_fq_del);
- pthread_cond_t cond_fq_del;
- int ref_fq[2]; // ref_fq[0] is for addition, ref_fq[1] is for deletion
-#endif
#endif
unsigned char scale;
Image_Entry_Flags flags;
Evas_Image_Scale_Hint scale_hint;
void *data1, *data2;
+#ifdef EVAS_CSERVE2
+ unsigned int open_rid, load_rid, preload_rid;
+#endif
int server_id;
int connect_num;
int channel;
+ int load_error;
+
+ /* for animation feature */
+ int frame_count;
+ Evas_Image_Animated_Loop_Hint loop_hint;
+ int loop_count;
+ int cur_frame;
+ Eina_List *frames;
};
struct _Engine_Image_Entry
DATA32 col;
} mul;
struct {
+#ifdef HAVE_PIXMAN
+ pixman_image_t *pixman_color_image;
+#endif
DATA32 col;
} col;
struct RGBA_Draw_Context_clip {
- DATA8 *mask;
int x, y, w, h;
Eina_Bool use : 1;
} clip;
+ struct {
+ int x, y, w, h;
+ RGBA_Image *mask;
+ } mask;
Cutout_Rects cutout;
struct {
struct {
RGBA_Polygon_Point *points;
} poly;
struct {
- RGBA_Font *font;
int x, y;
- Eina_Unicode *text;
Evas_Text_Props intl_props;
} text;
struct {
} image;
struct {
+ DATA8 *mask;
+ Eina_Bool dirty: 1;
+ } mask;
+
+#if 0 // filtering disabled
+ Eina_List *filtered;
+#endif
+
+ struct {
LK(lock);
Eina_List *list;
unsigned long long orig_usage;
unsigned long long newest_usage;
unsigned long long newest_usage_count;
} cache;
+
+#ifdef HAVE_PIXMAN
+ struct {
+ pixman_image_t *im;
+ } pixman;
+#endif
};
struct _RGBA_Polygon_Point
FPc px, py, z0, foc;
};
+#if 0 // filtering disabled
+struct _Filtered_Image
+{
+ void *key;
+ size_t keylen;
+ RGBA_Image *image;
+ int ref;
+};
+#endif
+
// for fonts...
/////
typedef struct _Fash_Item_Index_Map Fash_Item_Index_Map;
Fash_Int *fash;
Font_Hint_Flags hinting;
int references;
-#ifdef EVAS_FRAME_QUEUING
- int ref_fq[2]; //ref_fq[0] is for addition, ref_fq[1] is for deletion
- pthread_cond_t cond_fq_del;
- LK(ref_fq_add);
- LK(ref_fq_del);
-#endif
LK(lock);
unsigned char sizeok : 1;
};
+#include "../engines/common/evas_font_ot.h"
+
struct _RGBA_Font_Int
{
EINA_INLIST;
int usage;
struct {
FT_Size size;
+#ifdef USE_HARFBUZZ
+ void *hb_font;
+#endif
} ft;
LK(ft_mutex);
Font_Hint_Flags hinting;
+ Font_Rend_Flags wanted_rend; /* The wanted rendering style */
+ Font_Rend_Flags runtime_rend; /* The rendering we need to do on runtime
+ in order to comply with the wanted_rend. */
+
+ Eina_List *task;
+
+ int generation;
+
unsigned char sizeok : 1;
unsigned char inuse : 1;
};
-#include "../engines/common/evas_font_ot.h"
-
struct _RGBA_Font_Source
{
const char *name;
int orig_upem;
FT_Face face;
} ft;
-#ifdef OT_SUPPORT
- struct {
- void *face;
- } hb;
-#endif
};
struct _RGBA_Font_Glyph
{
FT_UInt index;
+ Evas_Coord width;
+ Evas_Coord x_bear;
FT_Glyph glyph;
FT_BitmapGlyph glyph_out;
/* this is a problem - only 1 engine at a time can extend such a font... grrr */
struct rect
{
- short left;
- short top;
- short right;
- short bottom;
- short width;
- short height;
+ int left;
+ int top;
+ int right;
+ int bottom;
+ int width;
+ int height;
int area;
};
struct list_node _lst;
struct rect rect;
};
-
-void rect_list_node_pool_set_max(int max);
-void rect_list_node_pool_flush(void);
-list_node_t *rect_list_node_pool_get(void);
-void rect_list_node_pool_put(list_node_t *node);
-
-void rect_init(rect_t *r, int x, int y, int w, int h);
-void rect_list_append_node(list_t *rects, list_node_t *node);
-void rect_list_append(list_t *rects, const rect_t r);
-void rect_list_append_xywh(list_t *rects, int x, int y, int w, int h);
-void rect_list_concat(list_t *rects, list_t *other);
-list_node_t *rect_list_unlink_next(list_t *rects, list_node_t *parent_node);
-void rect_list_del_next(list_t *rects, list_node_t *parent_node);
-void rect_list_clear(list_t *rects);
-void rect_list_del_split_strict(list_t *rects, const rect_t del_r);
-void rect_list_add_split_strict(list_t *rects, list_node_t *node);
-list_node_t *rect_list_add_split_fuzzy(list_t *rects, list_node_t *node, int accepted_error);
-void rect_list_merge_rects(list_t *rects, list_t *to_merge, int accepted_error);void rect_list_add_split_fuzzy_and_merge(list_t *rects, list_node_t *node, int split_accepted_error, int merge_accepted_error);
-
-void rect_print(const rect_t r);
-void rect_list_print(const list_t rects);
#endif /* EVAS_RECT_SPLIT */
struct _Tilebuf
int w, h;
} tile_size;
+ struct {
+ int x, y, w, h;
+ } prev_add, prev_del;
#ifdef RECTUPDATE
+/*
Regionbuf *rb;
+ */
#elif defined(EVAS_RECT_SPLIT)
int need_merge;
list_t rects;
#else
+/*
struct {
int w, h;
Tilebuf_Tile *tiles;
} tiles;
+ */
#endif
};
#ifndef WORDS_BIGENDIAN
/* x86 */
-#define A_VAL(p) ((DATA8 *)(p))[3]
-#define R_VAL(p) ((DATA8 *)(p))[2]
-#define G_VAL(p) ((DATA8 *)(p))[1]
-#define B_VAL(p) ((DATA8 *)(p))[0]
+#define A_VAL(p) (((DATA8 *)(p))[3])
+#define R_VAL(p) (((DATA8 *)(p))[2])
+#define G_VAL(p) (((DATA8 *)(p))[1])
+#define B_VAL(p) (((DATA8 *)(p))[0])
#define AR_VAL(p) ((DATA16 *)(p)[1])
#define GB_VAL(p) ((DATA16 *)(p)[0])
#else
/* ppc */
-#define A_VAL(p) ((DATA8 *)(p))[0]
-#define R_VAL(p) ((DATA8 *)(p))[1]
-#define G_VAL(p) ((DATA8 *)(p))[2]
-#define B_VAL(p) ((DATA8 *)(p))[3]
+#define A_VAL(p) (((DATA8 *)(p))[0])
+#define R_VAL(p) (((DATA8 *)(p))[1])
+#define G_VAL(p) (((DATA8 *)(p))[2])
+#define B_VAL(p) (((DATA8 *)(p))[3])
#define AR_VAL(p) ((DATA16 *)(p)[0])
#define GB_VAL(p) ((DATA16 *)(p)[1])
#endif
/*****************************************************************************/
+#define SCALE_SIZE_MAX ((1 << 15) - 1)
+
#ifdef __cplusplus
extern "C" {
#endif