static void
update_rect(SDL_Rect *fill, int x, int y, int w, int h, int idx, int level)
{
    SDL_Rect r = {x, y, w, h};
    int nw = w / 2;
    int nh = h / 2;
    int area = 0;

    assert((unsigned)idx < dirty_tree_length);

    /* PRUNING: see if already dirty */
    if (dirty_tree[idx])
        return;

    /* PRUNING: check if covered area > AV_DTREE_FILL_RATIO */
    area = intersect_area(fill, &r);
    if (area == 0)
        return;
    else if (level == AV_DTREE_DEPTH
            || area > AV_DTREE_FILL_RATIO * h * w)
    {
        dirty_tree[idx] = 1;
        return;
    }

    idx *= 4;
    level += 1;

    update_rect(fill, x,      y,      nw,     nh,     idx + 1, level);
    update_rect(fill, x + nw, y,      w - nw, nh,     idx + 2, level);
    update_rect(fill, x,      y + nh, nw,     h - nh, idx + 3, level);
    update_rect(fill, x + nw, y + nh, w - nw, h - nh, idx + 4, level);
}
Example #2
0
		void					rsView::intersectClipRect(int32_t x, int32_t y, int32_t dx, int32_t dy)
		{
			intersect_area(cliprect.x, cliprect.y, cliprect.dx, cliprect.dy, x, y, dx, dy);
		}
Example #3
0
		void					rsView::intersectViewport(int32_t x, int32_t y, int32_t dx, int32_t dy)
		{
			intersect_area(viewport.x, viewport.y, viewport.dx, viewport.dy, x, y, dx, dy);
		}