aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/include/evas_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/lib/include/evas_common.h')
-rw-r--r--libraries/evas/src/lib/include/evas_common.h1258
1 files changed, 0 insertions, 1258 deletions
diff --git a/libraries/evas/src/lib/include/evas_common.h b/libraries/evas/src/lib/include/evas_common.h
deleted file mode 100644
index e853064..0000000
--- a/libraries/evas/src/lib/include/evas_common.h
+++ /dev/null
@@ -1,1258 +0,0 @@
1#ifndef EVAS_COMMON_H
2#define EVAS_COMMON_H
3
4//#ifdef HAVE_CONFIG_H
5#include "config.h" /* so that EAPI in Evas.h is correctly defined */
6//#endif
7
8#ifdef STDC_HEADERS
9# include <stdlib.h>
10# include <stddef.h>
11#else
12# ifdef HAVE_STDLIB_H
13# include <stdlib.h>
14# endif
15#endif
16#ifdef HAVE_ALLOCA_H
17# include <alloca.h>
18#elif !defined alloca
19# ifdef __GNUC__
20# define alloca __builtin_alloca
21# elif defined _AIX
22# define alloca __alloca
23# elif defined _MSC_VER
24# include <malloc.h>
25# define alloca _alloca
26# elif !defined HAVE_ALLOCA
27# ifdef __cplusplus
28extern "C"
29# endif
30void *alloca (size_t);
31# endif
32#endif
33
34#include <stdio.h>
35#include <stdlib.h>
36#include <string.h>
37#include <sys/types.h>
38#include <sys/stat.h>
39#include <time.h>
40#include <ctype.h>
41
42#ifndef _MSC_VER
43# include <stdint.h>
44#include <unistd.h>
45#endif
46
47#ifdef HAVE_EVIL
48# include <Evil.h>
49#endif
50
51#ifdef HAVE_ESCAPE
52# include <Escape.h>
53#endif
54
55#ifdef HAVE_PIXMAN
56#include <pixman.h>
57#endif
58
59#include <sys/types.h>
60#include <sys/stat.h>
61#include <unistd.h>
62
63#ifdef HAVE_EXOTIC
64# include <Exotic.h>
65#endif
66
67#include <Eina.h>
68#include "Evas.h"
69//#include "Evas_GL.h"
70
71#ifndef HAVE_LROUND
72/* right now i dont care about rendering bugs on platforms without lround
73 (e.g. windows/vc++... yay!)
74 FIXME: http://cgit.freedesktop.org/cairo/tree/src/cairo-misc.c#n487
75*/
76#define lround(x) (((x) < 0) ? (long int)ceil((x) - 0.5) : (long int)floor((x) + 0.5))
77#endif
78
79/* macros needed to log message through eina_log */
80extern EAPI int _evas_log_dom_global;
81#ifdef _EVAS_DEFAULT_LOG_DOM
82# undef _EVAS_DEFAULT_LOG_DOM
83#endif
84#define _EVAS_DEFAULT_LOG_DOM _evas_log_dom_global
85
86#ifdef EVAS_DEFAULT_LOG_COLOR
87# undef EVAS_DEFAULT_LOG_COLOR
88#endif
89#define EVAS_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
90
91#ifdef ERR
92# undef ERR
93#endif
94#define ERR(...) EINA_LOG_DOM_ERR(_EVAS_DEFAULT_LOG_DOM, __VA_ARGS__)
95
96#ifdef DBG
97# undef DBG
98#endif
99#define DBG(...) EINA_LOG_DOM_DBG(_EVAS_DEFAULT_LOG_DOM, __VA_ARGS__)
100
101#ifdef INF
102# undef INF
103#endif
104#define INF(...) EINA_LOG_DOM_INFO(_EVAS_DEFAULT_LOG_DOM, __VA_ARGS__)
105
106#ifdef WRN
107# undef WRN
108#endif
109#define WRN(...) EINA_LOG_DOM_WARN(_EVAS_DEFAULT_LOG_DOM, __VA_ARGS__)
110
111#ifdef CRIT
112# undef CRIT
113#endif
114#define CRIT(...) EINA_LOG_DOM_CRIT(_EVAS_DEFAULT_LOG_DOM, __VA_ARGS__)
115
116#include "evas_options.h"
117
118#if defined(__ARM_ARCH_3M__)
119# define __ARM_ARCH__ 40
120#endif
121#if defined(__ARM_ARCH_4__)
122# define __ARM_ARCH__ 40
123#endif
124#if defined(__ARM_ARCH_4T__)
125# define __ARM_ARCH__ 41
126#endif
127
128#if defined(__ARM_ARCH_5__)
129# define __ARM_ARCH__ 50
130#endif
131#if defined(__ARM_ARCH_5T__)
132# define __ARM_ARCH__ 51
133#endif
134#if defined(__ARM_ARCH_5E__)
135# define __ARM_ARCH__ 52
136#endif
137#if defined(__ARM_ARCH_5TE__)
138# define __ARM_ARCH__ 53
139#endif
140#if defined(__ARM_ARCH_5TEJ__)
141# define __ARM_ARCH__ 54
142#endif
143
144#if defined(__ARM_ARCH_6__)
145# define __ARM_ARCH__ 60
146#endif
147#if defined(__ARM_ARCH_6J__)
148# define __ARM_ARCH__ 61
149#endif
150#if defined(__ARM_ARCH_6K__)
151# define __ARM_ARCH__ 62
152#endif
153#if defined(__ARM_ARCH_6Z__)
154# define __ARM_ARCH__ 63
155#endif
156#if defined(__ARM_ARCH_6ZK__)
157# define __ARM_ARCH__ 64
158#endif
159#if defined(__ARM_ARCH_6T2__)
160# define __ARM_ARCH__ 65
161#endif
162
163#if defined(__ARM_ARCH_7__)
164# define __ARM_ARCH__ 70
165#endif
166#if defined(__ARM_ARCH_7A__)
167# define __ARM_ARCH__ 71
168#endif
169#if defined(__ARM_ARCH_7R__)
170# define __ARM_ARCH__ 72
171#endif
172#if defined(__ARM_ARCH_7M__)
173# define __ARM_ARCH__ 73
174#endif
175
176#ifndef BUILD_PTHREAD
177# undef BUILD_PIPE_RENDER
178#endif
179
180#if defined(BUILD_ASYNC_PRELOAD) && !defined(BUILD_PTHREAD)
181# define BUILD_PTHREAD
182#endif
183
184#define LK(x) Eina_Lock x
185#define LKI(x) eina_lock_new(&(x))
186#define LKD(x) eina_lock_free(&(x))
187#define LKL(x) eina_lock_take(&(x))
188#define LKT(x) eina_lock_take_try(&(x))
189#define LKU(x) eina_lock_release(&(x))
190#define LKDBG(x) eina_lock_debug(&(x))
191
192/* for rwlocks */
193#define RWLK(x) Eina_RWLock x
194#define RWLKI(x) eina_rwlock_new(&(x))
195#define RWLKD(x) eina_rwlock_free(&(x))
196#define RDLKL(x) eina_rwlock_take_read(&(x))
197#define WRLKL(x) eina_rwlock_take_write(&(x))
198#define RWLKU(x) eina_rwlock_release(&(x))
199
200#ifdef BUILD_PTHREAD
201
202# define TH(x) pthread_t x
203# define THI(x) int x
204# define TH_MAX 8
205
206// even though in theory having every Nth rendered line done by a different
207// thread might even out load across threads - it actually slows things down.
208//#define EVAS_SLI 1
209
210#else
211# define TH(x)
212# define THI(x)
213# define TH_MAX 0
214
215#endif
216
217#include <ft2build.h>
218#include FT_FREETYPE_H
219#include FT_GLYPH_H
220#include FT_SIZES_H
221#include FT_MODULE_H
222
223#ifdef __GNUC__
224# if __GNUC__ >= 4
225// BROKEN in gcc 4 on amd64
226//# pragma GCC visibility push(hidden)
227# endif
228#define LIKELY(x) __builtin_expect(!!(x), 1)
229#define UNLIKELY(x) __builtin_expect(!!(x), 0)
230#else
231#define LIKELY(x) (x)
232#define UNLIKELY(x) (x)
233#endif
234
235/*****************************************************************************/
236
237/* use exact rects for updates not tiles */
238/* #define RECTUPDATE */
239#define TILESIZE 8
240#define IMG_MAX_SIZE 65000
241
242#define IMG_TOO_BIG(w, h) \
243 ((((unsigned long long)w) * ((unsigned long long)h)) >= \
244 ((1ULL << (29 * (sizeof(void *) / 4))) - 2048))
245
246#ifdef BUILD_SMALL_DITHER_MASK
247# define DM_TABLE _evas_dither_44
248# define DM_SIZE 4
249# define DM_BITS 4
250# define DM_DIV 16
251# define USE_DITHER_44 1
252#else
253# define DM_TABLE _evas_dither_128128
254# define DM_SIZE 128
255# define DM_BITS 6
256# define DM_DIV 64
257# define USE_DITHER_128128 1
258#endif
259
260#define DM_MSK (DM_SIZE - 1)
261#define DM_SHF(_b) (DM_BITS - (8 - _b))
262/* Supports negative right shifts */
263#define DM_SHR(x, _b) ((DM_SHF(_b) >= 0) ? \
264 ((x) >> DM_SHF(_b)) : ((x) << -DM_SHF(_b)))
265
266/* if more than 1/ALPHA_SPARSE_INV_FRACTION is "alpha" (1-254) then sparse
267 * alpha flag gets set */
268#define ALPHA_SPARSE_INV_FRACTION 3
269
270/*****************************************************************************/
271
272#if defined(__ARM_ARCH_3M__)
273# define __ARM_ARCH__ 40
274#endif
275#if defined(__ARM_ARCH_4__)
276# define __ARM_ARCH__ 40
277#endif
278#if defined(__ARM_ARCH_4T__)
279# define __ARM_ARCH__ 41
280#endif
281
282#if defined(__ARM_ARCH_5__)
283# define __ARM_ARCH__ 50
284#endif
285#if defined(__ARM_ARCH_5T__)
286# define __ARM_ARCH__ 51
287#endif
288#if defined(__ARM_ARCH_5E__)
289# define __ARM_ARCH__ 52
290#endif
291#if defined(__ARM_ARCH_5TE__)
292# define __ARM_ARCH__ 53
293#endif
294#if defined(__ARM_ARCH_5TEJ__)
295# define __ARM_ARCH__ 54
296#endif
297
298#if defined(__ARM_ARCH_6__)
299# define __ARM_ARCH__ 60
300#endif
301#if defined(__ARM_ARCH_6J__)
302# define __ARM_ARCH__ 61
303#endif
304#if defined(__ARM_ARCH_6K__)
305# define __ARM_ARCH__ 62
306#endif
307#if defined(__ARM_ARCH_6Z__)
308# define __ARM_ARCH__ 63
309#endif
310#if defined(__ARM_ARCH_6ZK__)
311# define __ARM_ARCH__ 64
312#endif
313#if defined(__ARM_ARCH_6T2__)
314# define __ARM_ARCH__ 65
315#endif
316
317#if defined(__ARM_ARCH_7__)
318# define __ARM_ARCH__ 70
319#endif
320#if defined(__ARM_ARCH_7A__)
321# define __ARM_ARCH__ 71
322#endif
323#if defined(__ARM_ARCH_7R__)
324# define __ARM_ARCH__ 72
325#endif
326#if defined(__ARM_ARCH_7M__)
327# define __ARM_ARCH__ 73
328#endif
329
330#if defined(__ARM_ARCH__) && (__ARM_ARCH__ >= 52)
331/* tested on ARMv6 (arm1136j-s), Nokia N800 CPU */
332#define pld(addr, off) \
333 __asm__("pld [%[address], %[offset]]":: \
334 [address] "r" (addr), [offset] "i" (off))
335#else
336#define pld(addr, off)
337#endif /* __ARMEL__ */
338
339// these here are in config.h - just here for documentation
340//#ifdef __ARM_ARCH__
341// *IF* you enable pixman, this determines which things pixman will do
342////#define PIXMAN_FONT 1
343////#define PIXMAN_RECT 1
344////#define PIXMAN_LINE 1
345////#define PIXMAN_POLY 1
346//#define PIXMAN_IMAGE 1
347//#define PIXMAN_IMAGE_SCALE_SAMPLE 1
348//#endif
349// not related to pixman but an alternate rotate code
350//#define TILE_ROTATE 1
351
352#define TILE_CACHE_LINE_SIZE 64
353
354/*****************************************************************************/
355
356#define UNROLL2(op...) op op
357#define UNROLL4(op...) UNROLL2(op) UNROLL2(op)
358#define UNROLL8(op...) UNROLL4(op) UNROLL4(op)
359#define UNROLL16(op...) UNROLL8(op) UNROLL8(op)
360
361#define UNROLL8_PLD_WHILE(start, size, end, op) \
362 pld(start, 0); \
363 end = start + (size & ~7); \
364 while (start < end) \
365 { \
366 pld(start, 32); \
367 UNROLL8(op); \
368 } \
369 end += (size & 7); \
370 pld(start, 32); \
371 while (start < end) \
372 { \
373 op; \
374 }
375
376/*****************************************************************************/
377
378typedef unsigned long long DATA64;
379typedef unsigned int DATA32;
380typedef unsigned short DATA16;
381typedef unsigned char DATA8;
382
383typedef struct _Image_Entry Image_Entry;
384typedef struct _Image_Entry_Flags Image_Entry_Flags;
385typedef struct _Image_Entry_Frame Image_Entry_Frame;
386typedef struct _Image_Timestamp Image_Timestamp;
387typedef struct _Engine_Image_Entry Engine_Image_Entry;
388typedef struct _Evas_Cache_Target Evas_Cache_Target;
389typedef struct _Evas_Preload_Pthread Evas_Preload_Pthread;
390
391typedef struct _RGBA_Image_Loadopts RGBA_Image_Loadopts;
392#ifdef BUILD_PIPE_RENDER
393typedef struct _RGBA_Pipe_Op RGBA_Pipe_Op;
394typedef struct _RGBA_Pipe RGBA_Pipe;
395typedef struct _RGBA_Pipe_Thread_Info RGBA_Pipe_Thread_Info;
396#endif
397typedef struct _RGBA_Image RGBA_Image;
398typedef struct _RGBA_Image_Span RGBA_Image_Span;
399typedef struct _RGBA_Draw_Context RGBA_Draw_Context;
400typedef struct _RGBA_Polygon_Point RGBA_Polygon_Point;
401typedef struct _RGBA_Map_Point RGBA_Map_Point;
402typedef struct _RGBA_Font RGBA_Font;
403typedef struct _RGBA_Font_Int RGBA_Font_Int;
404typedef struct _RGBA_Font_Source RGBA_Font_Source;
405typedef struct _RGBA_Font_Glyph RGBA_Font_Glyph;
406typedef struct _RGBA_Gfx_Compositor RGBA_Gfx_Compositor;
407
408typedef struct _Cutout_Rect Cutout_Rect;
409typedef struct _Cutout_Rects Cutout_Rects;
410
411typedef struct _Convert_Pal Convert_Pal;
412
413typedef struct _Tilebuf Tilebuf;
414typedef struct _Tilebuf_Tile Tilebuf_Tile;
415typedef struct _Tilebuf_Rect Tilebuf_Rect;
416
417typedef struct _Evas_Common_Transform Evas_Common_Transform;
418
419// RGBA_Map_Point
420// all coords are 20.12
421// fp type - an int for now
422typedef int FPc;
423// fp # of bits of float accuracy
424#define FP 8
425// fp half (half of an fp unit)
426#define FPH (1 << (FP - 1))
427// one fp unit
428#define FP1 (1 << (FP))
429
430/*
431typedef struct _Regionbuf Regionbuf;
432typedef struct _Regionspan Regionspan;
433*/
434
435typedef void (*RGBA_Gfx_Func) (DATA32 *src, DATA8 *mask, DATA32 col, DATA32 *dst, int len);
436typedef void (*RGBA_Gfx_Pt_Func) (DATA32 src, DATA8 mask, DATA32 col, DATA32 *dst);
437typedef void (*Gfx_Func_Copy) (DATA32 *src, DATA32 *dst, int len);
438
439typedef 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);
440
441#include "../cache/evas_cache.h"
442
443/*****************************************************************************/
444
445typedef enum _RGBA_Image_Flags
446{
447 RGBA_IMAGE_NOTHING = (0),
448/* RGBA_IMAGE_HAS_ALPHA = (1 << 0), */
449 RGBA_IMAGE_IS_DIRTY = (1 << 1),
450 RGBA_IMAGE_INDEXED = (1 << 2),
451 RGBA_IMAGE_ALPHA_ONLY = (1 << 3),
452 RGBA_IMAGE_ALPHA_TILES = (1 << 4),
453/* RGBA_IMAGE_ALPHA_SPARSE = (1 << 5), */
454/* RGBA_IMAGE_LOADED = (1 << 6), */
455/* RGBA_IMAGE_NEED_DATA = (1 << 7) */
456 RGBA_IMAGE_TODO_LOAD = (1 << 8),
457} RGBA_Image_Flags;
458
459typedef enum _Convert_Pal_Mode
460{
461 PAL_MODE_NONE,
462 PAL_MODE_MONO,
463 PAL_MODE_GRAY4,
464 PAL_MODE_GRAY16,
465 PAL_MODE_GRAY64,
466 PAL_MODE_GRAY256,
467 PAL_MODE_RGB111,
468 PAL_MODE_RGB121,
469 PAL_MODE_RGB221,
470 PAL_MODE_RGB222,
471 PAL_MODE_RGB232,
472 PAL_MODE_RGB332,
473 PAL_MODE_RGB666,
474 PAL_MODE_LAST
475} Convert_Pal_Mode;
476
477typedef enum _CPU_Features
478{
479 CPU_FEATURE_C = 0,
480 CPU_FEATURE_MMX = (1 << 0),
481 CPU_FEATURE_MMX2 = (1 << 1),
482 CPU_FEATURE_SSE = (1 << 2),
483 CPU_FEATURE_ALTIVEC = (1 << 3),
484 CPU_FEATURE_VIS = (1 << 4),
485 CPU_FEATURE_VIS2 = (1 << 5),
486 CPU_FEATURE_NEON = (1 << 6),
487 CPU_FEATURE_SSE3 = (1 << 7)
488} CPU_Features;
489
490typedef enum _Font_Hint_Flags
491{
492 FONT_NO_HINT,
493 FONT_AUTO_HINT,
494 FONT_BYTECODE_HINT
495} Font_Hint_Flags;
496
497typedef enum _Font_Rend_Flags
498{
499 FONT_REND_REGULAR = 0,
500 FONT_REND_SLANT = (1 << 0),
501 FONT_REND_WEIGHT = (1 << 1),
502} Font_Rend_Flags;
503
504/*****************************************************************************/
505
506#if 0 // filtering disabled
507typedef struct _Filtered_Image Filtered_Image;
508#endif
509
510struct _RGBA_Image_Loadopts
511{
512 int scale_down_by; // if > 1 then use this
513 double dpi; // if > 0.0 use this
514 unsigned int w, h; // if > 0 use this
515 unsigned int degree;//if>0 there is some info related with rotation
516 struct {
517 unsigned int x, y, w, h;
518 } region;
519
520 Eina_Bool orientation; // if EINA_TRUE => should honor orientation information provided by file (like jpeg exif info)
521};
522
523struct _Image_Entry_Flags
524{
525 Eina_Bool loaded : 1;
526 Eina_Bool in_progress : 1;
527 Eina_Bool dirty : 1;
528 Eina_Bool activ : 1;
529
530 Eina_Bool need_data : 1;
531 Eina_Bool lru_nodata : 1;
532 Eina_Bool cached : 1;
533 Eina_Bool alpha : 1;
534
535 Eina_Bool lru : 1;
536 Eina_Bool alpha_sparse : 1;
537#ifdef BUILD_ASYNC_PRELOAD
538 Eina_Bool preload_done : 1;
539 Eina_Bool delete_me : 1;
540 Eina_Bool pending : 1;
541#endif
542 Eina_Bool animated : 1;
543 Eina_Bool rotated : 1;
544};
545
546struct _Image_Entry_Frame
547{
548 int index;
549 DATA32 *data; /* frame decoding data */
550 void *info; /* special image type info */
551 Eina_Bool loaded : 1;
552};
553
554struct _Evas_Cache_Target
555{
556 EINA_INLIST;
557 const void *target;
558 void *data;
559};
560
561struct _Image_Timestamp
562{
563 time_t mtime;
564 off_t size;
565 ino_t ino;
566#ifdef _STAT_VER_LINUX
567 unsigned long int mtime_nsec;
568#endif
569};
570
571struct _Image_Entry
572{
573 EINA_INLIST;
574
575 Evas_Cache_Image *cache;
576
577 const char *cache_key;
578
579 const char *file;
580 const char *key;
581
582 Evas_Cache_Target *targets;
583 Evas_Preload_Pthread *preload;
584
585 Image_Timestamp tstamp;
586
587 int references;
588#ifdef EVAS_FRAME_QUEUING
589 LK(lock_references); // needed for accessing references
590#endif
591
592#ifdef BUILD_PIPE_RENDER
593 RGBA_Pipe *pipe;
594#ifdef EVAS_FRAME_QUEUING
595 LK(ref_fq_add);
596 LK(ref_fq_del);
597 Eina_Condition cond_fq_del;
598 int ref_fq[2]; // ref_fq[0] is for addition, ref_fq[1] is for deletion
599#endif
600#endif
601
602 unsigned char scale;
603
604 RGBA_Image_Loadopts load_opts;
605 int space;
606 unsigned int w;
607 unsigned int h;
608
609 struct
610 {
611 unsigned int w;
612 unsigned int h;
613 } allocated;
614
615 struct
616 {
617 void *module;
618 void *loader;
619 } info;
620
621#ifdef BUILD_ASYNC_PRELOAD
622 LK(lock);
623 LK(lock_cancel);
624 Eina_Bool unload_cancel : 1;
625#endif
626
627 Image_Entry_Flags flags;
628 Evas_Image_Scale_Hint scale_hint;
629 void *data1, *data2;
630 int server_id;
631 int connect_num;
632 int channel;
633 int load_error;
634
635 /* for animation feature */
636 int frame_count;
637 Evas_Image_Animated_Loop_Hint loop_hint;
638 int loop_count;
639 int cur_frame;
640 Eina_List *frames;
641};
642
643struct _Engine_Image_Entry
644{
645 EINA_INLIST;
646
647 /* Upper Engine data. */
648 Image_Entry *src;
649
650 /* Cache stuff. */
651 Evas_Cache_Engine_Image *cache;
652 const char *cache_key;
653
654 struct
655 {
656 Eina_Bool cached : 1;
657 Eina_Bool activ : 1;
658 Eina_Bool dirty : 1;
659 Eina_Bool loaded : 1;
660 Eina_Bool need_parent : 1;
661 } flags;
662
663 int references;
664 int w;
665 int h;
666};
667
668struct _Cutout_Rect
669{
670 int x, y, w, h;
671};
672
673struct _Cutout_Rects
674{
675 Cutout_Rect* rects;
676 int active;
677 int max;
678};
679
680struct _Evas_Common_Transform
681{
682 float mxx, mxy, mxz;
683 float myx, myy, myz;
684 float mzx, mzy, mzz;
685};
686
687struct _RGBA_Draw_Context
688{
689 struct {
690 Eina_Bool use : 1;
691 DATA32 col;
692 } mul;
693 struct {
694#ifdef HAVE_PIXMAN
695 pixman_image_t *pixman_color_image;
696#endif
697 DATA32 col;
698 } col;
699 struct RGBA_Draw_Context_clip {
700 int x, y, w, h;
701 Eina_Bool use : 1;
702 } clip;
703 struct {
704 int x, y, w, h;
705 RGBA_Image *mask;
706 } mask;
707 Cutout_Rects cutout;
708 struct {
709 struct {
710 void *(*gl_new) (void *data, RGBA_Font_Glyph *fg);
711 void (*gl_free) (void *ext_dat);
712 void (*gl_draw) (void *data, void *dest, void *context, RGBA_Font_Glyph *fg, int x, int y);
713 } func;
714 void *data;
715 } font_ext;
716 struct {
717 int color_space;
718 } interpolation;
719 struct {
720 int y, h;
721 } sli;
722 int render_op;
723 Eina_Bool anti_alias : 1;
724};
725
726#ifdef BUILD_PIPE_RENDER
727#include "../engines/common/evas_map_image.h"
728#include "../engines/common/evas_text_utils.h"
729
730struct _RGBA_Pipe_Op
731{
732 RGBA_Draw_Context context;
733 void (*op_func) (RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Thread_Info *info);
734 void (*free_func) (RGBA_Pipe_Op *op);
735
736 union {
737 struct {
738 int x, y, w, h;
739 } rect;
740 struct {
741 int x0, y0, x1, y1;
742 } line;
743 struct {
744 RGBA_Polygon_Point *points;
745 } poly;
746 struct {
747 RGBA_Font *font;
748 int x, y;
749 Evas_Text_Props intl_props;
750 } text;
751 struct {
752 RGBA_Image *src;
753 int sx, sy, sw, sh, dx, dy, dw, dh;
754 int smooth;
755 char *text;
756 } image;
757 struct {
758 RGBA_Image *src;
759 RGBA_Map_Point *p;
760 int npoints;
761 int smooth;
762 int level;
763 } map;
764 } op;
765};
766
767#define PIPE_LEN 256
768
769struct _RGBA_Pipe
770{
771 EINA_INLIST;
772 int op_num;
773 RGBA_Pipe_Op op[PIPE_LEN];
774};
775
776struct _RGBA_Pipe_Thread_Info
777{
778 RGBA_Image *im;
779 int x, y, w, h;
780};
781#endif
782
783struct _RGBA_Image
784{
785 Image_Entry cache_entry;
786
787 RGBA_Image_Flags flags;
788 struct
789 {
790/* void *module; */
791/* void *loader; */
792/* char *real_file; */
793 char *comment;
794// int format;
795 } info;
796
797 void *extended_info;
798 int ref;
799
800/* unsigned char scale; */
801
802 /* Colorspace stuff. */
803 struct {
804 void *data;
805 Eina_Bool no_free : 1;
806 Eina_Bool dirty : 1;
807 } cs;
808
809 /* RGBA stuff */
810 struct {
811 DATA32 *data;
812 Eina_Bool no_free : 1;
813 } image;
814
815 struct {
816 DATA8 *mask;
817 Eina_Bool dirty: 1;
818 } mask;
819
820#if 0 // filtering disabled
821 Eina_List *filtered;
822#endif
823
824 struct {
825 LK(lock);
826 Eina_List *list;
827 unsigned long long orig_usage;
828 unsigned long long usage_count;
829 int populate_count;
830 unsigned long long newest_usage;
831 unsigned long long newest_usage_count;
832 } cache;
833
834#ifdef HAVE_PIXMAN
835 struct {
836 pixman_image_t *im;
837 } pixman;
838#endif
839};
840
841struct _RGBA_Polygon_Point
842{
843 EINA_INLIST;
844 int x, y;
845};
846
847struct _RGBA_Map_Point
848{
849 FPc x, y; // x, y screenspace
850 float fx, fy, fz; // x, y, z in floats
851// FPc x3, y3; // x, y 3d space
852 FPc z; // z in world space. optional
853 FPc u, v; // u, v in tex coords
854 DATA32 col; // color at this point
855 // for perspective correctness - only point 0 has relevant info
856 FPc px, py, z0, foc;
857};
858
859#if 0 // filtering disabled
860struct _Filtered_Image
861{
862 void *key;
863 size_t keylen;
864 RGBA_Image *image;
865 int ref;
866};
867#endif
868
869// for fonts...
870/////
871typedef struct _Fash_Item_Index_Map Fash_Item_Index_Map;
872typedef struct _Fash_Int_Map Fash_Int_Map;
873typedef struct _Fash_Int_Map2 Fash_Int_Map2;
874typedef struct _Fash_Int Fash_Int;
875struct _Fash_Item_Index_Map
876{
877 RGBA_Font_Int *fint;
878 int index;
879};
880struct _Fash_Int_Map
881{
882 Fash_Item_Index_Map item[256];
883};
884struct _Fash_Int_Map2
885{
886 Fash_Int_Map *bucket[256];
887};
888struct _Fash_Int
889{
890 Fash_Int_Map2 *bucket[256];
891 void (*freeme) (Fash_Int *fash);
892};
893
894/////
895typedef struct _Fash_Glyph_Map Fash_Glyph_Map;
896typedef struct _Fash_Glyph_Map2 Fash_Glyph_Map2;
897typedef struct _Fash_Glyph Fash_Glyph;
898struct _Fash_Glyph_Map
899{
900 RGBA_Font_Glyph *item[256];
901};
902struct _Fash_Glyph_Map2
903{
904 Fash_Glyph_Map *bucket[256];
905};
906struct _Fash_Glyph
907{
908 Fash_Glyph_Map2 *bucket[256];
909 void (*freeme) (Fash_Glyph *fash);
910};
911/////
912
913struct _RGBA_Font
914{
915 Eina_List *fonts;
916 Fash_Int *fash;
917 Font_Hint_Flags hinting;
918 int references;
919#ifdef EVAS_FRAME_QUEUING
920 int ref_fq[2]; //ref_fq[0] is for addition, ref_fq[1] is for deletion
921 Eina_Condition cond_fq_del;
922 LK(ref_fq_add);
923 LK(ref_fq_del);
924#endif
925 LK(lock);
926 unsigned char sizeok : 1;
927};
928
929#include "../engines/common/evas_font_ot.h"
930
931struct _RGBA_Font_Int
932{
933 EINA_INLIST;
934 RGBA_Font_Source *src;
935 Eina_Hash *kerning;
936 Fash_Glyph *fash;
937 unsigned int size;
938 int real_size;
939 int max_h;
940 int references;
941 int usage;
942 struct {
943 FT_Size size;
944#ifdef USE_HARFBUZZ
945 void *hb_font;
946#endif
947 } ft;
948 LK(ft_mutex);
949 Font_Hint_Flags hinting;
950 Font_Rend_Flags wanted_rend; /* The wanted rendering style */
951 Font_Rend_Flags runtime_rend; /* The rendering we need to do on runtime
952 in order to comply with the wanted_rend. */
953 unsigned char sizeok : 1;
954 unsigned char inuse : 1;
955};
956
957struct _RGBA_Font_Source
958{
959 const char *name;
960 const char *file;
961 void *data;
962 unsigned int current_size;
963 int data_size;
964 int references;
965 struct {
966 int orig_upem;
967 FT_Face face;
968 } ft;
969};
970
971struct _RGBA_Font_Glyph
972{
973 FT_UInt index;
974 FT_Glyph glyph;
975 FT_BitmapGlyph glyph_out;
976 /* this is a problem - only 1 engine at a time can extend such a font... grrr */
977 void *ext_dat;
978 void (*ext_dat_free) (void *ext_dat);
979 RGBA_Font_Int *fi;
980};
981
982struct _RGBA_Gfx_Compositor
983{
984 const char *name;
985
986 void (*init)(void);
987 void (*shutdown)(void);
988
989 RGBA_Gfx_Func (*composite_pixel_span_get)(RGBA_Image *src, RGBA_Image *dst, int pixels);
990 RGBA_Gfx_Func (*composite_color_span_get)(DATA32 col, RGBA_Image *dst, int pixels);
991 RGBA_Gfx_Func (*composite_pixel_color_span_get)(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels);
992 RGBA_Gfx_Func (*composite_mask_color_span_get)(DATA32 col, RGBA_Image *dst, int pixels);
993 RGBA_Gfx_Func (*composite_pixel_mask_span_get)(RGBA_Image *src, RGBA_Image *dst, int pixels);
994
995 RGBA_Gfx_Pt_Func (*composite_pixel_pt_get)(Image_Entry_Flags src_flags, RGBA_Image *dst);
996 RGBA_Gfx_Pt_Func (*composite_color_pt_get)(DATA32 col, RGBA_Image *dst);
997 RGBA_Gfx_Pt_Func (*composite_pixel_color_pt_get)(Image_Entry_Flags src_flags, DATA32 col, RGBA_Image *dst);
998 RGBA_Gfx_Pt_Func (*composite_mask_color_pt_get)(DATA32 col, RGBA_Image *dst);
999 RGBA_Gfx_Pt_Func (*composite_pixel_mask_pt_get)(Image_Entry_Flags src_flags, RGBA_Image *dst);
1000};
1001
1002#define EVAS_RECT_SPLIT 1
1003#ifdef EVAS_RECT_SPLIT
1004typedef struct list_node list_node_t;
1005typedef struct list list_t;
1006typedef struct rect rect_t;
1007typedef struct rect_node rect_node_t;
1008
1009struct list_node
1010{
1011 struct list_node *next;
1012};
1013
1014struct list
1015{
1016 struct list_node *head;
1017 struct list_node *tail;
1018};
1019
1020struct rect
1021{
1022 int left;
1023 int top;
1024 int right;
1025 int bottom;
1026 int width;
1027 int height;
1028 int area;
1029};
1030
1031struct rect_node
1032{
1033 struct list_node _lst;
1034 struct rect rect;
1035};
1036#endif /* EVAS_RECT_SPLIT */
1037
1038struct _Tilebuf
1039{
1040 int outbuf_w;
1041 int outbuf_h;
1042
1043 struct {
1044 int w, h;
1045 } tile_size;
1046
1047 struct {
1048 int x, y, w, h;
1049 } prev_add, prev_del;
1050#ifdef RECTUPDATE
1051/*
1052 Regionbuf *rb;
1053 */
1054#elif defined(EVAS_RECT_SPLIT)
1055 int need_merge;
1056 list_t rects;
1057#else
1058/*
1059 struct {
1060 int w, h;
1061 Tilebuf_Tile *tiles;
1062 } tiles;
1063 */
1064#endif
1065};
1066
1067struct _Tilebuf_Tile
1068{
1069 Eina_Bool redraw : 1;
1070/* FIXME: need these flags later - but not now */
1071/*
1072 Eina_Bool done : 1;
1073 Eina_Bool edge : 1;
1074 Eina_Bool from : 1;
1075
1076 struct {
1077 int dx, dy;
1078 } vector;
1079 */
1080};
1081
1082struct _Tilebuf_Rect
1083{
1084 EINA_INLIST;
1085 int x, y, w, h;
1086};
1087/*
1088struct _Regionbuf
1089{
1090 int w, h;
1091 Regionspan **spans;
1092};
1093
1094struct _Regionspan
1095{
1096 EINA_INLIST;
1097 int x1, x2;
1098};
1099*/
1100
1101struct _Convert_Pal
1102{
1103 int references;
1104 int count;
1105 Convert_Pal_Mode colors;
1106 DATA8 *lookup;
1107 void *data;
1108};
1109
1110/****/
1111
1112/*****************************************************************************/
1113#include "evas_macros.h"
1114
1115#ifndef WORDS_BIGENDIAN
1116/* x86 */
1117#define A_VAL(p) (((DATA8 *)(p))[3])
1118#define R_VAL(p) (((DATA8 *)(p))[2])
1119#define G_VAL(p) (((DATA8 *)(p))[1])
1120#define B_VAL(p) (((DATA8 *)(p))[0])
1121#define AR_VAL(p) ((DATA16 *)(p)[1])
1122#define GB_VAL(p) ((DATA16 *)(p)[0])
1123#else
1124/* ppc */
1125#define A_VAL(p) (((DATA8 *)(p))[0])
1126#define R_VAL(p) (((DATA8 *)(p))[1])
1127#define G_VAL(p) (((DATA8 *)(p))[2])
1128#define B_VAL(p) (((DATA8 *)(p))[3])
1129#define AR_VAL(p) ((DATA16 *)(p)[0])
1130#define GB_VAL(p) ((DATA16 *)(p)[1])
1131#endif
1132
1133#define RGB_JOIN(r,g,b) \
1134 (((r) << 16) + ((g) << 8) + (b))
1135
1136#define ARGB_JOIN(a,r,g,b) \
1137 (((a) << 24) + ((r) << 16) + ((g) << 8) + (b))
1138
1139#include "evas_blend_ops.h"
1140
1141#define _EVAS_RENDER_FILL -1
1142#define _EVAS_RENDER_BLEND 0
1143#define _EVAS_RENDER_BLEND_REL 1
1144#define _EVAS_RENDER_COPY 2
1145#define _EVAS_RENDER_COPY_REL 3
1146#define _EVAS_RENDER_ADD 4
1147#define _EVAS_RENDER_ADD_REL 5
1148#define _EVAS_RENDER_SUB 6
1149#define _EVAS_RENDER_SUB_REL 7
1150#define _EVAS_RENDER_TINT 8
1151#define _EVAS_RENDER_TINT_REL 9
1152#define _EVAS_RENDER_MASK 10
1153#define _EVAS_RENDER_MUL 11
1154#define _EVAS_RENDER_CLIP 12
1155
1156#define _EVAS_TEXTURE_REFLECT 0
1157#define _EVAS_TEXTURE_REPEAT 1
1158#define _EVAS_TEXTURE_RESTRICT 2
1159#define _EVAS_TEXTURE_RESTRICT_REFLECT 3
1160#define _EVAS_TEXTURE_RESTRICT_REPEAT 4
1161#define _EVAS_TEXTURE_PAD 5
1162
1163#define _EVAS_COLOR_SPACE_ARGB 0
1164#define _EVAS_COLOR_SPACE_AHSV 1
1165
1166/*****************************************************************************/
1167
1168#define SCALE_SIZE_MAX ((1 << 15) - 1)
1169
1170#ifdef __cplusplus
1171extern "C" {
1172#endif
1173
1174/****/
1175void evas_common_init (void);
1176void evas_common_shutdown (void);
1177
1178EAPI void evas_common_cpu_init (void);
1179
1180int evas_common_cpu_have_cpuid (void);
1181int evas_common_cpu_has_feature (unsigned int feature);
1182EAPI void evas_common_cpu_can_do (int *mmx, int *sse, int *sse2);
1183EAPI void evas_common_cpu_end_opt (void);
1184
1185/****/
1186#include "../engines/common/evas_blend.h"
1187
1188EAPI Gfx_Func_Copy evas_common_draw_func_copy_get (int pixels, int reverse);
1189
1190/****/
1191#include "../engines/common/evas_convert_color.h"
1192#include "../engines/common/evas_convert_colorspace.h"
1193#include "../engines/common/evas_convert_main.h"
1194#include "../engines/common/evas_convert_yuv.h"
1195#include "../engines/common/evas_scale_main.h"
1196#include "../engines/common/evas_scale_smooth.h"
1197#include "../engines/common/evas_scale_span.h"
1198
1199/****/
1200#include "../engines/common/evas_image.h"
1201
1202/****/
1203#include "../engines/common/evas_line.h"
1204#include "../engines/common/evas_polygon.h"
1205#include "../engines/common/evas_rectangle.h"
1206
1207/****/
1208EAPI void evas_common_blit_init (void);
1209
1210EAPI void evas_common_blit_rectangle (const RGBA_Image *src, RGBA_Image *dst, int src_x, int src_y, int w, int h, int dst_x, int dst_y);
1211
1212/****/
1213#include "../engines/common/evas_font.h"
1214
1215/****/
1216EAPI void evas_common_tilebuf_init (void);
1217
1218EAPI Tilebuf *evas_common_tilebuf_new (int w, int h);
1219EAPI void evas_common_tilebuf_free (Tilebuf *tb);
1220EAPI void evas_common_tilebuf_set_tile_size (Tilebuf *tb, int tw, int th);
1221EAPI void evas_common_tilebuf_get_tile_size (Tilebuf *tb, int *tw, int *th);
1222EAPI int evas_common_tilebuf_add_redraw (Tilebuf *tb, int x, int y, int w, int h);
1223EAPI int evas_common_tilebuf_del_redraw (Tilebuf *tb, int x, int y, int w, int h);
1224EAPI int evas_common_tilebuf_add_motion_vector (Tilebuf *tb, int x, int y, int w, int h, int dx, int dy, int alpha);
1225EAPI void evas_common_tilebuf_clear (Tilebuf *tb);
1226EAPI Tilebuf_Rect *evas_common_tilebuf_get_render_rects (Tilebuf *tb);
1227EAPI void evas_common_tilebuf_free_render_rects (Tilebuf_Rect *rects);
1228
1229/*
1230Regionbuf *evas_common_regionbuf_new (int w, int h);
1231void evas_common_regionbuf_free (Regionbuf *rb);
1232void evas_common_regionbuf_clear (Regionbuf *rb);
1233void evas_common_regionbuf_span_add (Regionbuf *rb, int x1, int x2, int y);
1234void evas_common_regionbuf_span_del (Regionbuf *rb, int x1, int x2, int y);
1235Tilebuf_Rect *evas_common_regionbuf_rects_get (Regionbuf *rb);
1236*/
1237
1238/****/
1239#include "../engines/common/evas_draw.h"
1240
1241#include "../engines/common/evas_map_image.h"
1242
1243/****/
1244#ifdef BUILD_PIPE_RENDER
1245# include "../engines/common/evas_pipe.h"
1246#endif
1247
1248void evas_font_dir_cache_free(void);
1249
1250/****/
1251
1252/*****************************************************************************/
1253
1254#ifdef __cplusplus
1255}
1256#endif
1257
1258#endif