summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-10-23 15:27:40 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-11-12 17:11:49 +0900
commitfe677a0518b6b60f016d51ed6ceb4a1cf3f820a0 (patch)
treefde3e5016a2eb004905478a2bb920454502d3bd8 /src/lib/evas/canvas
parente21a40de9dfdebdcd3f350aa5e5104be35058675 (diff)
Evas: Use common function for proxy_subrender
Merges functions from: - filters - image object
Diffstat (limited to 'src/lib/evas/canvas')
-rw-r--r--src/lib/evas/canvas/evas_3d_texture.c2
-rw-r--r--src/lib/evas/canvas/evas_object_image.c87
-rw-r--r--src/lib/evas/canvas/evas_render.c82
3 files changed, 88 insertions, 83 deletions
diff --git a/src/lib/evas/canvas/evas_3d_texture.c b/src/lib/evas/canvas/evas_3d_texture.c
index 9f46167b44..b87d14373e 100644
--- a/src/lib/evas/canvas/evas_3d_texture.c
+++ b/src/lib/evas/canvas/evas_3d_texture.c
@@ -66,6 +66,8 @@ _texture_proxy_subrender(Evas_3D_Texture *obj)
66 if (!pd->source) 66 if (!pd->source)
67 return; 67 return;
68 68
69 // TODO: replace this function by evas_render_proxy_subrender (as appropriate)
70
69 source = eo_data_scope_get(pd->source, EVAS_OBJECT_CLASS); 71 source = eo_data_scope_get(pd->source, EVAS_OBJECT_CLASS);
70 72
71 is_image = eo_isa(pd->source, EVAS_IMAGE_CLASS); 73 is_image = eo_isa(pd->source, EVAS_IMAGE_CLASS);
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 99e7b8b4cf..03f422d0ba 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -2272,85 +2272,6 @@ _proxy_error(Evas_Object *eo_proxy, void *context, void *output, void *surface,
2272 return; 2272 return;
2273} 2273}
2274 2274
2275
2276/**
2277 * Render the source object when a proxy is set.
2278 *
2279 * Used to force a draw if necessary, else just makes sure it's available.
2280 */
2281static void
2282_proxy_subrender(Evas *eo_e, Evas_Object *eo_source, Evas_Object *eo_proxy, Evas_Object_Protected_Data *proxy_obj, Eina_Bool do_async)
2283{
2284 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2285 Evas_Object_Protected_Data *source;
2286 void *ctx;
2287 int w, h;
2288
2289 if (!eo_source) return;
2290 source = eo_data_scope_get(eo_source, EVAS_OBJECT_CLASS);
2291
2292 w = source->cur->geometry.w;
2293 h = source->cur->geometry.h;
2294
2295 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, source->proxy, Evas_Object_Proxy_Data, proxy_write)
2296 {
2297 proxy_write->redraw = EINA_FALSE;
2298
2299 /* We need to redraw surface then */
2300 if ((proxy_write->surface) &&
2301 ((proxy_write->w != w) || (proxy_write->h != h)))
2302 {
2303 e->engine.func->image_map_surface_free(e->engine.data.output,
2304 proxy_write->surface);
2305 proxy_write->surface = NULL;
2306 }
2307
2308 /* FIXME: Hardcoded alpha 'on' */
2309 /* FIXME (cont): Should see if the object has alpha */
2310 if (!proxy_write->surface)
2311 {
2312 proxy_write->surface = e->engine.func->image_map_surface_new
2313 (e->engine.data.output, w, h, 1);
2314 if (!proxy_write->surface) goto end;
2315 proxy_write->w = w;
2316 proxy_write->h = h;
2317 }
2318
2319 ctx = e->engine.func->context_new(e->engine.data.output);
2320 e->engine.func->context_color_set(e->engine.data.output, ctx, 0, 0,
2321 0, 0);
2322 e->engine.func->context_render_op_set(e->engine.data.output, ctx,
2323 EVAS_RENDER_COPY);
2324 e->engine.func->rectangle_draw(e->engine.data.output, ctx,
2325 proxy_write->surface, 0, 0, w, h,
2326 do_async);
2327 e->engine.func->context_free(e->engine.data.output, ctx);
2328
2329 ctx = e->engine.func->context_new(e->engine.data.output);
2330
2331 Eina_Bool source_clip = EINA_FALSE;
2332 eo_do(eo_proxy, source_clip = evas_obj_image_source_clip_get());
2333
2334 Evas_Proxy_Render_Data proxy_render_data = {
2335 .eo_proxy = eo_proxy,
2336 .proxy_obj = proxy_obj,
2337 .eo_src = eo_source,
2338 .source_clip = source_clip
2339 };
2340 evas_render_mapped(e, eo_source, source, ctx, proxy_write->surface,
2341 -source->cur->geometry.x,
2342 -source->cur->geometry.y,
2343 1, 0, 0, e->output.w, e->output.h,
2344 &proxy_render_data, 1, do_async);
2345
2346 e->engine.func->context_free(e->engine.data.output, ctx);
2347 proxy_write->surface = e->engine.func->image_dirty_region
2348 (e->engine.data.output, proxy_write->surface, 0, 0, w, h);
2349 }
2350 end:
2351 EINA_COW_WRITE_END(evas_object_proxy_cow, source->proxy, proxy_write);
2352}
2353
2354static void 2275static void
2355_3d_set(Evas_Object *eo_obj, Evas_3D_Scene *scene) 2276_3d_set(Evas_Object *eo_obj, Evas_3D_Scene *scene)
2356{ 2277{
@@ -3038,8 +2959,8 @@ evas_object_image_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, v
3038 else 2959 else
3039 { 2960 {
3040 o->proxyrendering = EINA_TRUE; 2961 o->proxyrendering = EINA_TRUE;
3041 _proxy_subrender(obj->layer->evas->evas, o->cur->source, eo_obj, obj, 2962 evas_render_proxy_subrender(obj->layer->evas->evas, o->cur->source,
3042 EINA_FALSE); 2963 eo_obj, obj, EINA_FALSE);
3043 pixels = source->proxy->surface; 2964 pixels = source->proxy->surface;
3044 imagew = source->proxy->w; 2965 imagew = source->proxy->w;
3045 imageh = source->proxy->h; 2966 imageh = source->proxy->h;
@@ -4109,8 +4030,8 @@ evas_object_image_is_inside(Evas_Object *eo_obj,
4109 else 4030 else
4110 { 4031 {
4111 o->proxyrendering = EINA_TRUE; 4032 o->proxyrendering = EINA_TRUE;
4112 _proxy_subrender(obj->layer->evas->evas, o->cur->source, eo_obj, obj, 4033 evas_render_proxy_subrender(obj->layer->evas->evas, o->cur->source,
4113 EINA_FALSE); 4034 eo_obj, obj, EINA_FALSE);
4114 pixels = source->proxy->surface; 4035 pixels = source->proxy->surface;
4115 imagew = source->proxy->w; 4036 imagew = source->proxy->w;
4116 imageh = source->proxy->h; 4037 imageh = source->proxy->h;
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index f36b2591a7..ea25d76642 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -1473,6 +1473,88 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
1473 return clean_them; 1473 return clean_them;
1474} 1474}
1475 1475
1476/*
1477 * Render the source object when a proxy is set.
1478 * Used to force a draw if necessary, else just makes sure it's available.
1479 * Called from: image objects and text with filters.
1480 * TODO: 3d objects subrender should probably be merged here as well.
1481 */
1482void
1483evas_render_proxy_subrender(Evas *eo_e, Evas_Object *eo_source, Evas_Object *eo_proxy,
1484 Evas_Object_Protected_Data *proxy_obj, Eina_Bool do_async)
1485{
1486 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
1487 Evas_Object_Protected_Data *source;
1488 Eina_Bool source_clip = EINA_FALSE;
1489 void *ctx;
1490 int w, h;
1491
1492 if (!eo_source) return;
1493 source = eo_data_scope_get(eo_source, EVAS_OBJECT_CLASS);
1494
1495 w = source->cur->geometry.w;
1496 h = source->cur->geometry.h;
1497
1498 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, source->proxy,
1499 Evas_Object_Proxy_Data, proxy_write)
1500 {
1501 proxy_write->redraw = EINA_FALSE;
1502
1503 /* We need to redraw surface then */
1504 if ((proxy_write->surface) &&
1505 ((proxy_write->w != w) || (proxy_write->h != h)))
1506 {
1507 e->engine.func->image_map_surface_free(e->engine.data.output,
1508 proxy_write->surface);
1509 proxy_write->surface = NULL;
1510 }
1511
1512 /* FIXME: Hardcoded alpha 'on' */
1513 /* FIXME (cont): Should see if the object has alpha */
1514 if (!proxy_write->surface)
1515 {
1516 proxy_write->surface = e->engine.func->image_map_surface_new
1517 (e->engine.data.output, w, h, 1);
1518 if (!proxy_write->surface) goto end;
1519 proxy_write->w = w;
1520 proxy_write->h = h;
1521 }
1522
1523 ctx = e->engine.func->context_new(e->engine.data.output);
1524 e->engine.func->context_color_set(e->engine.data.output, ctx, 0, 0,
1525 0, 0);
1526 e->engine.func->context_render_op_set(e->engine.data.output, ctx,
1527 EVAS_RENDER_COPY);
1528 e->engine.func->rectangle_draw(e->engine.data.output, ctx,
1529 proxy_write->surface, 0, 0, w, h,
1530 do_async);
1531 e->engine.func->context_free(e->engine.data.output, ctx);
1532
1533 ctx = e->engine.func->context_new(e->engine.data.output);
1534
1535 if (eo_isa(eo_proxy, EVAS_IMAGE_CLASS))
1536 eo_do(eo_proxy, source_clip = evas_obj_image_source_clip_get());
1537
1538 Evas_Proxy_Render_Data proxy_render_data = {
1539 .eo_proxy = eo_proxy,
1540 .proxy_obj = proxy_obj,
1541 .eo_src = eo_source,
1542 .source_clip = source_clip
1543 };
1544 evas_render_mapped(e, eo_source, source, ctx, proxy_write->surface,
1545 -source->cur->geometry.x,
1546 -source->cur->geometry.y,
1547 1, 0, 0, e->output.w, e->output.h,
1548 &proxy_render_data, 1, do_async);
1549
1550 e->engine.func->context_free(e->engine.data.output, ctx);
1551 proxy_write->surface = e->engine.func->image_dirty_region
1552 (e->engine.data.output, proxy_write->surface, 0, 0, w, h);
1553 }
1554 end:
1555 EINA_COW_WRITE_END(evas_object_proxy_cow, source->proxy, proxy_write);
1556}
1557
1476static void 1558static void
1477_evas_render_cutout_add(Evas_Public_Data *e, Evas_Object_Protected_Data *obj, int off_x, int off_y) 1559_evas_render_cutout_add(Evas_Public_Data *e, Evas_Object_Protected_Data *obj, int off_x, int off_y)
1478{ 1560{