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