Changeset 93683 in webkit


Ignore:
Timestamp:
Aug 23, 2011 6:39:30 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

[EFL] Change the tiled backing store to use constant size of tile.
https://bugs.webkit.org/show_bug.cgi?id=65848

As current tiled backing store in Webkit EFL is using variable tile size according to the zoom level,
the number of tiles in viewport is not same always and the speed of panning is also not consistent
whenever zoom level is changed.
Therefore, tile size should be constant size in order to make sure the consistent panning speed.

Patch by KwangHyuk Kim <hyuki.kim@samsung.com> on 2011-08-23
Reviewed by Anders Carlsson.

  • ewk/ewk_tiled_backing_store.c:

(_ewk_tiled_backing_store_model_matrix_create):
(_ewk_tiled_backing_store_smart_add):
(_ewk_tiled_backing_store_smart_calculate):
(_ewk_tiled_backing_store_zoom_set_internal):
(ewk_tiled_backing_store_zoom_weak_set):
(ewk_tiled_backing_store_flush):
(ewk_tiled_backing_store_pre_render_region):
(ewk_tiled_backing_store_pre_render_relative_radius):

  • ewk/ewk_tiled_backing_store.h:
  • ewk/ewk_tiled_matrix.c:

(_ewk_tile_matrix_cell_free):
(_ewk_tile_matrix_tile_free):
(ewk_tile_matrix_new):
(ewk_tile_matrix_tile_exact_get):
(ewk_tile_matrix_tile_exact_exists):
(ewk_tile_matrix_tile_new):
(ewk_tile_matrix_tile_update):
(ewk_tile_matrix_tile_update_full):
(_ewk_tile_matrix_slicer_setup):
(ewk_tile_matrix_update):
(ewk_tile_matrix_dbg):

  • ewk/ewk_tiled_matrix.h:
  • ewk/ewk_tiled_model.c:

(ewk_tile_new):

Location:
trunk/Source/WebKit/efl
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/efl/ChangeLog

    r93637 r93683  
     12011-08-23  KwangHyuk Kim  <hyuki.kim@samsung.com>
     2
     3        [EFL] Change the tiled backing store to use constant size of tile.
     4        https://bugs.webkit.org/show_bug.cgi?id=65848
     5
     6        As current tiled backing store in Webkit EFL is using variable tile size according to the zoom level,
     7        the number of tiles in viewport is not same always and the speed of panning is also not consistent
     8        whenever zoom level is changed.
     9        Therefore, tile size should be constant size in order to make sure the consistent panning speed.
     10
     11        Reviewed by Anders Carlsson.
     12
     13        * ewk/ewk_tiled_backing_store.c:
     14        (_ewk_tiled_backing_store_model_matrix_create):
     15        (_ewk_tiled_backing_store_smart_add):
     16        (_ewk_tiled_backing_store_smart_calculate):
     17        (_ewk_tiled_backing_store_zoom_set_internal):
     18        (ewk_tiled_backing_store_zoom_weak_set):
     19        (ewk_tiled_backing_store_flush):
     20        (ewk_tiled_backing_store_pre_render_region):
     21        (ewk_tiled_backing_store_pre_render_relative_radius):
     22        * ewk/ewk_tiled_backing_store.h:
     23        * ewk/ewk_tiled_matrix.c:
     24        (_ewk_tile_matrix_cell_free):
     25        (_ewk_tile_matrix_tile_free):
     26        (ewk_tile_matrix_new):
     27        (ewk_tile_matrix_tile_exact_get):
     28        (ewk_tile_matrix_tile_exact_exists):
     29        (ewk_tile_matrix_tile_new):
     30        (ewk_tile_matrix_tile_update):
     31        (ewk_tile_matrix_tile_update_full):
     32        (_ewk_tile_matrix_slicer_setup):
     33        (ewk_tile_matrix_update):
     34        (ewk_tile_matrix_dbg):
     35        * ewk/ewk_tiled_matrix.h:
     36        * ewk/ewk_tiled_model.c:
     37        (ewk_tile_new):
     38
    1392011-08-23  Jonas M. Gastal <jgastal@profusion.mobi>
    240
  • trunk/Source/WebKit/efl/ewk/ewk_tiled_backing_store.c

    r93409 r93683  
    634634    }
    635635
    636     priv->model.matrix = ewk_tile_matrix_new
    637         (tuc, priv->model.cur.cols, priv->model.cur.rows, priv->cspace,
    638          _ewk_tiled_backing_store_render, priv);
     636    priv->model.matrix = ewk_tile_matrix_new(tuc, priv->model.cur.cols, priv->model.cur.rows, priv->cspace, _ewk_tiled_backing_store_render, priv);
    639637}
    640638
     
    704702    priv->self = o;
    705703    priv->view.tile.zoom = 1.0;
    706     priv->view.tile.w = TILE_W;
    707     priv->view.tile.h = TILE_H;
     704    priv->view.tile.w = DEFAULT_TILE_W;
     705    priv->view.tile.h = DEFAULT_TILE_H;
    708706    priv->view.offset.cur.x = 0;
    709707    priv->view.offset.cur.y = 0;
     
    13521350                           priv->model.cur.rows);
    13531351        priv->changed.model = EINA_FALSE;
    1354         evas_object_resize(priv->contents_clipper,
    1355                            priv->model.width, priv->model.height);
     1352        evas_object_resize(priv->contents_clipper, priv->model.width, priv->model.height);
    13561353        _ewk_tiled_backing_store_smart_calculate_offset_force(priv);
    13571354
     
    14821479    _ewk_tiled_backing_store_pre_render_request_flush(priv);
    14831480    Evas_Coord tw, th;
    1484     tw = TILE_SIZE_AT_ZOOM(TILE_W, *zoom);
    1485     tw = (tw >> 1) << 1;
    1486     *zoom = TILE_W_ZOOM_AT_SIZE(tw);
    1487     /* WARNING: assume reverse zoom is the same for both axis */
    1488     th = TILE_SIZE_AT_ZOOM(TILE_H, *zoom);
     1481
     1482    *zoom = ROUNDED_ZOOM(priv->view.tile.w, *zoom);
     1483
     1484    tw = priv->view.tile.w;
     1485    th = priv->view.tile.h;
    14891486
    14901487    float scale = *zoom / priv->view.tile.zoom;
     
    14951492    priv->view.offset.zoom_center.y = cy;
    14961493
    1497     priv->view.tile.w = tw;
    1498     priv->view.tile.h = th;
    14991494
    15001495    if (!priv->view.w || !priv->view.h) {
     
    15301525
    15311526    priv->changed.size = EINA_TRUE;
     1527    priv->changed.model = EINA_TRUE;
    15321528    _ewk_tiled_backing_store_changed(priv);
    15331529
     
    15901586    Eina_Bool recalc = EINA_FALSE;
    15911587
    1592     tw = TILE_SIZE_AT_ZOOM(TILE_W, zoom);
    1593     zoom = TILE_W_ZOOM_AT_SIZE(tw);
    1594     /* WARNING: assume reverse zoom is the same for both axis */
    1595     th = TILE_SIZE_AT_ZOOM(TILE_H, zoom);
    1596 
    15971588    float scale = zoom / priv->view.tile.zoom;
     1589
     1590    tw = TILE_SIZE_AT_ZOOM(priv->view.tile.w, scale);
     1591    scale = TILE_ZOOM_AT_SIZE(tw, priv->view.tile.w);
     1592    th = TILE_SIZE_AT_ZOOM(priv->view.tile.h, scale);
     1593    zoom = scale * priv->view.tile.zoom;
    15981594
    15991595    Evas_Coord model_width = priv->model.width * scale;
    16001596    Evas_Coord model_height = priv->model.height * scale;
    16011597
    1602     evas_object_resize(priv->contents_clipper,
    1603                        model_width, model_height);
     1598    evas_object_resize(priv->contents_clipper, model_width, model_height);
    16041599
    16051600    int vrows = ceil((float)priv->view.h / (float)th) + 1;
     
    18091804    priv->model.base.col = 0;
    18101805    priv->model.base.row = 0;
     1806    priv->model.cur.cols = 1;
     1807    priv->model.cur.rows = 1;
     1808    priv->model.old.cols = 0;
     1809    priv->model.old.rows = 0;
    18111810    priv->changed.size = EINA_TRUE;
    18121811
     
    18351834    Ewk_Tile_Unused_Cache *tuc;
    18361835
    1837     tw = TILE_SIZE_AT_ZOOM(TILE_W, zoom);
    1838     tw = (tw >> 1) << 1;
    1839     zoom = TILE_W_ZOOM_AT_SIZE(tw);
    1840     /* WARNING: assume reverse zoom is the same for both axis */
    1841     th = TILE_SIZE_AT_ZOOM(TILE_H, zoom);
     1836    tw = priv->view.tile.w;
     1837    th = priv->view.tile.h;
     1838    zoom = ROUNDED_ZOOM(priv->view.tile.w, zoom);
    18421839
    18431840    if (!eina_tile_grid_slicer_setup(&slicer, x, y, w, h, tw, th)) {
     
    18791876         start_row, end_row, start_col, end_col);
    18801877
     1878    zoom = ROUNDED_ZOOM(priv->view.tile.w, zoom);
     1879
    18811880    for (i = start_row; i <= end_row; i++)
    18821881        for (j = start_col; j <= end_col; j++)
     
    18881887
    18891888    tuc = ewk_tile_matrix_unused_cache_get(priv->model.matrix);
    1890     h = (end_row - start_row + 1) * TILE_SIZE_AT_ZOOM(TILE_H, zoom);
    1891     w = (end_col - start_col + 1) * TILE_SIZE_AT_ZOOM(TILE_W, zoom);
     1889    h = (end_row - start_row + 1) * TILE_SIZE_AT_ZOOM(priv->view.tile.h, zoom);
     1890    w = (end_col - start_col + 1) * TILE_SIZE_AT_ZOOM(priv->view.tile.w, zoom);
    18921891    ewk_tile_unused_cache_lock_area(tuc,
    1893             start_col * TILE_SIZE_AT_ZOOM(TILE_W, zoom),
    1894             start_row * TILE_SIZE_AT_ZOOM(TILE_H, zoom), w, h, zoom);
     1892            start_col * TILE_SIZE_AT_ZOOM(priv->view.tile.w, zoom),
     1893            start_row * TILE_SIZE_AT_ZOOM(priv->view.tile.h, zoom), w, h, zoom);
    18951894
    18961895    return EINA_TRUE;
  • trunk/Source/WebKit/efl/ewk/ewk_tiled_backing_store.h

    r91974 r93683  
    3434#undef DEBUG_MEM_LEAKS
    3535
    36 #define TILE_W (256)
    37 #define TILE_H (256)
     36#define DEFAULT_TILE_W (256)
     37#define DEFAULT_TILE_H (256)
    3838
    3939#define ZOOM_STEP_MIN (0.01)
    4040
    4141#define TILE_SIZE_AT_ZOOM(SIZE, ZOOM) ((int)roundf((SIZE) * (ZOOM)))
    42 #define TILE_W_ZOOM_AT_SIZE(SIZE) ((float)SIZE / (float)TILE_W)
    43 #define TILE_H_ZOOM_AT_SIZE(SIZE) ((float)SIZE / (float)TILE_H)
     42#define TILE_ZOOM_AT_SIZE(SIZE, ORIG_TILE) ((float)(SIZE) / (float)(ORIG_TILE))
     43#define ROUNDED_ZOOM(SIZE, ZOOM) ((float)(SIZE) / (float)(((int)roundf((SIZE) / (ZOOM)))))
    4444
    4545#ifdef __cplusplus
     
    6767
    6868struct _Ewk_Tile {
    69     EINA_INLIST;            /**< sibling tiles at same (i, j) but other zoom */
    7069    Eina_Tiler *updates;    /**< updated/dirty areas */
    7170    Ewk_Tile_Stats stats;       /**< tile usage statistics */
  • trunk/Source/WebKit/efl/ewk/ewk_tiled_matrix.c

    r74554 r93683  
    3333#include <string.h>
    3434
    35 static const Evas_Coord TILE_MATRIX_BASE_TILE_SIZE = 256;
    36 
    3735struct _Ewk_Tile_Matrix {
    3836    Eina_Matrixsparse *matrix;
     
    4543    unsigned int frozen;
    4644    Eina_List *updates;
     45    struct {
     46        Evas_Coord w, h;
     47    } tile;
    4748#ifdef DEBUG_MEM_LEAKS
    4849    struct {
     
    6364{
    6465    Ewk_Tile_Matrix *tm = user_data;
    65     Eina_Inlist *l = cell_data;
    66 
    67     if (!l)
     66    Ewk_Tile *t = cell_data;
     67
     68    if (!t)
    6869        return;
    6970
    7071    ewk_tile_unused_cache_freeze(tm->tuc);
    7172
    72     while (l) {
    73         Ewk_Tile *t = (Ewk_Tile *)l;
    74         l = l->next;
    75 
    76         if (t->updates || t->stats.full_update)
    77             tm->updates = eina_list_remove(tm->updates, t);
    78 
    79         if (t->visible)
    80             ERR("freeing cell that is visible, leaking tile %p", t);
     73    if (t->updates || t->stats.full_update)
     74        tm->updates = eina_list_remove(tm->updates, t);
     75
     76    if (t->visible)
     77        ERR("freeing cell that is visible, leaking tile %p", t);
     78    else {
     79        if (!ewk_tile_unused_cache_tile_get(tm->tuc, t))
     80            ERR("tile %p was not in cache %p? leaking...", t, tm->tuc);
    8181        else {
    82             if (!ewk_tile_unused_cache_tile_get(tm->tuc, t))
    83                 ERR("tile %p was not in cache %p? leaking...", t, tm->tuc);
    84             else {
    85                 DBG("tile cell does not exist anymore, free it %p", t);
    86 
    87 #ifdef DEBUG_MEM_LEAKS
    88                 tm->stats.bytes.freed += t->bytes;
    89                 tm->stats.tiles.freed++;
    90 #endif
    91 
    92                 ewk_tile_free(t);
    93             }
     82            DBG("tile cell does not exist anymore, free it %p", t);
     83#ifdef DEBUG_MEM_LEAKS
     84            tm->stats.bytes.freed += t->bytes;
     85            tm->stats.tiles.freed++;
     86#endif
     87            ewk_tile_free(t);
    9488        }
    9589    }
     
    10397    Ewk_Tile_Matrix *tm = data;
    10498    Eina_Matrixsparse_Cell *cell;
    105     Eina_Inlist *l, *old;
    106 
     99 
    107100    if (!eina_matrixsparse_cell_idx_get(tm->matrix, t->row, t->col, &cell)) {
    108101        ERR("removing tile %p that was not in the matrix? Leaking...", t);
     
    110103    }
    111104
     105    if (!cell) {
     106        ERR("removing tile %p that was not in the matrix? Leaking...", t);
     107        return;
     108    }
     109
    112110    if (t->updates || t->stats.full_update)
    113111        tm->updates = eina_list_remove(tm->updates, t);
    114112
    115     old = eina_matrixsparse_cell_data_get(cell);
    116     l = eina_inlist_remove(old, EINA_INLIST_GET(t));
    117     if (!l) {
    118         /* set to null to avoid double free */
    119         eina_matrixsparse_cell_data_replace(cell, NULL, NULL);
    120         eina_matrixsparse_cell_clear(cell);
    121     } else if (old != l)
    122         eina_matrixsparse_cell_data_replace(cell, l, NULL);
     113    /* set to null to avoid double free */
     114    eina_matrixsparse_cell_data_replace(cell, NULL, NULL);
     115    eina_matrixsparse_cell_clear(cell);
    123116
    124117    if (EINA_UNLIKELY(!!t->visible)) {
     
    150143 * @param cspace the color space used to create tiles in this matrix.
    151144 * @param render_cb function used to render given tile update.
    152  * @param data context to give back to @a render_cb.
     145 * @param render_data context to give back to @a render_cb.
    153146 *
    154147 * @return newly allocated instance on success, @c NULL on failure.
    155148 */
    156 Ewk_Tile_Matrix *ewk_tile_matrix_new(Ewk_Tile_Unused_Cache *tuc, unsigned long cols, unsigned long rows, Evas_Colorspace cspace, void (*render_cb)(void *data, Ewk_Tile *t, const Eina_Rectangle *update), const void *data)
     149Ewk_Tile_Matrix *ewk_tile_matrix_new(Ewk_Tile_Unused_Cache *tuc, unsigned long cols, unsigned long rows, Evas_Colorspace cspace, void (*render_cb)(void *data, Ewk_Tile *t, const Eina_Rectangle *update), const void *render_data)
    157150{
    158151    Ewk_Tile_Matrix *tm;
     
    181174    tm->cspace = cspace;
    182175    tm->render.cb = render_cb;
    183     tm->render.data = (void *)data;
     176    tm->render.data = (void *)render_data;
     177    tm->tile.w = DEFAULT_TILE_W;
     178    tm->tile.h = DEFAULT_TILE_H;
    184179
    185180    return tm;
     
    273268 *         ewk_tile_matrix_tile_put() afterwards.
    274269 *
    275  * @see ewk_tile_matrix_tile_nearest_get()
    276270 * @see ewk_tile_matrix_tile_exact_get()
    277271 */
    278272Ewk_Tile *ewk_tile_matrix_tile_exact_get(Ewk_Tile_Matrix *tm, unsigned long col, unsigned int row, float zoom)
    279273{
    280     Ewk_Tile *t, *item, *item_found = NULL;
    281     Eina_Inlist *inl;
    282 
     274    Ewk_Tile *t;
    283275    t = eina_matrixsparse_data_idx_get(tm->matrix, row, col);
    284276    if (!t)
     
    287279    if (t->zoom == zoom)
    288280        goto end;
    289 
    290     EINA_INLIST_FOREACH(EINA_INLIST_GET(t), item) {
    291         if (item->zoom != zoom)
    292             continue;
    293         item_found = item;
    294         break;
    295     }
    296 
    297     if (!item_found)
    298         return NULL;
    299 
    300     inl = eina_inlist_promote(EINA_INLIST_GET(t), EINA_INLIST_GET(item_found));
    301     eina_matrixsparse_data_idx_replace(tm->matrix, row, col, inl, NULL);
    302281
    303282  end:
     
    324303Eina_Bool ewk_tile_matrix_tile_exact_exists(Ewk_Tile_Matrix *tm, unsigned long col, unsigned int row, float zoom)
    325304{
    326     Ewk_Tile *t, *item;
     305    Ewk_Tile *t;
    327306
    328307    t = eina_matrixsparse_data_idx_get(tm->matrix, row, col);
     
    330309        return EINA_FALSE;
    331310
    332     EINA_INLIST_FOREACH(EINA_INLIST_GET(t), item) {
    333         if (item->zoom == zoom)
    334             return EINA_TRUE;
    335     }
    336 
    337     return EINA_FALSE;
    338 }
    339 
    340 /**
    341  * Get the nearest tile for given position and zoom.
    342  *
    343  * The nearest tile is the one at the given position but with the
    344  * closest zoom, this being the division of the tile zoom by the
    345  * desired zoom, the closest to 1.0 gets it.
    346  *
    347  * If the tile was unused then it's removed from the cache.
    348  *
    349  * After usage, please give it back using ewk_tile_matrix_tile_put().
    350  *
    351  * @param tm the tile matrix to get tile from.
    352  * @param col the column number.
    353  * @param row the row number.
    354  * @param zoom the exact zoom to use.
    355  *
    356  * @return The tile instance or @c NULL if none is found. If the tile
    357  *         was in the unused cache it will be @b removed (thus
    358  *         considered used) and one should give it back with
    359  *         ewk_tile_matrix_tile_put() afterwards.
    360  */
    361 Ewk_Tile *ewk_tile_matrix_tile_nearest_get(Ewk_Tile_Matrix *tm, unsigned long col, unsigned int row, float zoom)
    362 {
    363     Ewk_Tile *t, *item, *item_found = NULL;
    364     Eina_Inlist *inl;
    365     float zoom_found = 0;
    366 
    367     EINA_SAFETY_ON_NULL_RETURN_VAL(tm, NULL);
    368     EINA_SAFETY_ON_FALSE_RETURN_VAL(zoom > 0.0, NULL);
    369 
    370     t = eina_matrixsparse_data_idx_get(tm->matrix, row, col);
    371     if (!t)
    372         return NULL;
    373 
    374     if (t->zoom == zoom) {
    375         item_found = t;
    376         goto end;
    377     }
    378 
    379     EINA_INLIST_FOREACH(EINA_INLIST_GET(t), item) {
    380         float cur_zoom = item->zoom;
    381 
    382         if (cur_zoom == zoom) {
    383             item_found = item;
    384             break;
    385         }
    386        
    387         if (cur_zoom > zoom)
    388             cur_zoom = zoom / cur_zoom;
    389         else
    390             cur_zoom = cur_zoom / zoom;
    391 
    392         if (cur_zoom > zoom_found) {
    393             item_found = item;
    394             zoom_found = cur_zoom;
    395         }
    396     }
    397 
    398     if (!item_found)
    399         return NULL;
    400 
    401     inl = eina_inlist_promote(EINA_INLIST_GET(t), EINA_INLIST_GET(item_found));
    402     eina_matrixsparse_data_idx_replace(tm->matrix, row, col, inl, NULL);
    403 
    404   end:
    405     if (!item_found->visible) {
    406         if (!ewk_tile_unused_cache_tile_get(tm->tuc, item_found))
    407             WRN("Ewk_Tile was unused but not in cache? bug!");
    408     }
    409 
    410     return item_found;
     311    return EINA_TRUE;
    411312}
    412313
     
    425326Ewk_Tile *ewk_tile_matrix_tile_new(Ewk_Tile_Matrix *tm, Evas *evas, unsigned long col, unsigned int row, float zoom)
    426327{
    427     Evas_Coord s;
    428     Eina_Inlist *old;
     328    Evas_Coord tw, th;
    429329    Ewk_Tile *t;
    430330
     
    432332    EINA_SAFETY_ON_FALSE_RETURN_VAL(zoom > 0.0, NULL);
    433333
    434     s = TILE_SIZE_AT_ZOOM(TILE_MATRIX_BASE_TILE_SIZE, zoom);
    435     zoom = (float)s / (float)TILE_MATRIX_BASE_TILE_SIZE;
    436 
    437     t = ewk_tile_new(evas, s, s, zoom, tm->cspace);
     334    tw = tm->tile.w;
     335    th = tm->tile.h;
     336
     337    t = ewk_tile_new(evas, tw, th, zoom, tm->cspace);
    438338    if (!t) {
    439         ERR("could not create tile %dx%d at %f, cspace=%d",
    440             s, s, (double)zoom, tm->cspace);
     339        ERR("could not create tile %dx%d at %f, cspace=%d", tw, th, (double)zoom, tm->cspace);
    441340        return NULL;
    442341    }
    443342
    444     old = eina_matrixsparse_data_idx_get(tm->matrix, row, col);
    445     old = eina_inlist_prepend(old, EINA_INLIST_GET(t));
    446     if (!eina_matrixsparse_data_idx_replace(tm->matrix, row, col, t, NULL)) {
     343    if (!eina_matrixsparse_data_idx_set(tm->matrix, row, col, t)) {
    447344        ERR("could not set matrix cell, row/col outside matrix dimensions!");
    448345        ewk_tile_free(t);
     
    452349    t->col = col;
    453350    t->row = row;
    454     t->x = col * s;
    455     t->y = row * s;
     351    t->x = col * tw;
     352    t->y = row * th;
    456353
    457354    cairo_translate(t->cairo, -t->x, -t->y);
     
    472369 *
    473370 * This will report the tile is no longer in use by the one that got
    474  * it with ewk_tile_matrix_tile_nearest_get() or
    475  * ewk_tile_matrix_tile_exact_get().
     371 * it with ewk_tile_matrix_tile_exact_get().
    476372 *
    477373 * Any previous reference to tile should be released
     
    500396Eina_Bool ewk_tile_matrix_tile_update(Ewk_Tile_Matrix *tm, unsigned long col, unsigned int row, const Eina_Rectangle *update)
    501397{
    502     Ewk_Tile *l, *t;
     398    Ewk_Tile *t;
    503399    Eina_Rectangle new_update;
    504400    EINA_SAFETY_ON_NULL_RETURN_VAL(tm, EINA_FALSE);
     
    512408    }
    513409
    514     if (update->x + update->w - 1 >= TILE_MATRIX_BASE_TILE_SIZE)
    515         new_update.w = TILE_MATRIX_BASE_TILE_SIZE - update->x;
    516     if (update->y + update->h - 1 >= TILE_MATRIX_BASE_TILE_SIZE)
    517         new_update.h = TILE_MATRIX_BASE_TILE_SIZE - update->y;
    518 
    519     l = eina_matrixsparse_data_idx_get(tm->matrix, row, col);
    520 
    521     if (!l)
     410    if (update->x + update->w - 1 >= tm->tile.w)
     411        new_update.w = tm->tile.w - update->x;
     412    if (update->y + update->h - 1 >= tm->tile.h)
     413        new_update.h = tm->tile.h - update->y;
     414
     415    t = eina_matrixsparse_data_idx_get(tm->matrix, row, col);
     416
     417    if (!t)
    522418        return EINA_TRUE;
    523419
    524     EINA_INLIST_FOREACH(EINA_INLIST_GET(l), t) {
    525         if (!t->updates && !t->stats.full_update)
    526             tm->updates = eina_list_append(tm->updates, t);
    527         new_update.x = roundf(t->zoom * new_update.x);
    528         new_update.y = roundf(t->zoom * new_update.y);
    529         new_update.w = roundf(t->zoom * new_update.w);
    530         new_update.h = roundf(t->zoom * new_update.h);
    531         ewk_tile_update_area(t, &new_update);
    532     }
     420    if (!t->updates && !t->stats.full_update)
     421        tm->updates = eina_list_append(tm->updates, t);
     422    ewk_tile_update_area(t, &new_update);
    533423
    534424    return EINA_TRUE;
     
    537427Eina_Bool ewk_tile_matrix_tile_update_full(Ewk_Tile_Matrix *tm, unsigned long col, unsigned int row)
    538428{
    539     Ewk_Tile *l, *t;
     429    Ewk_Tile *t;
    540430    Eina_Matrixsparse_Cell *cell;
    541431    EINA_SAFETY_ON_NULL_RETURN_VAL(tm, EINA_FALSE);
     
    547437        return EINA_TRUE;
    548438
    549     l = eina_matrixsparse_cell_data_get(cell);
    550     if (!l) {
     439    t = eina_matrixsparse_cell_data_get(cell);
     440    if (!t) {
    551441        CRITICAL("matrix cell with no tile!");
    552442        return EINA_TRUE;
    553443    }
    554444
    555     EINA_INLIST_FOREACH(EINA_INLIST_GET(l), t) {
    556         if (!t->updates && !t->stats.full_update)
    557             tm->updates = eina_list_append(tm->updates, t);
    558         ewk_tile_update_full(t);
    559     }
     445    if (!t->updates && !t->stats.full_update)
     446        tm->updates = eina_list_append(tm->updates, t);
     447    ewk_tile_update_full(t);
    560448
    561449    return EINA_TRUE;
     
    587475    h = area->h;
    588476
    589     tw = TILE_SIZE_AT_ZOOM(TILE_W, zoom);
    590     th = TILE_SIZE_AT_ZOOM(TILE_H, zoom);
     477    tw = tm->tile.w;
     478    th = tm->tile.h;
    591479
    592480    // cropping area region to fit matrix
     
    631519    while (eina_tile_grid_slicer_next(&slicer, &info)) {
    632520        unsigned long col, row;
    633         Ewk_Tile *l, *t;
     521        Ewk_Tile *t;
    634522        col = info->col;
    635523        row = info->row;
    636524
    637         l = eina_matrixsparse_data_idx_get(tm->matrix, row, col);
    638         if (!l)
     525        t = eina_matrixsparse_data_idx_get(tm->matrix, row, col);
     526        if (!t)
    639527            continue;
    640528
    641         EINA_INLIST_FOREACH(EINA_INLIST_GET(l), t) {
    642             if (!t->updates && !t->stats.full_update)
    643                 tm->updates = eina_list_append(tm->updates, t);
    644             if (info->full)
    645                 ewk_tile_update_full(t);
    646             else {
    647                 if (t->zoom != zoom)
    648                     ewk_tile_update_full(t);
    649                 else
    650                     ewk_tile_update_area(t, &info->rect);
    651             }
    652         }
     529        if (!t->updates && !t->stats.full_update)
     530            tm->updates = eina_list_append(tm->updates, t);
     531        if (info->full)
     532            ewk_tile_update_full(t);
     533        else
     534            ewk_tile_update_area(t, &info->rect);
    653535    }
    654536
     
    703585    EINA_ITERATOR_FOREACH(it, cell) {
    704586        unsigned long row, col;
    705         Eina_Inlist *l;
     587        Ewk_Tile *t;
    706588        eina_matrixsparse_cell_position_get(cell, &row, &col);
    707         l = eina_matrixsparse_cell_data_get(cell);
    708 
    709         if (!l) {
     589        t = eina_matrixsparse_cell_data_get(cell);
     590
     591        if (!t) {
    710592            if (!last_empty) {
    711593                last_empty = EINA_TRUE;
     
    718600                printf("\n");
    719601            }
    720             Ewk_Tile *t;
    721 
    722             printf("%3lu,%3lu %10p:", col, row, l);
    723             EINA_INLIST_FOREACH(l, t)
    724                 printf(" [%3lu,%3lu + %dx%d @ %0.3f]%c",
    725                        t->col, t->row, t->w, t->h, t->zoom,
    726                        t->visible ? '*': ' ');
     602            printf("%3lu,%3lu %10p:", col, row, t);
     603            printf(" [%3lu,%3lu + %dx%d @ %0.3f]%c", t->col, t->row, t->w, t->h, t->zoom, t->visible ? '*': ' ');
    727604            printf("\n");
    728605        }
  • trunk/Source/WebKit/efl/ewk/ewk_tiled_matrix.h

    r91974 r93683  
    2727
    2828/* matrix of tiles */
    29 Ewk_Tile_Matrix *ewk_tile_matrix_new(Ewk_Tile_Unused_Cache *tuc, unsigned long cols, unsigned long rows, Evas_Colorspace cspace, void (*render_cb)(void *data, Ewk_Tile *t, const Eina_Rectangle *update), const void *data);
     29Ewk_Tile_Matrix *ewk_tile_matrix_new(Ewk_Tile_Unused_Cache *tuc, unsigned long cols, unsigned long rows, Evas_Colorspace cspace, void (*render_cb)(void *data, Ewk_Tile *t, const Eina_Rectangle *update), const void *render_data);
    3030void ewk_tile_matrix_free(Ewk_Tile_Matrix *tm);
    3131
  • trunk/Source/WebKit/efl/ewk/ewk_tiled_model.c

    r91981 r93683  
    242242Ewk_Tile *ewk_tile_new(Evas *evas, Evas_Coord w, Evas_Coord h, float zoom, Evas_Colorspace cspace)
    243243{
    244     Eina_Inlist *l;
    245244    Evas_Coord *ec;
    246245    Evas_Colorspace *ecs;
     
    271270    }
    272271
    273     DBG("size: %dx%d (%d), zoom: %f, cspace=%d",
    274         w, h, area, (double)zoom, cspace);
     272    DBG("size: %dx%d (%d), zoom: %f, cspace=%d", w, h, area, (double)zoom, cspace);
    275273
    276274    MALLOC_OR_OOM_RET(t, sizeof(Ewk_Tile), NULL);
     
    282280        evas_object_image_content_hint_set(t->image, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
    283281
    284     l = EINA_INLIST_GET(t);
    285     l->prev = NULL;
    286     l->next = NULL;
    287 
    288282    t->visible = 0;
    289283    t->updates = NULL;
     
    311305    evas_object_image_colorspace_set(t->image, t->cspace);
    312306    t->pixels = evas_object_image_data_get(t->image, EINA_TRUE);
    313     t->surface = cairo_image_surface_create_for_data
    314         (t->pixels, format, w, h, stride);
     307    t->surface = cairo_image_surface_create_for_data(t->pixels, format, w, h, stride);
    315308    status = cairo_surface_status(t->surface);
    316309    if (status != CAIRO_STATUS_SUCCESS) {
Note: See TracChangeset for help on using the changeset viewer.