static Eina_List * _eina_rectangle_merge_list(Eina_List *empty, Eina_Rectangle *r) { Eina_Rectangle *match; Eina_List *l; int xw; int yh; if (r->w == 0 || r->h == 0) { eina_rectangle_free(r); return empty; } start_again: xw = r->x + r->w; yh = r->y + r->h; EINA_LIST_FOREACH(empty, l, match) { if (match->x == r->x && match->w == r->w && (match->y == yh || r->y == match->y + match->h)) { if (match->y > r->y) match->y = r->y; match->h += r->h; eina_rectangle_free(r); empty = eina_list_remove_list(empty, l); r = match; goto start_again; } else if (match->y == r->y && match->h == r->h && (match->x == xw || r->x == match->x + match->w)) { if (match->x > r->x) match->x = r->x; match->w += r->w; eina_rectangle_free(r); empty = eina_list_remove_list(empty, l); r = match; goto start_again; } } return eina_list_append(empty, r); }
void _evas_outbuf_free(Outbuf *ob) { LOGFN(__FILE__, __LINE__, __FUNCTION__); while (ob->priv.pending_writes) { RGBA_Image *img; Eina_Rectangle *rect; img = ob->priv.pending_writes->data; ob->priv.pending_writes = eina_list_remove_list(ob->priv.pending_writes, ob->priv.pending_writes); rect = img->extended_info; #ifdef EVAS_CSERVE2 if (evas_cserve2_use_get()) evas_cache2_image_close(&img->cache_entry); else #endif evas_cache_image_drop(&img->cache_entry); eina_rectangle_free(rect); } _evas_outbuf_flush(ob, NULL, MODE_FULL); _evas_outbuf_idle_flush(ob); if (ob->surface) _evas_shm_surface_destroy(ob->surface); eina_array_flush(&ob->priv.onebuf_regions); free(ob); }
static void _evas_swapper_buffer_put(Wl_Swapper *ws, Wl_Buffer *wb, Eina_Rectangle *rects, unsigned int count) { Eina_Rectangle *rect; LOGFN(__FILE__, __LINE__, __FUNCTION__); /* check for valid swapper */ if (!ws) return; /* make sure swapper has a surface */ if (!ws->surface) return; /* check for valid buffer */ if (!wb) return; /* make sure buffer has mapped data */ if ((!wb->data) || (!wb->buffer)) { /* call function to mmap buffer data */ /* if (!_evas_swapper_buffer_new(ws, wb)) */ return; } rect = eina_rectangle_new(0, 0, 0, 0); if ((rects) && (count > 0)) { unsigned int i = 0; for (i = 0; i < count; i++) eina_rectangle_union(rect, &rects[i]); } else { Eina_Rectangle r; r.x = 0; r.y = 0; r.w = wb->w; r.h = wb->h; eina_rectangle_union(rect, &r); } /* surface attach */ if (ws->buffer_sent != wb) { wl_surface_attach(ws->surface, wb->buffer, ws->dx, ws->dy); ws->dx = 0; ws->dy = 0; ws->buffer_sent = wb; } wl_surface_damage(ws->surface, rect->x, rect->y, rect->w, rect->h); /* surface commit */ wl_surface_commit(ws->surface); eina_rectangle_free(rect); }
RGBA_Image * evas_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) { RGBA_Image *img = NULL; if ((w <= 0) || (h <= 0)) return NULL; /* DBG("Outbuf Region New: %d %d %d %d", x, y, w, h); */ RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, ob->w, ob->h); if ((ob->rotation == 0) && (ob->depth == 32)) { Eina_Rectangle *rect; if (!(rect = eina_rectangle_new(x, y, w, h))) return NULL; #ifdef EVAS_CSERVE2 if (evas_cserve2_use_get()) img = (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get()); else #endif img = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); if (!img) { eina_rectangle_free(rect); return NULL; } img->cache_entry.flags.alpha = ob->destination_alpha; #ifdef EVAS_CSERVE2 if (evas_cserve2_use_get()) evas_cache2_image_surface_alloc(&img->cache_entry, w, h); else #endif evas_cache_image_surface_alloc(&img->cache_entry, w, h); img->extended_info = rect; if (cx) *cx = 0; if (cy) *cy = 0; if (cw) *cw = w; if (ch) *ch = h; /* add this cached image data to pending writes */ ob->priv.pending_writes = eina_list_append(ob->priv.pending_writes, img); } return img; }
void _evas_outbuf_idle_flush(Outbuf *ob) { RGBA_Image *img; Eina_Rectangle *rect; if (ob->priv.onebuf) { img = ob->priv.onebuf; ob->priv.onebuf = NULL; rect = img->extended_info; eina_rectangle_free(rect); #ifdef EVAS_CSERVE2 if (evas_cserve2_use_get()) evas_cache2_image_close(&img->cache_entry); else #endif evas_cache_image_drop(&img->cache_entry); } else { while (ob->priv.prev_pending_writes) { img = ob->priv.prev_pending_writes->data; ob->priv.prev_pending_writes = eina_list_remove_list(ob->priv.prev_pending_writes, ob->priv.prev_pending_writes); rect = img->extended_info; #ifdef EVAS_CSERVE2 if (evas_cserve2_use_get()) evas_cache2_image_close(&img->cache_entry); else #endif evas_cache_image_drop(&img->cache_entry); eina_rectangle_free(rect); } } }
PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool drawSelectionRect) { Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(browser->mainView())); Ewk_View_Private_Data* privateData = static_cast<Ewk_View_Private_Data*>(smartData->_priv); const Evas_Object* mainFrame = browser->mainFrame(); int x, y, width, height; if (!ewk_frame_visible_content_geometry_get(mainFrame, EINA_TRUE, &x, &y, &width, &height)) return 0; RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height)); RefPtr<cairo_t> context = adoptRef(cairo_create(surface.get())); const Eina_Rectangle rect = { x, y, width, height }; if (!ewk_view_paint(privateData, context.get(), &rect)) return 0; if (DumpRenderTreeSupportEfl::isTrackingRepaints(mainFrame)) { cairo_push_group(context.get()); // Paint the gray mask over the original image. cairo_set_source_rgba(context.get(), 0, 0, 0, 0.66); cairo_paint(context.get()); // Paint transparent rectangles over the mask to show the repainted regions. cairo_set_source_rgba(context.get(), 0, 0, 0, 0); cairo_set_operator(context.get(), CAIRO_OPERATOR_SOURCE); Eina_List* repaintRects = DumpRenderTreeSupportEfl::trackedRepaintRects(mainFrame); void* iter = 0; EINA_LIST_FREE(repaintRects, iter) { Eina_Rectangle* rect = static_cast<Eina_Rectangle*>(iter); cairo_rectangle(context.get(), rect->x, rect->y, rect->w, rect->h); cairo_fill(context.get()); eina_rectangle_free(rect); } cairo_pop_group_to_source(context.get()); cairo_paint(context.get()); }