summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-10 15:50:40 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-05 15:43:44 +0900
commit7d636630cfc5aeed8e2e1eaeb289e30113d0d6d4 (patch)
tree92273d009ea02a0bbd013b2cb59ed774edef77af
parent57902fffd3653ee3640185c7f637889af1a9a80a (diff)
Evas filters: Fix proxies following previous refactor
FIXME: - GL support is still shaky
-rw-r--r--src/lib/evas/filters/evas_filter.c111
-rw-r--r--src/lib/evas/filters/evas_filter_private.h4
2 files changed, 22 insertions, 93 deletions
diff --git a/src/lib/evas/filters/evas_filter.c b/src/lib/evas/filters/evas_filter.c
index 148a032176..a05037440b 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -108,66 +108,19 @@ _filter_buffer_backing_free(Evas_Filter_Buffer *fb)
108 fb->buffer = NULL; 108 fb->buffer = NULL;
109} 109}
110 110
111/* GL engine stuff: read-back from texture */
112static Eina_Bool
113_filter_buffer_glimage_pixels_read(Evas_Filter_Buffer *fb EINA_UNUSED, void *glimage EINA_UNUSED)
114{
115 CRI("not implemented");
116 return 0;
117
118#if 0
119 Eina_Bool ok;
120
121 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, EINA_FALSE);
122 EINA_SAFETY_ON_FALSE_RETURN_VAL(fb->ctx->gl_engine, EINA_FALSE);
123
124 if (fb->backing)
125 return EINA_TRUE;
126
127 EINA_SAFETY_ON_NULL_RETURN_VAL(fb->ENFN->gl_surface_lock, EINA_FALSE);
128 EINA_SAFETY_ON_NULL_RETURN_VAL(fb->ENFN->gl_surface_read_pixels, EINA_FALSE);
129 EINA_SAFETY_ON_NULL_RETURN_VAL(fb->ENFN->gl_surface_unlock, EINA_FALSE);
130
131 fb->buffer = _ector_buffer_create(fb, NULL);
132 EINA_SAFETY_ON_NULL_RETURN_VAL(fb->buffer, EINA_FALSE);
133
134 ok = fb->ENFN->gl_surface_lock(fb->ENDT, glimage);
135 if (!ok)
136 {
137 ERR("Failed to lock the image pixels");
138 return EINA_FALSE;
139 }
140
141 ok = fb->ENFN->gl_surface_read_pixels(fb->ENDT, glimage,
142 0, 0, fb->w, fb->h, fb->alpha_only
143 ? EVAS_COLORSPACE_GRY8
144 : EVAS_COLORSPACE_ARGB8888,
145 fb->backing->image.data);
146 if (!ok)
147 ERR("Could not read the image pixels!");
148
149 ok &= fb->ENFN->gl_surface_unlock(fb->ENDT, glimage);
150 return ok;
151#endif
152}
153
154/** @hidden private render proxy objects */ 111/** @hidden private render proxy objects */
155void 112void
156evas_filter_context_proxy_render_all(Evas_Filter_Context *ctx EINA_UNUSED, Eo *eo_obj EINA_UNUSED, 113evas_filter_context_proxy_render_all(Evas_Filter_Context *ctx, Eo *eo_obj,
157 Eina_Bool do_async EINA_UNUSED) 114 Eina_Bool do_async)
158{ 115{
159 CRI("not implemented");
160 return;
161
162#if 0
163 Evas_Object_Protected_Data *source; 116 Evas_Object_Protected_Data *source;
164 Evas_Object_Protected_Data *obj; 117 Evas_Object_Protected_Data *obj;
165 Evas_Filter_Buffer *fb; 118 Evas_Filter_Buffer *fb;
166 Eina_List *li; 119 Eina_List *li;
167 120
121 if (!ctx->has_proxies) return;
168 obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); 122 obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
169 123
170 if (!ctx->has_proxies) return;
171 EINA_LIST_FOREACH(ctx->buffers, li, fb) 124 EINA_LIST_FOREACH(ctx->buffers, li, fb)
172 if (fb->source) 125 if (fb->source)
173 { 126 {
@@ -188,17 +141,10 @@ evas_filter_context_proxy_render_all(Evas_Filter_Context *ctx EINA_UNUSED, Eo *e
188 evas_render_proxy_subrender(ctx->evas->evas, fb->source, eo_obj, obj, do_async); 141 evas_render_proxy_subrender(ctx->evas->evas, fb->source, eo_obj, obj, do_async);
189 } 142 }
190 _filter_buffer_backing_free(fb); 143 _filter_buffer_backing_free(fb);
191 if (!ctx->gl_engine) 144 XDBG("Source #%d '%s' has dimensions %dx%d", fb->id, fb->source_name, fb->w, fb->h);
192 fb->backing = ENFN->image_ref(ENDT, source->proxy->surface); 145 fb->buffer = ENFN->ector_buffer_wrap(ENDT, obj->layer->evas->evas, source->proxy->surface);
193 else
194 {
195 fb->glimage = ENFN->image_ref(ENDT, source->proxy->surface);
196 _filter_buffer_glimage_pixels_read(fb, fb->glimage);
197 }
198 fb->alpha_only = EINA_FALSE; 146 fb->alpha_only = EINA_FALSE;
199 XDBG("Source has dimensions %dx%d (buffer %d)", fb->w, fb->h, fb->id);
200 } 147 }
201#endif
202} 148}
203 149
204void 150void
@@ -1504,49 +1450,32 @@ evas_filter_font_draw(Evas_Filter_Context *ctx, void *draw_context, int bufid,
1504} 1450}
1505 1451
1506 1452
1507/* Image draw: glReadPixels or just use SW buffer */ 1453/* Image draw: scale and draw an original image into a RW surface */
1508Eina_Bool 1454Eina_Bool
1509evas_filter_image_draw(Evas_Filter_Context *ctx, void *draw_context, int bufid, 1455evas_filter_image_draw(Evas_Filter_Context *ctx, void *draw_context, int bufid,
1510 void *image, Eina_Bool do_async) 1456 void *image, Eina_Bool do_async)
1511{ 1457{
1512 int w = 0, h = 0; 1458 int dw = 0, dh = 0, w = 0, h = 0;
1459 Eina_Bool async_unref;
1460 void *surface;
1513 1461
1514 ENFN->image_size_get(ENDT, image, &w, &h); 1462 ENFN->image_size_get(ENDT, image, &w, &h);
1515 if (!w || !h) return EINA_FALSE; 1463 if (!w || !h) return EINA_FALSE;
1516 1464
1517 if (!ctx->gl_engine) 1465 surface = evas_filter_buffer_backing_get(ctx, bufid);
1518 { 1466 if (!surface) return EINA_FALSE;
1519 Eina_Bool async_unref;
1520 int dw = 0, dh = 0;
1521
1522 // Copy the image into our input buffer. We could optimize by reusing the buffer.
1523
1524 void *surface = evas_filter_buffer_backing_get(ctx, bufid);
1525 if (!surface) return EINA_FALSE;
1526
1527 ENFN->image_size_get(ENDT, image, &dw, &dh);
1528 if (!dw || !dh) return EINA_FALSE;
1529 1467
1530 if (w != dw || h != dh) 1468 ENFN->image_size_get(ENDT, image, &dw, &dh);
1531 WRN("Target surface size differs from the image to draw"); 1469 if (!dw || !dh) return EINA_FALSE;
1532 1470
1533 async_unref = ENFN->image_draw(ENDT, draw_context, surface, image, 1471 async_unref = ENFN->image_draw(ENDT, draw_context, surface, image,
1534 0, 0, w, h, 1472 0, 0, w, h,
1535 0, 0, dw, dh, 1473 0, 0, dw, dh,
1536 EINA_TRUE, do_async); 1474 EINA_TRUE, do_async);
1537 if (do_async && async_unref) 1475 if (do_async && async_unref)
1538 {
1539 ENFN->image_ref(ENDT, image);
1540 evas_unref_queue_image_put(ctx->evas, image);
1541 }
1542 }
1543 else
1544 { 1476 {
1545 Evas_Filter_Buffer *fb; 1477 ENFN->image_ref(ENDT, image);
1546 1478 evas_unref_queue_image_put(ctx->evas, image);
1547 fb = _filter_buffer_get(ctx, bufid);
1548 _filter_buffer_backing_free(fb);
1549 _filter_buffer_glimage_pixels_read(fb, image);
1550 } 1479 }
1551 1480
1552 return EINA_TRUE; 1481 return EINA_TRUE;
diff --git a/src/lib/evas/filters/evas_filter_private.h b/src/lib/evas/filters/evas_filter_private.h
index f3d7118be0..e5fbc3b3d3 100644
--- a/src/lib/evas/filters/evas_filter_private.h
+++ b/src/lib/evas/filters/evas_filter_private.h
@@ -8,9 +8,9 @@
8extern int _evas_filter_log_dom; 8extern int _evas_filter_log_dom;
9#define EVAS_FILTER_LOG_COLOR EINA_COLOR_LIGHTBLUE 9#define EVAS_FILTER_LOG_COLOR EINA_COLOR_LIGHTBLUE
10 10
11#ifdef DEBUG 11//#ifdef DEBUG
12# define FILTERS_DEBUG 12# define FILTERS_DEBUG
13#endif 13//#endif
14 14
15#ifdef ERR 15#ifdef ERR
16# undef ERR 16# undef ERR