summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2006-11-13 23:23:44 +0000
committerCarsten Haitzler <raster@rasterman.com>2006-11-13 23:23:44 +0000
commit9781eb9b3841811efa5afff72d34001c44f2106c (patch)
tree3e7078ee2ac85d0647356ec7c80706b201466e20 /legacy/evas/src/lib
parent13ba0a5f57b6e9e0d036fa1af7e3131ede6f3aa0 (diff)
1. evas gets a pipeline with deferred rendering ability (sometimes faster,
sometimes slower) 2. --enable-pthreads will enable multi-threaded rendering (current support is for up to 4 threads so if you have a new fanled quad core or dual cpu dual core box or whatever you will in theory be able to max moe of its cpu grunt with the software rendering engine. this can only be done because i added the pipelines which means almsot entirely lock-free multithreading internally in evas. the only locks are for fonts but with a little work i might be able to remove some/most of those too) for now pthreaded rendering likely will be linux only (it relies on sched.h for setting scheduler params to force the slave threads to run on separate cpu's as linux likes to keep them on the same cpu otherwise and thus we get no speedups at all - only slowdowns). aso note that it is a bit of a mixed bag. complex ops (like smooth scaling with alpha blending) get speedups, but simple ops (like blits/fills) slow down. this all neds examination and tweaking still - but it's a start. SVN revision: 27098
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/lib/engines/common/Makefile.am3
-rw-r--r--legacy/evas/src/lib/engines/common/evas_cpu.c66
-rw-r--r--legacy/evas/src/lib/engines/common/evas_draw_main.c2
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_draw.c2
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_load.c8
-rw-r--r--legacy/evas/src/lib/engines/common/evas_gradient_main.c13
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_main.c30
-rw-r--r--legacy/evas/src/lib/engines/common/evas_pipe.c558
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_sample.c3
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_down.c6
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c8
-rw-r--r--legacy/evas/src/lib/include/evas_common.h146
12 files changed, 721 insertions, 124 deletions
diff --git a/legacy/evas/src/lib/engines/common/Makefile.am b/legacy/evas/src/lib/engines/common/Makefile.am
index 0bd7f1a97b..2fccfd5b0a 100644
--- a/legacy/evas/src/lib/engines/common/Makefile.am
+++ b/legacy/evas/src/lib/engines/common/Makefile.am
@@ -54,7 +54,8 @@ evas_scale_smooth.c \
54evas_scale_span.c \ 54evas_scale_span.c \
55evas_tiler.c \ 55evas_tiler.c \
56evas_regionbuf.c \ 56evas_regionbuf.c \
57evas_array_hash.c 57evas_array_hash.c \
58evas_pipe.c
58 59
59EXTRA_DIST = \ 60EXTRA_DIST = \
60evas_scale_smooth_scaler.c \ 61evas_scale_smooth_scaler.c \
diff --git a/legacy/evas/src/lib/engines/common/evas_cpu.c b/legacy/evas/src/lib/engines/common/evas_cpu.c
index 87ed7867b4..e0f7f1b002 100644
--- a/legacy/evas/src/lib/engines/common/evas_cpu.c
+++ b/legacy/evas/src/lib/engines/common/evas_cpu.c
@@ -208,52 +208,24 @@ evas_common_cpu_end_opt(void)
208} 208}
209#endif 209#endif
210 210
211#ifdef BUILD_PTHREAD 211EAPI int
212EAPI void 212evas_common_cpu_count(void)
213_evas_lk_init(Lk *l)
214{
215 pthread_mutext_init(&(l->mutex), NULL);
216 l->wlk_id = 0;
217// pthread_rwlock_init(&((x)->_reslock.rwl), NULL);
218}
219
220EAPI void
221_evas_lk_destroy(Lk *l)
222{
223 pthread_mutext_destroy(&(l->mutex), NULL);
224// pthread_rwlock_destroy(&((x)->_reslock.rwl));
225}
226
227EAPI void
228_evas_lk_read_lock(Lk *l)
229{
230 pthread_mutex_lock(&l->mutex);
231 pthread_mutex_unlock(&l->mutex);
232// pthread_rwlock_rdlock(&((x)->_reslock.rwl));
233}
234
235EAPI void
236_evas_lk_read_unlock(Lk *l)
237{ 213{
238 pthread_mutex_lock(&l->mutex); 214#ifdef BUILD_PTHREAD
239 pthread_mutex_unlock(&l->mutex); 215 cpu_set_t cpu;
240// pthread_rwlock_unlock(&((x)->_reslock.rwl)); 216 int i;
241} 217 static int cpus = 0;
242 218
243EAPI void 219 if (cpus != 0) return cpus;
244_evas_lk_write_lock(Lk *l) 220
245{ 221 sched_getaffinity(getpid(), sizeof(cpu), &cpu);
246 pthread_mutex_lock(&l->mutex); 222 for (i = 0; i < TH_MAX; i++)
247// pthread_self(); 223 {
248// pthread_equal(); 224 if (CPU_ISSET(i, &cpu)) cpus = i + 1;
249 pthread_mutex_unlock(&l->mutex); 225 else break;
250// pthread_rwlock_wrlock(&((x)->_reslock.rwl)); 226 }
251} 227 return cpus;
252 228#else
253EAPI void 229 return 1;
254_evas_lk_write_unlock(Lk *l) 230#endif
255{
256 pthread_mutex_lock(&l->mutex);
257 pthread_mutex_unlock(&l->mutex);
258} 231}
259#endif
diff --git a/legacy/evas/src/lib/engines/common/evas_draw_main.c b/legacy/evas/src/lib/engines/common/evas_draw_main.c
index 071195afd0..0516d61db0 100644
--- a/legacy/evas/src/lib/engines/common/evas_draw_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_draw_main.c
@@ -22,8 +22,6 @@ void
22evas_common_shutdown(void) 22evas_common_shutdown(void)
23{ 23{
24 evas_font_dir_cache_free(); 24 evas_font_dir_cache_free();
25 evas_common_image_line_buffer_free();
26 evas_common_image_alpha_line_buffer_free();
27 evas_common_image_cache_free(); 25 evas_common_image_cache_free();
28} 26}
29 27
diff --git a/legacy/evas/src/lib/engines/common/evas_font_draw.c b/legacy/evas/src/lib/engines/common/evas_font_draw.c
index ef9d5793b1..aae41df0e0 100644
--- a/legacy/evas/src/lib/engines/common/evas_font_draw.c
+++ b/legacy/evas/src/lib/engines/common/evas_font_draw.c
@@ -176,6 +176,7 @@ evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn, int
176 176
177 pen_x = x; 177 pen_x = x;
178 pen_y = y; 178 pen_y = y;
179 LKL(fn->lock);
179 evas_common_font_size_use(fn); 180 evas_common_font_size_use(fn);
180 use_kerning = FT_HAS_KERNING(fi->src->ft.face); 181 use_kerning = FT_HAS_KERNING(fi->src->ft.face);
181 prev_index = 0; 182 prev_index = 0;
@@ -338,4 +339,5 @@ evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn, int
338 pen_x += fg->glyph->advance.x >> 16; 339 pen_x += fg->glyph->advance.x >> 16;
339 prev_index = index; 340 prev_index = index;
340 } 341 }
342 LKU(fn->lock);
341} 343}
diff --git a/legacy/evas/src/lib/engines/common/evas_font_load.c b/legacy/evas/src/lib/engines/common/evas_font_load.c
index f96c773db8..995d455d11 100644
--- a/legacy/evas/src/lib/engines/common/evas_font_load.c
+++ b/legacy/evas/src/lib/engines/common/evas_font_load.c
@@ -265,6 +265,8 @@ evas_common_font_memory_load(const char *name, int size, const void *data, int d
265 fn->fonts = evas_list_append(fn->fonts, fi); 265 fn->fonts = evas_list_append(fn->fonts, fi);
266 fn->hinting = FONT_BYTECODE_HINT; 266 fn->hinting = FONT_BYTECODE_HINT;
267 fi->hinting = fn->hinting; 267 fi->hinting = fn->hinting;
268 fn->references = 1;
269 LKI(fn->lock);
268 return fn; 270 return fn;
269} 271}
270 272
@@ -301,7 +303,8 @@ evas_common_font_load(const char *name, int size)
301 fn->fonts = evas_list_append(fn->fonts, fi); 303 fn->fonts = evas_list_append(fn->fonts, fi);
302 fn->hinting = FONT_BYTECODE_HINT; 304 fn->hinting = FONT_BYTECODE_HINT;
303 fi->hinting = fn->hinting; 305 fi->hinting = fn->hinting;
304 306 fn->references = 1;
307 LKI(fn->lock);
305 return fn; 308 return fn;
306} 309}
307 310
@@ -346,6 +349,8 @@ evas_common_font_free(RGBA_Font *fn)
346 349
347 if (!fn) 350 if (!fn)
348 return; 351 return;
352 fn->references--;
353 if (fn->references > 0) return;
349 for (l = fn->fonts; l; l = l->next) 354 for (l = fn->fonts; l; l = l->next)
350 { 355 {
351 RGBA_Font_Int *fi; 356 RGBA_Font_Int *fi;
@@ -359,6 +364,7 @@ evas_common_font_free(RGBA_Font *fn)
359 } 364 }
360 } 365 }
361 evas_list_free(fn->fonts); 366 evas_list_free(fn->fonts);
367 LKD(fn->lock);
362 free(fn); 368 free(fn);
363} 369}
364 370
diff --git a/legacy/evas/src/lib/engines/common/evas_gradient_main.c b/legacy/evas/src/lib/engines/common/evas_gradient_main.c
index 727acffe0f..0f0c517238 100644
--- a/legacy/evas/src/lib/engines/common/evas_gradient_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_gradient_main.c
@@ -143,6 +143,7 @@ evas_common_gradient_new(void)
143 RGBA_Gradient *gr; 143 RGBA_Gradient *gr;
144 144
145 gr = calloc(1, sizeof(RGBA_Gradient)); 145 gr = calloc(1, sizeof(RGBA_Gradient));
146 gr->references = 1;
146 return gr; 147 return gr;
147} 148}
148 149
@@ -150,6 +151,8 @@ EAPI void
150evas_common_gradient_free(RGBA_Gradient *gr) 151evas_common_gradient_free(RGBA_Gradient *gr)
151{ 152{
152 if (!gr) return; 153 if (!gr) return;
154 gr->references--;
155 if (gr->references > 0) return;
153 evas_common_gradient_clear(gr); 156 evas_common_gradient_clear(gr);
154 if (gr->type.name) free(gr->type.name); 157 if (gr->type.name) free(gr->type.name);
155 if (gr->type.params) free(gr->type.params); 158 if (gr->type.params) free(gr->type.params);
@@ -481,7 +484,7 @@ evas_common_gradient_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
481 alpha_buf = evas_common_image_alpha_line_buffer_obtain(w); 484 alpha_buf = evas_common_image_alpha_line_buffer_obtain(w);
482 if (!alpha_buf) 485 if (!alpha_buf)
483 { 486 {
484 evas_common_image_line_buffer_release(); 487 evas_common_image_line_buffer_release(argb_buf);
485 return; 488 return;
486 } 489 }
487 bfunc = evas_common_gfx_func_composite_pixel_mask_span_get(argb_buf, dst, w, dc->render_op); 490 bfunc = evas_common_gfx_func_composite_pixel_mask_span_get(argb_buf, dst, w, dc->render_op);
@@ -496,9 +499,9 @@ evas_common_gradient_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
496 { 499 {
497 if (!direct_copy) 500 if (!direct_copy)
498 { 501 {
499 evas_common_image_line_buffer_release(); 502 evas_common_image_line_buffer_release(argb_buf);
500 if (alpha_buf) 503 if (alpha_buf)
501 evas_common_image_alpha_line_buffer_release(); 504 evas_common_image_alpha_line_buffer_release(alpha_buf);
502 } 505 }
503 return; 506 return;
504 } 507 }
@@ -534,9 +537,9 @@ evas_common_gradient_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
534 537
535 if (!direct_copy) 538 if (!direct_copy)
536 { 539 {
537 evas_common_image_line_buffer_release(); 540 evas_common_image_line_buffer_release(argb_buf);
538 if (alpha_buf) 541 if (alpha_buf)
539 evas_common_image_alpha_line_buffer_release(); 542 evas_common_image_alpha_line_buffer_release(alpha_buf);
540 } 543 }
541} 544}
542 545
diff --git a/legacy/evas/src/lib/engines/common/evas_image_main.c b/legacy/evas/src/lib/engines/common/evas_image_main.c
index 4a2e001793..780cc4052d 100644
--- a/legacy/evas/src/lib/engines/common/evas_image_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_image_main.c
@@ -257,12 +257,16 @@ evas_common_image_new(void)
257 im = calloc(1, sizeof(RGBA_Image)); 257 im = calloc(1, sizeof(RGBA_Image));
258 if (!im) return NULL; 258 if (!im) return NULL;
259 im->flags = RGBA_IMAGE_NOTHING; 259 im->flags = RGBA_IMAGE_NOTHING;
260 im->ref = 1;
260 return im; 261 return im;
261} 262}
262 263
263EAPI void 264EAPI void
264evas_common_image_free(RGBA_Image *im) 265evas_common_image_free(RGBA_Image *im)
265{ 266{
267 im->ref--;
268 if (im->ref > 0) return;
269 evas_common_pipe_free(im);
266 if (im->image) evas_common_image_surface_free(im->image); 270 if (im->image) evas_common_image_surface_free(im->image);
267 if (im->info.file) evas_stringshare_del(im->info.file); 271 if (im->info.file) evas_stringshare_del(im->info.file);
268// if (im->info.real_file) evas_stringshare_del(im->info.real_file); 272// if (im->info.real_file) evas_stringshare_del(im->info.real_file);
@@ -505,6 +509,8 @@ evas_common_image_line_buffer_obtain(int len)
505 if (len < 1) return NULL; 509 if (len < 1) return NULL;
506 if (len < EVAS_RGBA_LINE_BUFFER_MIN_LEN) 510 if (len < EVAS_RGBA_LINE_BUFFER_MIN_LEN)
507 len = EVAS_RGBA_LINE_BUFFER_MIN_LEN; 511 len = EVAS_RGBA_LINE_BUFFER_MIN_LEN;
512 return evas_common_image_create(len, 1);
513/*
508 if (evas_rgba_line_buffer) 514 if (evas_rgba_line_buffer)
509 { 515 {
510 if (evas_rgba_line_buffer->image->w >= len) 516 if (evas_rgba_line_buffer->image->w >= len)
@@ -522,11 +528,14 @@ evas_common_image_line_buffer_obtain(int len)
522 evas_rgba_line_buffer = evas_common_image_create(len, 1); 528 evas_rgba_line_buffer = evas_common_image_create(len, 1);
523 if (!evas_rgba_line_buffer) return NULL; 529 if (!evas_rgba_line_buffer) return NULL;
524 return evas_rgba_line_buffer; 530 return evas_rgba_line_buffer;
531 */
525} 532}
526 533
527EAPI void 534EAPI void
528evas_common_image_line_buffer_release(void) 535evas_common_image_line_buffer_release(RGBA_Image *im)
529{ 536{
537 evas_common_image_free(im);
538/*
530 if (!evas_rgba_line_buffer) return; 539 if (!evas_rgba_line_buffer) return;
531 if (EVAS_RGBA_LINE_BUFFER_MAX_LEN < evas_rgba_line_buffer->image->w) 540 if (EVAS_RGBA_LINE_BUFFER_MAX_LEN < evas_rgba_line_buffer->image->w)
532 { 541 {
@@ -539,14 +548,18 @@ evas_common_image_line_buffer_release(void)
539 evas_rgba_line_buffer = NULL; 548 evas_rgba_line_buffer = NULL;
540 } 549 }
541 } 550 }
551 */
542} 552}
543 553
544EAPI void 554EAPI void
545evas_common_image_line_buffer_free(void) 555evas_common_image_line_buffer_free(RGBA_Image *im)
546{ 556{
557 evas_common_image_free(im);
558/*
547 if (!evas_rgba_line_buffer) return; 559 if (!evas_rgba_line_buffer) return;
548 evas_common_image_free(evas_rgba_line_buffer); 560 evas_common_image_free(evas_rgba_line_buffer);
549 evas_rgba_line_buffer = NULL; 561 evas_rgba_line_buffer = NULL;
562 */
550} 563}
551 564
552EAPI RGBA_Image * 565EAPI RGBA_Image *
@@ -555,6 +568,8 @@ evas_common_image_alpha_line_buffer_obtain(int len)
555 if (len < 1) return NULL; 568 if (len < 1) return NULL;
556 if (len < EVAS_ALPHA_LINE_BUFFER_MIN_LEN) 569 if (len < EVAS_ALPHA_LINE_BUFFER_MIN_LEN)
557 len = EVAS_ALPHA_LINE_BUFFER_MIN_LEN; 570 len = EVAS_ALPHA_LINE_BUFFER_MIN_LEN;
571 return evas_common_image_alpha_create(len, 1);
572/*
558 if (evas_alpha_line_buffer) 573 if (evas_alpha_line_buffer)
559 { 574 {
560 if (evas_alpha_line_buffer->image->w >= len) 575 if (evas_alpha_line_buffer->image->w >= len)
@@ -571,11 +586,14 @@ evas_common_image_alpha_line_buffer_obtain(int len)
571 } 586 }
572 evas_alpha_line_buffer = evas_common_image_alpha_create(len, 1); 587 evas_alpha_line_buffer = evas_common_image_alpha_create(len, 1);
573 return evas_alpha_line_buffer; 588 return evas_alpha_line_buffer;
589 */
574} 590}
575 591
576EAPI void 592EAPI void
577evas_common_image_alpha_line_buffer_release(void) 593evas_common_image_alpha_line_buffer_release(RGBA_Image *im)
578{ 594{
595 evas_common_image_free(im);
596/*
579 if (!evas_alpha_line_buffer) return; 597 if (!evas_alpha_line_buffer) return;
580 if (EVAS_ALPHA_LINE_BUFFER_MAX_LEN < evas_alpha_line_buffer->image->w) 598 if (EVAS_ALPHA_LINE_BUFFER_MAX_LEN < evas_alpha_line_buffer->image->w)
581 { 599 {
@@ -588,14 +606,18 @@ evas_common_image_alpha_line_buffer_release(void)
588 evas_alpha_line_buffer = NULL; 606 evas_alpha_line_buffer = NULL;
589 } 607 }
590 } 608 }
609 */
591} 610}
592 611
593EAPI void 612EAPI void
594evas_common_image_alpha_line_buffer_free(void) 613evas_common_image_alpha_line_buffer_free(RGBA_Image *im)
595{ 614{
615 evas_common_image_free(im);
616/*
596 if (!evas_alpha_line_buffer) return; 617 if (!evas_alpha_line_buffer) return;
597 evas_common_image_free(evas_alpha_line_buffer); 618 evas_common_image_free(evas_alpha_line_buffer);
598 evas_alpha_line_buffer = NULL; 619 evas_alpha_line_buffer = NULL;
620 */
599} 621}
600 622
601EAPI void 623EAPI void
diff --git a/legacy/evas/src/lib/engines/common/evas_pipe.c b/legacy/evas/src/lib/engines/common/evas_pipe.c
new file mode 100644
index 0000000000..88eecb7597
--- /dev/null
+++ b/legacy/evas/src/lib/engines/common/evas_pipe.c
@@ -0,0 +1,558 @@
1#include "evas_common.h"
2
3static RGBA_Pipe *evas_common_pipe_add(RGBA_Pipe *pipe, RGBA_Pipe_Op **op);
4static void evas_common_pipe_draw_context_copy(RGBA_Draw_Context *dc, RGBA_Pipe_Op *op);
5static void evas_common_pipe_op_free(RGBA_Pipe_Op *op);
6
7/* utils */
8static RGBA_Pipe *
9evas_common_pipe_add(RGBA_Pipe *pipe, RGBA_Pipe_Op **op)
10{
11 RGBA_Pipe *p;
12 int first_pipe = 0;
13
14 if (!pipe)
15 {
16 first_pipe = 1;
17 p = calloc(1, sizeof(RGBA_Pipe));
18 if (!p) return NULL;
19 pipe = evas_object_list_append(pipe, p);
20 }
21 p = (RGBA_Pipe *)((Evas_Object_List *)pipe)->last;
22 if (p->op_num == PIPE_LEN)
23 {
24 p = calloc(1, sizeof(RGBA_Pipe));
25 if (!p) return NULL;
26 pipe = evas_object_list_append(pipe, p);
27 }
28 p->op_num++;
29 *op = &(p->op[p->op_num - 1]);
30 if (first_pipe)
31 {
32 /* FIXME: PTHREAD init any thread locks etc */
33 }
34 return pipe;
35}
36
37static void
38evas_common_pipe_draw_context_copy(RGBA_Draw_Context *dc, RGBA_Pipe_Op *op)
39{
40 Cutout_Rect *r, *r2;
41
42 memcpy(&(op->context), dc, sizeof(RGBA_Draw_Context));
43 op->context.cutout.rects = NULL;
44 for (r = dc->cutout.rects; r; r = (Cutout_Rect *)((Evas_Object_List *)r)->next)
45 {
46 r2 = calloc(1, sizeof(Cutout_Rect));
47 if (r2)
48 {
49 r2->x = r->x;
50 r2->y = r->y;
51 r2->w = r->w;
52 r2->h = r->h;
53 op->context.cutout.rects = evas_object_list_append(op->context.cutout.rects, r2);
54 }
55 }
56}
57
58static void
59evas_common_pipe_op_free(RGBA_Pipe_Op *op)
60{
61 evas_common_draw_context_apply_free_cutouts(op->context.cutout.rects);
62}
63
64/* main api calls */
65EAPI void
66evas_common_pipe_begin(RGBA_Image *im)
67{
68 /* FIXME: PTHREAD start any processing threads and lock - otherwise do
69 * nothing */
70}
71
72#ifdef BUILD_PTHREAD
73typedef struct _Thinfo
74{
75 int thread_num;
76 pthread_t thread_id;
77 pthread_barrier_t *barrier;
78 RGBA_Pipe_Thread_Info *info;
79} Thinfo;
80
81static void *
82evas_common_pipe_thread(void *data)
83{
84 Thinfo *thinfo;
85
86// printf("TH [...........\n");
87 thinfo = data;
88 for (;;)
89 {
90 RGBA_Pipe_Thread_Info *info;
91 RGBA_Pipe *p;
92
93 /* wait for start signal */
94// printf(" TH %i START...\n", thinfo->thread_num);
95 pthread_barrier_wait(&(thinfo->barrier[0]));
96 info = thinfo->info;
97// if (info)
98// {
99// thinfo->info = NULL;
100// printf(" TH %i GO\n", thinfo->thread_num);
101 for (p = info->im->pipe; p; p = (RGBA_Pipe *)((Evas_Object_List *)p)->next)
102 {
103 int i;
104
105 for (i = 0; i < p->op_num; i++)
106 {
107 if (p->op[i].op_func)
108 p->op[i].op_func(info->im, &(p->op[i]), info);
109 }
110 }
111 free(info);
112// }
113// printf(" TH %i DONE\n", thinfo->thread_num);
114 /* send finished signal */
115 pthread_barrier_wait(&(thinfo->barrier[1]));
116 }
117 return NULL;
118}
119#endif
120
121EAPI void
122evas_common_pipe_flush(RGBA_Image *im)
123{
124
125 RGBA_Pipe *p;
126 int i, y, h;
127
128 if (!im->pipe) return;
129#ifdef BUILD_PTHREAD
130 /* FIXME: PTHREAD join all threads here (if not finished) or begin then join
131 * otherwise just process pipe */
132 {
133 static int thread_num = 0;
134 static Thinfo thinfo[TH_MAX];
135 static pthread_barrier_t barrier[2];
136
137 if (thread_num == 0)
138 {
139 thread_num = evas_common_cpu_count();
140 pthread_barrier_init(&(barrier[0]), NULL, thread_num + 1);
141 for (i = 0; i < thread_num; i++)
142 {
143 pthread_attr_t attr;
144 cpu_set_t cpu;
145
146 pthread_attr_init(&attr);
147 CPU_ZERO(&cpu);
148 CPU_SET(i, &cpu);
149 pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu);
150 thinfo[i].thread_num = i;
151 thinfo[i].info = NULL;
152 thinfo[i].barrier = barrier;
153 /* setup initial locks */
154 pthread_create(&(thinfo[i].thread_id), &attr,
155 evas_common_pipe_thread, &(thinfo[i]));
156 }
157 }
158 y = 0;
159 h = im->image->h / thread_num;
160 if (h < 1) h = 1;
161 for (i = 0; i < thread_num; i++)
162 {
163 RGBA_Pipe_Thread_Info *info;
164
165// if (y >= im->image->h) break;
166 info = calloc(1, sizeof(RGBA_Pipe_Thread_Info));
167 info->im = im;
168 info->x = 0;
169 info->y = y;
170 info->w = im->image->w;
171 if (i == (thread_num - 1))
172 info->h = im->image->h - y;
173 else
174 info->h = h;
175 y += info->h;
176 thinfo[i].info = info;
177 /* send startsignal */
178// printf("START %i\n", i);
179 }
180 pthread_barrier_init(&(barrier[1]), NULL, thread_num + 1);
181 pthread_barrier_wait(&(barrier[0]));
182 pthread_barrier_destroy(&(barrier[0]));
183
184 pthread_barrier_init(&(barrier[0]), NULL, thread_num + 1);
185 pthread_barrier_wait(&(barrier[1]));
186 pthread_barrier_destroy(&(barrier[1]));
187// printf("DONE\n");
188 }
189
190#else
191 /* process pipe - 1 thead */
192 for (p = im->pipe; p; p = (RGBA_Pipe *)((Evas_Object_List *)p)->next)
193 {
194 for (i = 0; i < p->op_num; i++)
195 {
196 if (p->op[i].op_func)
197 p->op[i].op_func(im, &(p->op[i]), NULL);
198 }
199 }
200#endif
201 evas_common_cpu_end_opt();
202 evas_common_pipe_free(im);
203}
204
205EAPI void
206evas_common_pipe_free(RGBA_Image *im)
207{
208
209 RGBA_Pipe *p;
210 int i;
211
212 if (!im->pipe) return;
213 /* FIXME: PTHREAD join all threads here (if not finished)
214
215 /* free pipe */
216 while (im->pipe)
217 {
218 p = im->pipe;
219 for (i = 0; i < p->op_num; i++)
220 {
221 if (p->op[i].free_func)
222 p->op[i].free_func(&(p->op[i]));
223 }
224 im->pipe = evas_object_list_remove(im->pipe, p);
225 free(p);
226 }
227}
228
229
230
231/* draw ops */
232/**************** RECT ******************/
233static void
234evas_common_pipe_rectangle_draw_do(RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Thread_Info *info)
235{
236 if (info)
237 {
238 RGBA_Draw_Context context;
239
240 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
241 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h);
242 evas_common_rectangle_draw(dst, &(context),
243 op->op.rect.x, op->op.rect.y,
244 op->op.rect.w, op->op.rect.h);
245 }
246 else
247 evas_common_rectangle_draw(dst, &(op->context),
248 op->op.rect.x, op->op.rect.y,
249 op->op.rect.w, op->op.rect.h);
250}
251
252EAPI void
253evas_common_pipe_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
254 int x, int y, int w, int h)
255{
256 RGBA_Pipe_Op *op;
257
258 if ((w < 1) || (h < 1)) return;
259 dst->pipe = evas_common_pipe_add(dst->pipe, &op);
260 if (!dst->pipe) return;
261 op->op.rect.x = x;
262 op->op.rect.y = y;
263 op->op.rect.w = w;
264 op->op.rect.h = h;
265 op->op_func = evas_common_pipe_rectangle_draw_do;
266 op->free_func = evas_common_pipe_op_free;
267 evas_common_pipe_draw_context_copy(dc, op);
268}
269
270/**************** LINE ******************/
271static void
272evas_common_pipe_line_draw_do(RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Thread_Info *info)
273{
274 if (info)
275 {
276 RGBA_Draw_Context context;
277
278 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
279 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h);
280 evas_common_line_draw(dst, &(context),
281 op->op.line.x0, op->op.line.y0,
282 op->op.line.x1, op->op.line.y1);
283 }
284 else
285 evas_common_line_draw(dst, &(op->context),
286 op->op.line.x0, op->op.line.y0,
287 op->op.line.x1, op->op.line.y1);
288}
289
290EAPI void
291evas_common_pipe_line_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
292 int x0, int y0, int x1, int y1)
293{
294 RGBA_Pipe_Op *op;
295
296 dst->pipe = evas_common_pipe_add(dst->pipe, &op);
297 if (!dst->pipe) return;
298 op->op.line.x0 = x0;
299 op->op.line.y0 = y0;
300 op->op.line.x1 = x1;
301 op->op.line.y1 = y1;
302 op->op_func = evas_common_pipe_line_draw_do;
303 op->free_func = evas_common_pipe_op_free;
304 evas_common_pipe_draw_context_copy(dc, op);
305}
306
307/**************** POLY ******************/
308static void
309evas_common_pipe_op_poly_free(RGBA_Pipe_Op *op)
310{
311 RGBA_Polygon_Point *p;
312
313 while (op->op.poly.points)
314 {
315 p = op->op.poly.points;
316 op->op.poly.points = evas_object_list_remove(op->op.poly.points, p);
317 free(p);
318 }
319 evas_common_pipe_op_free(op);
320}
321
322static void
323evas_common_pipe_poly_draw_do(RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Thread_Info *info)
324{
325 if (info)
326 {
327 RGBA_Draw_Context context;
328
329 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
330 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h);
331 evas_common_polygon_draw(dst, &(context),
332 op->op.poly.points);
333 }
334 else
335 evas_common_polygon_draw(dst, &(op->context),
336 op->op.poly.points);
337}
338
339EAPI void
340evas_common_pipe_poly_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
341 RGBA_Polygon_Point *points)
342{
343 RGBA_Pipe_Op *op;
344 RGBA_Polygon_Point *pts = NULL, *p, *pp;
345
346 if (!points) return;
347 dst->pipe = evas_common_pipe_add(dst->pipe, &op);
348 if (!dst->pipe) return;
349 /* FIXME: copy points - maybe we should refcount? */
350 for (p = points; p; p = (RGBA_Polygon_Point *)((Evas_Object_List *)p)->next)
351 {
352 pp = calloc(1, sizeof(RGBA_Polygon_Point));
353 if (pp)
354 {
355 pp->x = p->x;
356 pp->y = p->y;
357 pts = evas_object_list_append(pts, pp);
358 }
359 }
360 op->op.poly.points = pts;
361 op->op_func = evas_common_pipe_poly_draw_do;
362 op->free_func = evas_common_pipe_op_poly_free;
363 evas_common_pipe_draw_context_copy(dc, op);
364}
365
366/**************** GRAD ******************/
367static void
368evas_common_pipe_op_grad_free(RGBA_Pipe_Op *op)
369{
370 evas_common_gradient_free(op->op.grad.grad);
371 evas_common_pipe_op_free(op);
372}
373
374static void
375evas_common_pipe_grad_draw_do(RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Thread_Info *info)
376{
377 if (info)
378 {
379 RGBA_Draw_Context context;
380
381 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
382 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h);
383 evas_common_gradient_draw(dst, &(context),
384 op->op.grad.x, op->op.grad.y,
385 op->op.grad.w, op->op.grad.h,
386 op->op.grad.grad);
387 }
388 else
389 evas_common_gradient_draw(dst, &(op->context),
390 op->op.grad.x, op->op.grad.y,
391 op->op.grad.w, op->op.grad.h,
392 op->op.grad.grad);
393}
394
395EAPI void
396evas_common_pipe_grad_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
397 int x, int y, int w, int h, RGBA_Gradient *gr)
398{
399 RGBA_Pipe_Op *op;
400
401 if (!gr) return;
402 dst->pipe = evas_common_pipe_add(dst->pipe, &op);
403 if (!dst->pipe) return;
404 op->op.grad.x = x;
405 op->op.grad.y = y;
406 op->op.grad.w = w;
407 op->op.grad.h = h;
408 gr->references++;
409 op->op.grad.grad = gr;
410 op->op_func = evas_common_pipe_grad_draw_do;
411 op->free_func = evas_common_pipe_op_grad_free;
412 evas_common_pipe_draw_context_copy(dc, op);
413}
414
415/**************** TEXT ******************/
416static void
417evas_common_pipe_op_text_free(RGBA_Pipe_Op *op)
418{
419 evas_common_font_free(op->op.text.font);
420 free(op->op.text.text);
421 evas_common_pipe_op_free(op);
422}
423
424static void
425evas_common_pipe_text_draw_do(RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Thread_Info *info)
426{
427 if (info)
428 {
429 RGBA_Draw_Context context;
430
431 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
432 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h);
433 evas_common_font_draw(dst, &(context),
434 op->op.text.font, op->op.text.x, op->op.text.y,
435 op->op.text.text);
436 }
437 else
438 evas_common_font_draw(dst, &(op->context),
439 op->op.text.font, op->op.text.x, op->op.text.y,
440 op->op.text.text);
441}
442
443EAPI void
444evas_common_pipe_text_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
445 RGBA_Font *fn, int x, int y, const char *text)
446{
447 RGBA_Pipe_Op *op;
448
449// return; /* FIXME: still need locks in fonts */
450 if ((!fn) || (!text)) return;
451 dst->pipe = evas_common_pipe_add(dst->pipe, &op);
452 if (!dst->pipe) return;
453 op->op.text.x = x;
454 op->op.text.y = y;
455 op->op.text.text = strdup(text);
456 fn->references++;
457 op->op.text.font = fn;
458 op->op_func = evas_common_pipe_text_draw_do;
459 op->free_func = evas_common_pipe_op_text_free;
460 evas_common_pipe_draw_context_copy(dc, op);
461}
462
463/**************** IMAGE *****************/
464static void
465evas_common_pipe_op_image_free(RGBA_Pipe_Op *op)
466{
467 evas_common_image_free(op->op.image.src);
468 evas_common_pipe_op_free(op);
469}
470
471static void
472evas_common_pipe_image_draw_do(RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Thread_Info *info)
473{
474 if (info)
475 {
476 RGBA_Draw_Context context;
477
478 memcpy(&(context), &(op->context), sizeof(RGBA_Draw_Context));
479 evas_common_draw_context_clip_clip(&(context), info->x, info->y, info->w, info->h);
480 if (op->op.image.smooth)
481 evas_common_scale_rgba_in_to_out_clip_smooth(op->op.image.src,
482 dst, &(context),
483 op->op.image.sx,
484 op->op.image.sy,
485 op->op.image.sw,
486 op->op.image.sh,
487 op->op.image.dx,
488 op->op.image.dy,
489 op->op.image.dw,
490 op->op.image.dh);
491 else
492 evas_common_scale_rgba_in_to_out_clip_sample(op->op.image.src,
493 dst, &(context),
494 op->op.image.sx,
495 op->op.image.sy,
496 op->op.image.sw,
497 op->op.image.sh,
498 op->op.image.dx,
499 op->op.image.dy,
500 op->op.image.dw,
501 op->op.image.dh);
502 }
503 else
504 {
505 if (op->op.image.smooth)
506 evas_common_scale_rgba_in_to_out_clip_smooth(op->op.image.src,
507 dst, &(op->context),
508 op->op.image.sx,
509 op->op.image.sy,
510 op->op.image.sw,
511 op->op.image.sh,
512 op->op.image.dx,
513 op->op.image.dy,
514 op->op.image.dw,
515 op->op.image.dh);
516 else
517 evas_common_scale_rgba_in_to_out_clip_sample(op->op.image.src,
518 dst, &(op->context),
519 op->op.image.sx,
520 op->op.image.sy,
521 op->op.image.sw,
522 op->op.image.sh,
523 op->op.image.dx,
524 op->op.image.dy,
525 op->op.image.dw,
526 op->op.image.dh);
527 }
528}
529
530EAPI void
531evas_common_pipe_image_draw(RGBA_Image *src, RGBA_Image *dst,
532 RGBA_Draw_Context *dc, int smooth,
533 int src_region_x, int src_region_y,
534 int src_region_w, int src_region_h,
535 int dst_region_x, int dst_region_y,
536 int dst_region_w, int dst_region_h)
537{
538 RGBA_Pipe_Op *op;
539
540 if (!src) return;
541// evas_common_pipe_flush(src);
542 dst->pipe = evas_common_pipe_add(dst->pipe, &op);
543 if (!dst->pipe) return;
544 op->op.image.smooth = smooth;
545 op->op.image.sx = src_region_x;
546 op->op.image.sy = src_region_y;
547 op->op.image.sw = src_region_w;
548 op->op.image.sh = src_region_h;
549 op->op.image.dx = dst_region_x;
550 op->op.image.dy = dst_region_y;
551 op->op.image.dw = dst_region_w;
552 op->op.image.dh = dst_region_h;
553 src->ref++;
554 op->op.image.src = src;
555 op->op_func = evas_common_pipe_image_draw_do;
556 op->free_func = evas_common_pipe_op_image_free;
557 evas_common_pipe_draw_context_copy(dc, op);
558}
diff --git a/legacy/evas/src/lib/engines/common/evas_scale_sample.c b/legacy/evas/src/lib/engines/common/evas_scale_sample.c
index 306997431b..c864e5d760 100644
--- a/legacy/evas/src/lib/engines/common/evas_scale_sample.c
+++ b/legacy/evas/src/lib/engines/common/evas_scale_sample.c
@@ -283,7 +283,7 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
283#endif 283#endif
284 { 284 {
285 /* a scanline buffer */ 285 /* a scanline buffer */
286 buf = malloc(dst_clip_w * sizeof(DATA32)); 286 buf = alloca(dst_clip_w * sizeof(DATA32));
287 if (!buf) goto no_buf; 287 if (!buf) goto no_buf;
288 288
289 for (y = 0; y < dst_clip_h; y++) 289 for (y = 0; y < dst_clip_h; y++)
@@ -299,7 +299,6 @@ scale_rgba_in_to_out_clip_sample_internal(RGBA_Image *src, RGBA_Image *dst,
299 func(buf, NULL, dc->mul.col, dptr, dst_clip_w); 299 func(buf, NULL, dc->mul.col, dptr, dst_clip_w);
300 dptr += dst_w; 300 dptr += dst_w;
301 } 301 }
302 free(buf);
303 } 302 }
304 } 303 }
305 304
diff --git a/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_down.c b/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_down.c
index bb1b785246..04d44f08f1 100644
--- a/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_down.c
+++ b/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_down.c
@@ -18,10 +18,7 @@
18 goto done_scale_down; 18 goto done_scale_down;
19 19
20 /* a scanline buffer */ 20 /* a scanline buffer */
21 line_buf = evas_common_image_line_buffer_obtain(dst_clip_w); 21 buf = alloca(dst_clip_w * sizeof(DATA32));
22 if (!line_buf)
23 goto done_scale_down;
24 buf = line_buf->image->data;
25 22
26 if (dc->mul.use) 23 if (dc->mul.use)
27 func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, dst_clip_w, dc->render_op); 24 func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, dst_clip_w, dc->render_op);
@@ -47,7 +44,6 @@
47 } 44 }
48 45
49 done_scale_down: 46 done_scale_down:
50 evas_common_image_line_buffer_release();
51 if (xpoints) free(xpoints); 47 if (xpoints) free(xpoints);
52 if (ypoints) free(ypoints); 48 if (ypoints) free(ypoints);
53 if (xapoints) free(xapoints); 49 if (xapoints) free(xapoints);
diff --git a/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c b/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c
index 91cf4c1c3c..8688af6d31 100644
--- a/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c
+++ b/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c
@@ -29,10 +29,7 @@
29 } 29 }
30 if (!direct_scale) 30 if (!direct_scale)
31 { 31 {
32 im_buf = evas_common_image_line_buffer_obtain(dst_clip_w); 32 buf = alloca(dst_clip_w * sizeof(DATA32));
33 if (!im_buf)
34 return;
35 buf = im_buf->image->data;
36 if (dc->mul.use) 33 if (dc->mul.use)
37 func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, dst_clip_w, dc->render_op); 34 func = evas_common_gfx_func_composite_pixel_color_span_get(src, dc->mul.col, dst, dst_clip_w, dc->render_op);
38 else 35 else
@@ -231,6 +228,5 @@
231 } 228 }
232 } 229 }
233 done_scale_up: 230 done_scale_up:
234 if (!direct_scale) 231 return;
235 evas_common_image_line_buffer_release();
236} 232}
diff --git a/legacy/evas/src/lib/include/evas_common.h b/legacy/evas/src/lib/include/evas_common.h
index 498f86b943..bea7276310 100644
--- a/legacy/evas/src/lib/include/evas_common.h
+++ b/legacy/evas/src/lib/include/evas_common.h
@@ -14,42 +14,26 @@
14 14
15#ifdef BUILD_PTHREAD 15#ifdef BUILD_PTHREAD
16# include <pthread.h> 16# include <pthread.h>
17typedef struct _Lk Lk; 17# include <sched.h>
18 18# define LK(x) pthread_mutex_t x
19struct _Lk 19# define LKI(x) pthread_mutex_init(&(x), NULL);
20{ 20# define LKD(x) pthread_mutex_destroy(&(x));
21 pthread_mutex_t mutex; // lock for read/write to this struct 21# define LKL(x) pthread_mutex_lock(&(x));
22 pthread_t wlk_id; // who has the write lock 22# define LKU(x) pthread_mutex_unlock(&(x));
23 int wlk_count; // how many times does the write lock have refs 23# define TH(x) pthread_t x
24 int rlk_count; // read lock count 24# define THI(x) int x
25// pthread_rwlock_t rwl; 25# define TH_MAX 4
26};
27
28# define ELK Lk _lk
29# define ELK_ADD(x) _evas_lk_init(&((x)->_lk))
30# define ELK_DEL(x) _evas_lk_destroy(&((x)->_lk))
31# define ELK_RLK(x) _evas_lk_read_lock(&((x)->_lk))
32# define ELK_WLK(x) _evas_lk_read_unlock(&((x)->_lk))
33# define ELK_RUL(x) _evas_lk_write_lock(&((x)->_lk))
34# define ELK_WUL(x) _evas_lk_write_unlock(&((x)->_lk))
35#else 26#else
36# define ELK 27# define LK(x)
37# define ELK_ADD(x) 28# define LKI(x)
38# define ELK_DEL(x) 29# define LKD(x)
39# define ELK_RLK(x) 30# define LKL(x)
40# define ELK_WLK(x) 31# define LKU(x)
41# define ELK_RUL(x) 32# define TH(x)
42# define ELK_WUL(x) 33# define THI(x)
34# define TH_MAX 0
43#endif 35#endif
44 36
45typedef struct _Glk Glk;
46
47struct _Glk
48{
49 ELK;
50 int _dummy;
51};
52
53#include <stdio.h> 37#include <stdio.h>
54#include <stdlib.h> 38#include <stdlib.h>
55#include <unistd.h> 39#include <unistd.h>
@@ -130,6 +114,9 @@ typedef struct _Evas_Object_List Evas_Object_List;
130typedef struct _Evas_Hash_El Evas_Hash_El; 114typedef struct _Evas_Hash_El Evas_Hash_El;
131 115
132typedef struct _RGBA_Image_Loadopts RGBA_Image_Loadopts; 116typedef struct _RGBA_Image_Loadopts RGBA_Image_Loadopts;
117typedef struct _RGBA_Pipe_Op RGBA_Pipe_Op;
118typedef struct _RGBA_Pipe RGBA_Pipe;
119typedef struct _RGBA_Pipe_Thread_Info RGBA_Pipe_Thread_Info;
133typedef struct _RGBA_Image RGBA_Image; 120typedef struct _RGBA_Image RGBA_Image;
134typedef struct _RGBA_Surface RGBA_Surface; 121typedef struct _RGBA_Surface RGBA_Surface;
135typedef struct _RGBA_Image_Span RGBA_Image_Span; 122typedef struct _RGBA_Image_Span RGBA_Image_Span;
@@ -280,6 +267,55 @@ struct _RGBA_Surface
280 RGBA_Image *im; 267 RGBA_Image *im;
281}; 268};
282 269
270struct _RGBA_Pipe_Op
271{
272 RGBA_Draw_Context context;
273 void (*op_func) (RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Thread_Info *info);
274 void (*free_func) (RGBA_Pipe_Op *op);
275
276 union {
277 struct {
278 int x, y, w, h;
279 } rect;
280 struct {
281 int x0, y0, x1, y1;
282 } line;
283 struct {
284 RGBA_Polygon_Point *points;
285 } poly;
286 struct {
287 RGBA_Gradient *grad;
288 int x, y, w, h;
289 } grad;
290 struct {
291 RGBA_Font *font;
292 int x, y;
293 char *text;
294 } text;
295 struct {
296 RGBA_Image *src;
297 int sx, sy, sw, sh, dx, dy, dw, dh;
298 int smooth;
299 char *text;
300 } image;
301 } op;
302};
303
304#define PIPE_LEN 256
305
306struct _RGBA_Pipe
307{
308 Evas_Object_List _list_data;
309 int op_num;
310 RGBA_Pipe_Op op[PIPE_LEN];
311};
312
313struct _RGBA_Pipe_Thread_Info
314{
315 RGBA_Image *im;
316 int x, y, w, h;
317};
318
283struct _RGBA_Image_Loadopts 319struct _RGBA_Image_Loadopts
284{ 320{
285 int scale_down_by; // if > 1 then use this 321 int scale_down_by; // if > 1 then use this
@@ -307,6 +343,8 @@ struct _RGBA_Image
307 void *extended_info; 343 void *extended_info;
308 RGBA_Image_Loadopts load_opts; 344 RGBA_Image_Loadopts load_opts;
309 unsigned char scale; 345 unsigned char scale;
346 RGBA_Pipe *pipe;
347 int ref;
310}; 348};
311 349
312struct _RGBA_Gradient_Color_Stop 350struct _RGBA_Gradient_Color_Stop
@@ -363,6 +401,8 @@ struct _RGBA_Gradient
363 RGBA_Gradient_Type *geometer; 401 RGBA_Gradient_Type *geometer;
364 void *gdata; 402 void *gdata;
365 } type; 403 } type;
404
405 int references;
366}; 406};
367 407
368struct _RGBA_Gradient_Type 408struct _RGBA_Gradient_Type
@@ -389,6 +429,8 @@ struct _RGBA_Font
389{ 429{
390 Evas_List *fonts; 430 Evas_List *fonts;
391 Font_Hint_Flags hinting; 431 Font_Hint_Flags hinting;
432 int references;
433 LK(lock);
392}; 434};
393 435
394struct _RGBA_Font_Int 436struct _RGBA_Font_Int
@@ -421,7 +463,6 @@ struct _RGBA_Font_Source
421 463
422 void *data; 464 void *data;
423 int data_size; 465 int data_size;
424
425 int current_size; 466 int current_size;
426 Evas_Array_Hash *charmap; 467 Evas_Array_Hash *charmap;
427 468
@@ -606,7 +647,8 @@ int evas_common_cpu_have_cpuid (void);
606int evas_common_cpu_has_feature (unsigned int feature); 647int evas_common_cpu_has_feature (unsigned int feature);
607EAPI void evas_common_cpu_can_do (int *mmx, int *sse, int *sse2); 648EAPI void evas_common_cpu_can_do (int *mmx, int *sse, int *sse2);
608EAPI void evas_common_cpu_end_opt (void); 649EAPI void evas_common_cpu_end_opt (void);
609 650EAPI int evas_common_cpu_count (void);
651
610/****/ 652/****/
611EAPI void evas_common_blend_init (void); 653EAPI void evas_common_blend_init (void);
612 654
@@ -777,12 +819,12 @@ EAPI int evas_common_image_ram_usage (RGBA_Image *im);
777EAPI void evas_common_image_dirty (RGBA_Image *im); 819EAPI void evas_common_image_dirty (RGBA_Image *im);
778 820
779EAPI RGBA_Image *evas_common_image_line_buffer_obtain (int len); 821EAPI RGBA_Image *evas_common_image_line_buffer_obtain (int len);
780EAPI void evas_common_image_line_buffer_release (void); 822EAPI void evas_common_image_line_buffer_release (RGBA_Image *im);
781EAPI void evas_common_image_line_buffer_free (void); 823EAPI void evas_common_image_line_buffer_free (RGBA_Image *im);
782 824
783EAPI RGBA_Image *evas_common_image_alpha_line_buffer_obtain (int len); 825EAPI RGBA_Image *evas_common_image_alpha_line_buffer_obtain (int len);
784EAPI void evas_common_image_alpha_line_buffer_release (void); 826EAPI void evas_common_image_alpha_line_buffer_release (RGBA_Image *im);
785EAPI void evas_common_image_alpha_line_buffer_free (void); 827EAPI void evas_common_image_alpha_line_buffer_free (RGBA_Image *im);
786 828
787/*done*/ 829/*done*/
788EAPI RGBA_Image *evas_common_load_image_from_file (const char *file, const char *key, RGBA_Image_Loadopts *lo); 830EAPI RGBA_Image *evas_common_load_image_from_file (const char *file, const char *key, RGBA_Image_Loadopts *lo);
@@ -939,6 +981,20 @@ EAPI void evas_common_draw_context_set_anti_alias (RGBA_Draw_Co
939EAPI void evas_common_draw_context_set_color_interpolation (RGBA_Draw_Context *dc, int color_space); 981EAPI void evas_common_draw_context_set_color_interpolation (RGBA_Draw_Context *dc, int color_space);
940EAPI void evas_common_draw_context_set_render_op (RGBA_Draw_Context *dc, int op); 982EAPI void evas_common_draw_context_set_render_op (RGBA_Draw_Context *dc, int op);
941 983
984/****/
985/* image rendering pipelines... new optional system - non-immediate and
986 * threadable
987 */
988EAPI void evas_common_pipe_begin(RGBA_Image *im);
989EAPI void evas_common_pipe_flush(RGBA_Image *im);
990EAPI void evas_common_pipe_free(RGBA_Image *im);
991EAPI void evas_common_pipe_rectangle_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h);
992EAPI void evas_common_pipe_line_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1);
993EAPI void evas_common_pipe_poly_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points);
994EAPI void evas_common_pipe_grad_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h, RGBA_Gradient *gr);
995EAPI void evas_common_pipe_text_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn, int x, int y, const char *text);
996EAPI void evas_common_pipe_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int smooth, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h);
997
942void evas_font_dir_cache_free(void); 998void evas_font_dir_cache_free(void);
943 999
944Evas_Array_Hash *evas_common_array_hash_new (void); 1000Evas_Array_Hash *evas_common_array_hash_new (void);
@@ -956,15 +1012,3 @@ void evas_stringshare_shutdown(void);
956#endif 1012#endif
957 1013
958#endif 1014#endif
959
960/* FIXME: need... */
961
962/* modular image loader system (from ram, or fd) */
963/* loaders: png, jpg, ppm, pgm, argb */
964/* finish renderers for lower bit depths & color allocator */
965
966/* and perhaps later on... */
967/* multiply pixels by pixels */
968/* oval / oval segment (arc) (filled/unfilled) */
969/* radial gradient fill */
970/* my own font renderer that can load bdf & pcf fonts? */