summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-05-10 14:14:49 -0400
committerCedric BAIL <cedric.bail@free.fr>2019-08-08 18:32:27 -0700
commitcdaebfa0406b02974f5c68f1e87b467f2fb14bc8 (patch)
treefc24ef132e4461836af9e7867d255bf27c51d208 /src/lib
parent250777a16e5dc44c6aba4d2ce7ff5c76efb58df0 (diff)
evas/render: size and draw proxy render surface based on proxy clipper
if a proxy is not being proxied, it's optimal to create a surface for only the necessary dimensions and then only draw within those dimensions. when a proxy is clipped to a size smaller than the proxy object, the required size for the proxy render becomes smaller as the proxy has less visible area. this enables us to draw only the clipped region and thus gives a performance boost this can only be enabled if the clipper is marked as static Reviewed-by: Hermet Park <hermetpark@gmail.com> Differential Revision: https://phab.enlightenment.org/D8881
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/evas/canvas/evas_render.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index b0179ba7cf..4895517c1a 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -2312,10 +2312,10 @@ evas_render_proxy_subrender(Evas *eo_e, void *output, Evas_Object *eo_source, Ev
2312 Eina_Bool source_clip, Eina_Bool do_async) 2312 Eina_Bool source_clip, Eina_Bool do_async)
2313{ 2313{
2314 Evas_Public_Data *evas = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 2314 Evas_Public_Data *evas = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2315 Evas_Object_Protected_Data *source; 2315 Evas_Object_Protected_Data *source, *proxy;
2316 int level = 1; 2316 int level = 1;
2317 void *ctx; 2317 void *ctx;
2318 int w, h; 2318 int w, h, off_x = 0, off_y = 0;
2319 2319
2320#ifdef REND_DBG 2320#ifdef REND_DBG
2321 level = __RD_level; 2321 level = __RD_level;
@@ -2324,9 +2324,29 @@ evas_render_proxy_subrender(Evas *eo_e, void *output, Evas_Object *eo_source, Ev
2324 if (!eo_source) return; 2324 if (!eo_source) return;
2325 eina_evlog("+proxy_subrender", eo_proxy, 0.0, NULL); 2325 eina_evlog("+proxy_subrender", eo_proxy, 0.0, NULL);
2326 source = efl_data_scope_get(eo_source, EFL_CANVAS_OBJECT_CLASS); 2326 source = efl_data_scope_get(eo_source, EFL_CANVAS_OBJECT_CLASS);
2327 proxy = efl_data_scope_get(eo_proxy, EFL_CANVAS_OBJECT_CLASS);
2327 2328
2328 w = source->cur->geometry.w; 2329 if (proxy->proxy->proxies || (!proxy->cur->clipper) || (!proxy->cur->has_fixed_size))
2329 h = source->cur->geometry.h; 2330 {
2331 /* make full surface available if this proxy is being sampled from */
2332 w = source->cur->geometry.w;
2333 h = source->cur->geometry.h;
2334 }
2335 else
2336 {
2337 Eina_Rectangle clip = _evas_render_smallest_static_clipped_geometry_get(proxy->cur);
2338 /* nothing is using this proxy, so the proxy render surface can be sized
2339 * to fit exactly the proxy object's render size, and the proxy render will
2340 * naturally be clipped to this geometry
2341 */
2342 w = clip.w;
2343 h = clip.h;
2344 /* set the render offset for the proxy offset based on the geometry which will
2345 * be visible on the proxy surface after clipping
2346 */
2347 off_x = proxy->cur->geometry.x - clip.x;
2348 off_y = proxy->cur->geometry.y - clip.y;
2349 }
2330 2350
2331 RD(level, " proxy_subrender(source: %s, proxy: %s, %dx%d)\n", 2351 RD(level, " proxy_subrender(source: %s, proxy: %s, %dx%d)\n",
2332 RDNAME(source), RDNAME(proxy_obj), w, h); 2352 RDNAME(source), RDNAME(proxy_obj), w, h);
@@ -2379,8 +2399,8 @@ evas_render_proxy_subrender(Evas *eo_e, void *output, Evas_Object *eo_source, Ev
2379 ctx = ENFN->context_new(ENC); 2399 ctx = ENFN->context_new(ENC);
2380 evas_render_mapped(evas, eo_source, source, ctx, 2400 evas_render_mapped(evas, eo_source, source, ctx,
2381 output, proxy_write->surface, 2401 output, proxy_write->surface,
2382 -source->cur->geometry.x, 2402 -source->cur->geometry.x + off_x,
2383 -source->cur->geometry.y, 2403 -source->cur->geometry.y + off_y,
2384 level + 1, 0, 0, evas->output.w, evas->output.h, 2404 level + 1, 0, 0, evas->output.w, evas->output.h,
2385 &proxy_render_data, level + 1, do_async); 2405 &proxy_render_data, level + 1, do_async);
2386 ENFN->context_free(ENC, ctx); 2406 ENFN->context_free(ENC, ctx);