void _icon_editor_gui_update() { char *tmp; Evas_Object *im_obj; void *im_data = NULL; int im_w = 0, im_h = 0; tmp = icon_editor_exec_get(); ewl_entry_text_set(EWL_ENTRY(editor->exec.entry), tmp); free(tmp); /* FIXME: set the name */ im_obj = EWL_IMAGE(editor->icon_image)->image; icon_editor_image_data_get(&im_data, &im_w, &im_h); if (!im_data) return; evas_object_image_size_set(im_obj, im_w, im_h); evas_object_image_data_copy_set(im_obj, im_data); evas_object_image_alpha_set(im_obj, 1); evas_object_image_data_update_add(im_obj, 0, 0, im_w, im_h); evas_object_image_fill_set(im_obj, 0, 0, im_w, im_h); printf("wxh: %d x %d\n", im_w, im_h); ewl_object_size_request(EWL_OBJECT(editor->icon_image), im_w, im_h); ewl_object_maximum_size_set(EWL_OBJECT(editor->icon_image), im_w, im_h); ewl_object_minimum_size_set(EWL_OBJECT(editor->icon_image), im_w, im_h); }
static inline void _ewk_view_single_scroll_process_single(Ewk_View_Smart_Data* smartData, void* pixels, Evas_Coord width, Evas_Coord height, const WebCore::IntSize& scrollOffset, const WebCore::IntRect& rectToScroll) { int scrollX = rectToScroll.x(); int scrollY = rectToScroll.y(); int scrollWidth = rectToScroll.width(); int scrollHeight = rectToScroll.height(); DBG("%d,%d + %d,%d %+03d,%+03d, store: %p %dx%d", scrollX, scrollY, scrollWidth, scrollHeight, scrollOffset.width(), scrollOffset.height(), pixels, width, height); if (abs(scrollOffset.width()) >= scrollWidth || abs(scrollOffset.height()) >= scrollHeight) { ewk_view_repaint_add(smartData->_priv, scrollX, scrollY, scrollWidth, scrollHeight); return; } if (scrollX < 0) { scrollWidth += scrollX; scrollX = 0; } if (scrollY < 0) { scrollHeight += scrollY; scrollY = 0; } if (scrollX + scrollWidth > width) scrollWidth = width - scrollX; if (scrollY + scrollHeight > height) scrollHeight = height - scrollY; if (scrollWidth <= 0 || scrollHeight <= 0) return; int sourceX = scrollOffset.width() < 0 ? abs(scrollOffset.width()) : 0; int sourceY = scrollOffset.height() < 0 ? abs(scrollOffset.height()) : 0; int destinationX = scrollOffset.width() < 0 ? 0 : scrollOffset.width(); int destinationY = scrollOffset.height() < 0 ? 0 : scrollOffset.height(); int copyWidth = scrollWidth - abs(scrollOffset.width()); int copyHeight = scrollHeight - abs(scrollOffset.height()); if (scrollOffset.width() || scrollOffset.height()) { _ewk_view_screen_move(static_cast<uint32_t*>(pixels), destinationX, destinationY, sourceX, sourceY, copyWidth, copyHeight, width); evas_object_image_data_update_add(smartData->backing_store, destinationX, destinationY, copyWidth, copyHeight); } Eina_Rectangle verticalUpdate; verticalUpdate.x = destinationX ? 0 : copyWidth - 1; verticalUpdate.y = 0; verticalUpdate.w = abs(scrollOffset.width()); verticalUpdate.h = scrollHeight; if (verticalUpdate.w && verticalUpdate.h) ewk_view_repaint_add(smartData->_priv, verticalUpdate.x, verticalUpdate.y, verticalUpdate.w, verticalUpdate.h); Eina_Rectangle horizontalUpdate; horizontalUpdate.x = destinationX; horizontalUpdate.y = destinationY ? 0 : copyHeight - 1; horizontalUpdate.w = copyWidth; horizontalUpdate.h = abs(scrollOffset.height()); if (horizontalUpdate.w && horizontalUpdate.h) ewk_view_repaint_add(smartData->_priv, horizontalUpdate.x, horizontalUpdate.y, horizontalUpdate.w, horizontalUpdate.h); }
void eps_page_render (const Eps_Page *page, Evas_Object *o) { unsigned char *data; unsigned char *d; unsigned int *m = NULL; double hscale; double vscale; SpectreStatus status; int width; int height; int stride; int yy; if (!page || !o) return; spectre_page_render (page->page, page->rc, &data, &stride); status = spectre_page_status (page->page); if (status != SPECTRE_STATUS_SUCCESS) { printf ("[eps] %s\n", spectre_status_to_string (status)); return; } eps_page_scale_get (page, &hscale, &vscale); eps_page_size_get (page, &width, &height); width *= hscale; height *= vscale; evas_object_image_size_set (o, width, height); evas_object_image_fill_set (o, 0, 0, width, height); m = (unsigned int *)evas_object_image_data_get (o, 1); if (!m) { free (data); return; } if (stride == 4 * width) memcpy(m, data, height * stride); else { d = data; for (yy = 0; yy < height; d += stride, m += width, ++yy) { memcpy (m, d, width * 4); } } evas_object_image_data_update_add (o, 0, 0, width, height); evas_object_resize (o, width, height); free (data); }
void eps_page_render_slice (const Eps_Page *page, Evas_Object *o, int x, int y, int width, int height) { unsigned char *data; unsigned char *d; unsigned int *m = NULL; double hscale; double vscale; SpectreStatus status; int stride; int yy; if (!page || !o || (width <= 0) || (height <= 0)) return; spectre_page_render_slice (page->page, page->rc, x, y, width, height, &data, &stride); status = spectre_page_status (page->page); if (status != SPECTRE_STATUS_SUCCESS) { printf ("aie !!%d %d %d %d %d\n", status, x, y, width, height); printf ("[eps] %s\n", spectre_status_to_string (status)); return; } eps_page_scale_get (page, &hscale, &vscale); width *= hscale; height *= vscale; evas_object_image_size_set (o, width, height); evas_object_image_fill_set (o, 0, 0, width, height); m = (unsigned int *)evas_object_image_data_get (o, 1); if (!m) { free (data); return; } d = data + y * stride + x; for (yy = 0; yy < height; d += stride, m += width, ++yy) { memcpy (m, d, width * 4); } evas_object_image_data_update_add (o, 0, 0, width, height); evas_object_resize (o, width, height); free (data); }
void _evas_object_bg_set (Evas_Object *o, int r, int g, int b) { unsigned int *m; int w, h; int i, j; evas_object_image_size_get (o, &w, &h); evas_object_image_fill_set (o, 0, 0, w, h); m = (unsigned int *)evas_object_image_data_get (o, 1); if (!m) return; for (j = 0; j < h; j++) { for (i = 0; i < w; i++) { m[j * w + i] = (255 << 24) | (r << 16) | (g << 8) | b; } } evas_object_image_data_update_add (o, 0, 0, w, h); evas_object_resize (o, w, h); }
static int EvasDisplayMainloopCb( vout_display_t *vd ) { vout_display_sys_t *sys = vd->sys; if( sys->b_evas_changed || sys->pf_set_data( vd ) ) return -1; evas_object_image_data_update_add( sys->p_evas, 0, 0, sys->i_width, sys->i_height ); evas_object_image_pixels_dirty_set( sys->p_evas, 0 ); if( !sys->p_anim ) sys->p_anim = ecore_animator_add( mainloop_evas_anim_cb, vd ); if( sys->p_current_buffer ) BUFFER_FIFO_PUSH( sys->p_current_buffer ); sys->p_current_buffer = sys->p_new_buffer; sys->p_new_buffer = NULL; return 0; }
void esmart_dvi_render (Evas_Object *obj) { Smart_Dvi *sp; E_SMART_OBJ_GET (sp, obj, E_OBJ_NAME); if (!sp->filename) return; if (sp->dvi_document) { if (sp->dvi_page) edvi_page_delete (sp->dvi_page); if (sp->obj) { unsigned int *m; int w; int h; sp->dvi_page = edvi_page_new (sp->dvi_document); edvi_page_size_get (sp->dvi_page, &w, &h); evas_object_image_size_set (sp->obj, w, h); evas_object_image_fill_set (sp->obj, 0, 0, w, h); m = (unsigned int *)evas_object_image_data_get (sp->obj, 1); if (!m) return; memset(m, (255 << 24) | (255 << 16) | (255 << 8) | 255, w * h * 4); evas_object_image_data_update_add (sp->obj, 0, 0, w, h); evas_object_resize (sp->obj, w, h); edvi_page_render (sp->dvi_page, sp->dvi_device, sp->obj); } evas_object_show (sp->obj); } }
static Eina_Bool _ewk_view_single_smart_repaints_process(Ewk_View_Smart_Data* smartData) { if (smartData->animated_zoom.zoom.current < 0.00001) { Evas_Object* clip = evas_object_clip_get(smartData->backing_store); // reset effects of zoom_weak_set() evas_object_image_fill_set(smartData->backing_store, 0, 0, smartData->view.w, smartData->view.h); evas_object_move(clip, smartData->view.x, smartData->view.y); Evas_Coord width = smartData->view.w; Evas_Coord height = smartData->view.h; Evas_Coord centerWidth, centerHeight; ewk_frame_contents_size_get(smartData->main_frame, ¢erWidth, ¢erHeight); if (width > centerWidth) width = centerWidth; if (height > centerHeight) height = centerHeight; evas_object_resize(clip, width, height); } Evas_Coord imageWidth, imageHeight; evas_object_image_size_get(smartData->backing_store, &imageWidth, &imageHeight); Eina_Tiler* tiler = eina_tiler_new(imageWidth, imageHeight); if (!tiler) { ERR("could not create tiler %dx%d", imageWidth, imageHeight); return false; } ewk_view_layout_if_needed_recursive(smartData->_priv); size_t count; const Eina_Rectangle* paintRequest = ewk_view_repaints_pop(smartData->_priv, &count); const Eina_Rectangle* paintRequestEnd = paintRequest + count; for (; paintRequest < paintRequestEnd; paintRequest++) eina_tiler_rect_add(tiler, paintRequest); Eina_Iterator* iterator = eina_tiler_iterator_new(tiler); if (!iterator) { ERR("could not get iterator for tiler"); eina_tiler_free(tiler); return false; } #if USE(TILED_BACKING_STORE) WebCore::Frame* mainFrame = EWKPrivate::coreFrame(smartData->main_frame); if (mainFrame && mainFrame->tiledBackingStore()) mainFrame->tiledBackingStore()->coverWithTilesIfNeeded(); #endif Ewk_Paint_Context* context = ewk_paint_context_from_image_new(smartData->backing_store); ewk_paint_context_save(context); Eina_Rectangle* rect; EINA_ITERATOR_FOREACH(iterator, rect) { ewk_view_paint(smartData->_priv, context, rect); evas_object_image_data_update_add(smartData->backing_store, rect->x, rect->y, rect->w, rect->h); }
static inline void _ewk_view_single_scroll_process_single(Ewk_View_Smart_Data* smartData, void* pixels, Evas_Coord width, Evas_Coord height, const Ewk_Scroll_Request* scrollRequest) { Evas_Coord scrollX, scrollY, scrollWidth, scrollHeight; DBG("%d,%d + %d,%d %+03d,%+03d, store: %p %dx%d", scrollRequest->x, scrollRequest->y, scrollRequest->w, scrollRequest->h, scrollRequest->dx, scrollRequest->dy, pixels, width, height); scrollX = scrollRequest->x; scrollY = scrollRequest->y; scrollWidth = scrollRequest->w; scrollHeight = scrollRequest->h; if (abs(scrollRequest->dx) >= scrollWidth || abs(scrollRequest->dy) >= scrollHeight) { /* doubt webkit would be so stupid... */ DBG("full page scroll %+03d,%+03d. convert to repaint %d,%d + %dx%d", scrollRequest->dx, scrollRequest->dy, scrollX, scrollY, scrollWidth, scrollHeight); ewk_view_repaint_add(smartData->_priv, scrollX, scrollY, scrollWidth, scrollHeight); return; } if (scrollX < 0) { scrollWidth += scrollX; scrollX = 0; } if (scrollY < 0) { scrollHeight += scrollY; scrollY = 0; } if (scrollX + scrollWidth > width) scrollWidth = width - scrollX; if (scrollY + scrollHeight > height) scrollHeight = height - scrollY; if (scrollWidth < 0) scrollWidth = 0; if (scrollHeight < 0) scrollHeight = 0; EINA_SAFETY_ON_TRUE_RETURN(!scrollWidth || !scrollHeight); int sourceX = scrollRequest->dx < 0 ? abs(scrollRequest->dx) : 0; int sourceY = scrollRequest->dy < 0 ? abs(scrollRequest->dy) : 0; int destinationX = scrollRequest->dx < 0 ? 0 : scrollRequest->dx; int destinationY = scrollRequest->dy < 0 ? 0 : scrollRequest->dy; int copyWidth = scrollWidth - abs(scrollRequest->dx); int copyHeight = scrollHeight - abs(scrollRequest->dy); if (scrollRequest->dx || scrollRequest->dy) { _ewk_view_screen_move(static_cast<uint32_t*>(pixels), destinationX, destinationY, sourceX, sourceY, copyWidth, copyHeight, width); evas_object_image_data_update_add(smartData->backing_store, destinationX, destinationY, copyWidth, copyHeight); } Eina_Rectangle verticalUpdate; verticalUpdate.x = destinationX ? 0 : copyWidth - 1; verticalUpdate.y = 0; verticalUpdate.w = abs(scrollRequest->dx); verticalUpdate.h = scrollHeight; if (verticalUpdate.w && verticalUpdate.h) ewk_view_repaint_add(smartData->_priv, verticalUpdate.x, verticalUpdate.y, verticalUpdate.w, verticalUpdate.h); Eina_Rectangle horizontalUpdate; horizontalUpdate.x = destinationX; horizontalUpdate.y = destinationY ? 0 : copyHeight - 1; horizontalUpdate.w = copyWidth; horizontalUpdate.h = abs(scrollRequest->dy); if (horizontalUpdate.w && horizontalUpdate.h) ewk_view_repaint_add(smartData->_priv, horizontalUpdate.x, horizontalUpdate.y, horizontalUpdate.w, horizontalUpdate.h); }
int captureScreen() { char dstpath[MAX_PATH_LENGTH]; char* scrimage; int width, height; Evas* ev = NULL; Evas_Object* img; screenshot_data sdata; probeInfo_t probeInfo; int ret = 0; static pthread_mutex_t captureScreenLock = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock(&captureScreenLock); probeBlockStart(); setProbePoint(&probeInfo); sdata.ximage = NULL; scrimage = captureScreenShotX(&width, &height, &sdata); if(scrimage != NULL) { ev = create_canvas(width, height); if(likely(ev != NULL)) { snprintf(dstpath, sizeof(dstpath), SCREENSHOT_DIRECTORY "/%d_%d.png", getpid(), probeInfo.eventIndex); // make image buffer if((img = evas_object_image_add(ev)) != NULL) { //image buffer set evas_object_image_data_set(img, NULL); evas_object_image_size_set(img, width, height); evas_object_image_data_set(img, scrimage); // resize image if(height > MAX_HEIGHT) { width = width * MAX_HEIGHT / height; height = MAX_HEIGHT; evas_object_resize(img, width, height); evas_object_image_fill_set(img, 0, 0, width, height); } evas_object_image_data_update_add(img, 0, 0, width, height); //save file if(evas_object_image_save(img, dstpath, NULL, "compress=5") != 0) { chmod(dstpath, 0777); /* welcome to the hell */ log_t log; PREPARE_LOCAL_BUF_THOUGH((char *)&log); /* skip header */ LOCAL_BUF += offsetof(log_t, data); /* pack screenshot name */ BUF_PTR = pack_string(LOCAL_BUF, dstpath); /* file name */ LOCAL_BUF = BUF_PTR; /* pack probe */ PACK_COMMON_BEGIN(MSG_PROBE_SCREENSHOT, API_ID_captureScreen, "", 0); PACK_COMMON_END('d', 0, 0, 0); PACK_SCREENSHOT(dstpath, getOrientation()); SET_MSG_LEN(); log.length = GET_MSG_LEN() + MSG_LEN_OFFSET + strlen(dstpath) + 1; /* send all message */ printLog(&log, MSG_IMAGE); } else { // captureScreen : evas_object_image_save failed ret = -1; } } else { // captureScreen : evas_object_image_add failed ret = -1; } } else { // captureScreen : create canvas failed ret = -1; } } else { // captureScreen : captureScreenShotX failed ret = -1; } // release resources releaseScreenShotX(&sdata); if(ev) destroy_canvas(ev); probeBlockEnd(); pthread_mutex_unlock(&captureScreenLock); return ret; }
static void _bumpmap(Efx_Bumpmap_Data *ebd) { Evas_Object *o; int w; int h; int i, j; int x; int y; int z; int depth; int red; int green; int blue; int ambient; double z_2, lightx, lighty; int mx; int my; unsigned int *d1; unsigned int *d2; unsigned int *src; unsigned int *mp; unsigned int *mpy; unsigned int *mpp; x = ebd->x; y = ebd->y; z = ebd->z; red = ebd->red / 0x100; green = ebd->green / 0x100; blue = ebd->blue / 0x100; ambient = ebd->ambient / 0x100; depth = ebd->depth / 0x100; depth /= (255 * (255 + 255 + 255)); z_2 = z * z; o = ebd->e->obj; evas_object_image_size_get(o, &w, &h); if ((!w) || (!h)) return; d1 = malloc(w * h * sizeof(int)); memcpy(d1, ebd->img_data, w * h * sizeof(int)); src = d1; d2 = malloc(w * h * sizeof(int)); memcpy(d2, ebd->img_data, w * h * sizeof(int)); mpp = d2; my = h; lighty = -y; for (j = h; --j >= 0;) { mp = mpp; mpp += w; if (--my <= 0) { mpp -= w * h; my = h; } mpy = mpp; mx = w; lightx = -x; i = w - 1; do { double x1, y_1, v; int r, g, b, gr; gr = A_VAL(mp) * (R_VAL(mp) + G_VAL(mp) + B_VAL(mp)); y_1 = depth * (double)(A_VAL(mpy) * (R_VAL(mpy) + G_VAL(mpy) + B_VAL(mpy)) - gr); mp++; mpy++; if (--mx <= 0) { mp -= w; mpy -= w; mx = w; } x1 = depth * (double)(A_VAL(mp) * (R_VAL(mp) + G_VAL(mp) + B_VAL(mp)) - gr); v = x1 * lightx + y_1 * lighty + z; v /= sqrt((x1 * x1) + (y_1 * y_1) + 1.0); v /= sqrt((lightx * lightx) + (lighty * lighty) + z_2); v += ambient; r = v * R_VAL(src) * red; g = v * G_VAL(src) * green; b = v * B_VAL(src) * blue; if (r < 0) r = 0; else if (r > 255) r = 255; if (g < 0) g = 0; else if (g > 255) g = 255; if (b < 0) b = 0; else if (b > 255) b = 255; R_VAL(src) = r; G_VAL(src) = g; B_VAL(src) = b; lightx++; src++; } while (--i >= 0); lighty++; } unsigned int *m; m = (unsigned int *)evas_object_image_data_get(o, 1); memcpy(m, d1, w * h * sizeof(unsigned int)); evas_object_image_data_set(o, m); evas_object_image_data_update_add(o, 0, 0, w, h); free(d1); free(d2); }
static Eina_Bool _ewk_view_single_smart_repaints_process(Ewk_View_Smart_Data *sd) { Ewk_View_Paint_Context *ctxt; Evas_Coord ow, oh; void *pixels; Eina_Rectangle r = {0, 0, 0, 0}; const Eina_Rectangle *pr; const Eina_Rectangle *pr_end; Eina_Tiler *tiler; Eina_Iterator *itr; cairo_status_t status; cairo_surface_t *surface; cairo_format_t format; cairo_t *cairo; size_t count; Eina_Bool ret = EINA_TRUE; if (sd->animated_zoom.zoom.current < 0.00001) { Evas_Object *clip = evas_object_clip_get(sd->backing_store); Evas_Coord w, h, cw, ch; // reset effects of zoom_weak_set() evas_object_image_fill_set (sd->backing_store, 0, 0, sd->view.w, sd->view.h); evas_object_move(clip, sd->view.x, sd->view.y); w = sd->view.w; h = sd->view.h; ewk_frame_contents_size_get(sd->main_frame, &cw, &ch); if (w > cw) w = cw; if (h > ch) h = ch; evas_object_resize(clip, w, h); } pixels = evas_object_image_data_get(sd->backing_store, 1); evas_object_image_size_get(sd->backing_store, &ow, &oh); if (sd->bg_color.a < 255) format = CAIRO_FORMAT_ARGB32; else format = CAIRO_FORMAT_RGB24; surface = cairo_image_surface_create_for_data ((unsigned char*)pixels, format, ow, oh, ow * 4); status = cairo_surface_status(surface); if (status != CAIRO_STATUS_SUCCESS) { ERR("could not create surface from data %dx%d: %s", ow, oh, cairo_status_to_string(status)); ret = EINA_FALSE; goto error_cairo_surface; } cairo = cairo_create(surface); status = cairo_status(cairo); if (status != CAIRO_STATUS_SUCCESS) { ERR("could not create cairo from surface %dx%d: %s", ow, oh, cairo_status_to_string(status)); ret = EINA_FALSE; goto error_cairo; } ctxt = ewk_view_paint_context_new(sd->_priv, cairo); if (!ctxt) { ERR("could not create paint context"); ret = EINA_FALSE; goto error_paint_context; } tiler = eina_tiler_new(ow, oh); if (!tiler) { ERR("could not create tiler %dx%d", ow, oh); ret = EINA_FALSE; goto error_tiler; } pr = ewk_view_repaints_get(sd->_priv, &count); pr_end = pr + count; for (; pr < pr_end; pr++) eina_tiler_rect_add(tiler, pr); itr = eina_tiler_iterator_new(tiler); if (!itr) { ERR("could not get iterator for tiler"); ret = EINA_FALSE; goto error_iterator; } int sx, sy; ewk_frame_scroll_pos_get(sd->main_frame, &sx, &sy); EINA_ITERATOR_FOREACH(itr, r) { Eina_Rectangle scrolled_rect = { r.x + sx, r.y + sy, r.w, r.h }; ewk_view_paint_context_save(ctxt); if ((sx) || (sy)) ewk_view_paint_context_translate(ctxt, -sx, -sy); ewk_view_paint_context_clip(ctxt, &scrolled_rect); ewk_view_paint_context_paint_contents(ctxt, &scrolled_rect); ewk_view_paint_context_restore(ctxt); evas_object_image_data_update_add (sd->backing_store, r.x, r.y, r.w, r.h); }
static inline void _ewk_view_single_scroll_process_single(Ewk_View_Smart_Data *sd, void *pixels, Evas_Coord ow, Evas_Coord oh, const Ewk_Scroll_Request *sr) { Evas_Coord sx, sy, sw, sh; DBG("%d,%d + %d,%d %+03d,%+03d, store: %p %dx%d", sr->x, sr->y, sr->w, sr->h, sr->dx, sr->dy, pixels, ow, oh); sx = sr->x; sy = sr->y; sw = sr->w; sh = sr->h; if (abs(sr->dx) >= sw || abs(sr->dy) >= sh) { /* doubt webkit would be so stupid... */ DBG("full page scroll %+03d,%+03d. convert to repaint %d,%d + %dx%d", sr->dx, sr->dy, sx, sy, sw, sh); ewk_view_repaint_add(sd->_priv, sx, sy, sw, sh); return; } if (sx < 0) { sw += sx; sx = 0; } if (sy < 0) { sh += sy; sy = 0; } if (sx + sw > ow) sw = ow - sx; if (sy + sh > oh) sh = oh - sy; if (sw < 0) sw = 0; if (sh < 0) sh = 0; EINA_SAFETY_ON_TRUE_RETURN(!sw || !sh); if (!sr->dx) { if (sr->dy < 0) { DBG("scroll up: %+03d,%+03d update=%d,%d+%dx%d, " "repaint=%d,%d+%dx%d", sr->dx, sr->dy, sx, sy, sw, sh + sr->dy, sx, sy + sh + sr->dy, sw, -sr->dy); _ewk_view_4b_move_region_up ((uint32_t*)pixels, -sr->dy, sx, sy, sw, sh, ow); evas_object_image_data_update_add (sd->backing_store, sx, sy, sw, sh + sr->dy); ewk_view_repaint_add(sd->_priv, sx, sy + sh + sr->dy, sw, -sr->dy); } else if (sr->dy > 0) { DBG("scroll down: %+03d,%+03d update=%d,%d+%dx%d, " "repaint=%d,%d+%dx%d", sr->dx, sr->dy, sx, sy + sr->dy, sw, sh - sr->dy, sx, sy, sw, sr->dy); _ewk_view_4b_move_region_down ((uint32_t*)pixels, sr->dy, sx, sy, sw, sh, ow); evas_object_image_data_update_add (sd->backing_store, sx, sy + sr->dy, sw, sh - sr->dy); ewk_view_repaint_add(sd->_priv, sx, sy, sw, sr->dy); } } else if (!sr->dy) { if (sr->dx < 0) { DBG("scroll left: %+03d,%+03d update=%d,%d+%dx%d, " "repaint=%d,%d+%dx%d", sr->dx, sr->dy, sx, sy, sw + sr->dx, sh, sx + sw + sr->dx, sy, -sr->dx, sh); _ewk_view_4b_move_region_left ((uint32_t*)pixels, -sr->dx, sx, sy, sw, sh, ow); evas_object_image_data_update_add (sd->backing_store, sx, sy, sw + sr->dx, sh); ewk_view_repaint_add(sd->_priv, sx + sw + sr->dx, sy, -sr->dx, sh); } else if (sr->dx > 0) { DBG("scroll up: %+03d,%+03d update=%d,%d+%dx%d, " "repaint=%d,%d+%dx%d", sr->dx, sr->dy, sx + sr->dx, sy, sw - sr->dx, sh, sx, sy, sr->dx, sh); _ewk_view_4b_move_region_right ((uint32_t*)pixels, sr->dx, sx, sy, sw, sh, ow); evas_object_image_data_update_add (sd->backing_store, sx + sr->dx, sy, sw - sr->dx, sh); ewk_view_repaint_add(sd->_priv, sx, sy, sr->dx, sh); } } else { Evas_Coord mx, my, mw, mh, ax, ay, aw, ah, bx, by, bw, bh; if (sr->dx < 0) { mx = sx; mw = sw + sr->dx; ax = mx + mw; aw = -sr->dx; } else { ax = sx; aw = sr->dx; mx = ax + aw; mw = sw - sr->dx; } if (sr->dy < 0) { my = sy; mh = sh + sr->dy; by = my + mh; bh = -sr->dy; } else { by = sy; bh = sr->dy; my = by + bh; mh = sh - sr->dy; } ay = my; ah = mh; bx = sx; bw = sw; DBG("scroll diagonal: %+03d,%+03d update=%d,%d+%dx%d, " "repaints: h=%d,%d+%dx%d v=%d,%d+%dx%d", sr->dx, sr->dy, mx, my, mw, mh, ax, ay, aw, ah, bx, by, bw, bh); _ewk_view_4b_move_region ((uint32_t*)pixels, sr->dx, sr->dy, sx, sy, sw, sh, ow); evas_object_image_data_update_add(sd->backing_store, mx, my, mw, mh); ewk_view_repaint_add(sd->_priv, ax, ay, aw, ah); ewk_view_repaint_add(sd->_priv, bx, by, bw, bh); } }
void epdf_page_render (Epdf_Page *page, Evas_Object *o) { SplashOutputDev *output_dev; SplashColor white; SplashColorPtr color_ptr; Epdf_Document *doc; unsigned int *m = NULL; double hscale; double vscale; int rotate; int width; int height; double t1,t2; t1 = ecore_time_get(); white[0] = 255; white[1] = 255; white[2] = 255; white[3] = 255; if (!page->page || !page->page->isOk ()) return; doc = page->doc; output_dev = new SplashOutputDev(splashModeXBGR8, 4, gFalse, white); output_dev->startDoc(doc->pdfdoc->getXRef ()); switch (page->orientation) { case EPDF_PAGE_ORIENTATION_LANDSCAPE: rotate = 90; break; case EPDF_PAGE_ORIENTATION_UPSIDEDOWN: rotate = 180; break; case EPDF_PAGE_ORIENTATION_SEASCAPE: rotate = 270; break; case EPDF_PAGE_ORIENTATION_PORTRAIT: default: rotate = 0; break; } epdf_page_scale_get (page, &hscale, &vscale); page->page->display (output_dev, 72.0 * hscale, 72.0 * vscale, rotate, false, false, false, doc->pdfdoc->getCatalog ()); color_ptr = output_dev->getBitmap ()->getDataPtr (); width = output_dev->getBitmap()->getWidth(); height = output_dev->getBitmap()->getHeight(); evas_object_image_size_set(o, width, height); evas_object_image_fill_set(o, 0, 0, width, height); m = (unsigned int *)evas_object_image_data_get(o, 1); if (!m) goto sortie; memcpy (m, color_ptr, height * width * 4); evas_object_image_data_set(o, m); evas_object_image_data_update_add(o, 0, 0, width, height); evas_object_resize(o, width, height); // evas_object_image_alpha_set (o, 0); sortie: delete output_dev; t2 = ecore_time_get(); printf ("time poppler: %f\n", t2-t1); }
void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect) { evas_object_image_data_update_add(m_viewObject, rect.x(), rect.y(), rect.width(), rect.height()); }
static Eina_Bool _ewk_view_single_smart_repaints_process(Ewk_View_Smart_Data* smartData) { Ewk_View_Paint_Context* context; Evas_Coord ow, oh; void* pixels; Eina_Rectangle* rect; const Eina_Rectangle* pr; const Eina_Rectangle* pr_end; Eina_Tiler* tiler; Eina_Iterator* iterator; cairo_status_t status; cairo_surface_t* surface; cairo_format_t format; cairo_t* cairo; size_t count; Eina_Bool result = true; if (smartData->animated_zoom.zoom.current < 0.00001) { Evas_Object* clip = evas_object_clip_get(smartData->backing_store); Evas_Coord width, height, centerWidth, centerHeight; // reset effects of zoom_weak_set() evas_object_image_fill_set (smartData->backing_store, 0, 0, smartData->view.w, smartData->view.h); evas_object_move(clip, smartData->view.x, smartData->view.y); width = smartData->view.w; height = smartData->view.h; ewk_frame_contents_size_get(smartData->main_frame, ¢erWidth, ¢erHeight); if (width > centerWidth) width = centerWidth; if (height > centerHeight) height = centerHeight; evas_object_resize(clip, width, height); } pixels = evas_object_image_data_get(smartData->backing_store, 1); evas_object_image_size_get(smartData->backing_store, &ow, &oh); format = CAIRO_FORMAT_ARGB32; surface = cairo_image_surface_create_for_data (static_cast<unsigned char*>(pixels), format, ow, oh, ow * 4); status = cairo_surface_status(surface); if (status != CAIRO_STATUS_SUCCESS) { ERR("could not create surface from data %dx%d: %s", ow, oh, cairo_status_to_string(status)); result = false; goto error_cairo_surface; } cairo = cairo_create(surface); status = cairo_status(cairo); if (status != CAIRO_STATUS_SUCCESS) { ERR("could not create cairo from surface %dx%d: %s", ow, oh, cairo_status_to_string(status)); result = false; goto error_cairo; } context = ewk_view_paint_context_new(smartData->_priv, cairo); if (!context) { ERR("could not create paint context"); result = false; goto error_paint_context; } tiler = eina_tiler_new(ow, oh); if (!tiler) { ERR("could not create tiler %dx%d", ow, oh); result = false; goto error_tiler; } ewk_view_layout_if_needed_recursive(smartData->_priv); pr = ewk_view_repaints_pop(smartData->_priv, &count); pr_end = pr + count; for (; pr < pr_end; pr++) eina_tiler_rect_add(tiler, pr); iterator = eina_tiler_iterator_new(tiler); if (!iterator) { ERR("could not get iterator for tiler"); result = false; goto error_iterator; } int scrollX, scrollY; ewk_frame_scroll_pos_get(smartData->main_frame, &scrollX, &scrollY); EINA_ITERATOR_FOREACH(iterator, rect) { Eina_Rectangle scrolled_rect = { rect->x + scrollX, rect->y + scrollY, rect->w, rect->h }; ewk_view_paint_context_save(context); if ((scrollX) || (scrollY)) ewk_view_paint_context_translate(context, -scrollX, -scrollY); ewk_view_paint_context_clip(context, &scrolled_rect); ewk_view_paint_context_paint_contents(context, &scrolled_rect); ewk_view_paint_context_restore(context); evas_object_image_data_update_add (smartData->backing_store, rect->x, rect->y, rect->w, rect->h); }