Пример #1
0
EAPI int
evas_common_tilebuf_add_motion_vector(Tilebuf *tb, int x, int y, int w, int h, int dx, int dy, int alpha __UNUSED__)
{
#ifdef EVAS_RECT_SPLIT
   list_t lr = list_zeroed;
   int num;

   num = _add_redraw(&lr, tb->outbuf_w, tb->outbuf_h, x, y, w, h);
   num += _add_redraw(&lr, tb->outbuf_w, tb->outbuf_h, x + dx, y + dy, w, h);
   while (lr.head)
     {
        list_node_t *node = rect_list_unlink_next(&lr, NULL);
        rect_list_add_split_fuzzy_and_merge(&tb->rects, node,
                                            FUZZ * FUZZ, FUZZ * FUZZ);
     }
   return num;
#else
   /* FIXME: need to actually implement motion vectors. for now it just */
   /*        implements redraws */
   int num;

   num = evas_common_tilebuf_add_redraw(tb, x, y, w, h);
   num += evas_common_tilebuf_add_redraw(tb, x + dx, y + dy, w, h);
   return num;
#endif
}
Пример #2
0
EAPI int
evas_common_tilebuf_add_redraw(Tilebuf *tb, int x, int y, int w, int h)
{
#ifdef RECTUPDATE
   int i;

   if ((w <= 0) || (h <= 0)) return 0;
   RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, tb->outbuf_w, tb->outbuf_h);
   if ((w <= 0) || (h <= 0)) return 0;
   for (i = 0; i < h; i++)
     evas_common_regionbuf_span_add(tb->rb, x, x + w - 1, y + i);
   return 1;
#elif defined(EVAS_RECT_SPLIT)
   return _add_redraw(&tb->rects, tb->outbuf_w, tb->outbuf_h, x, y, w, h);
#else
   int tx1, tx2, ty1, ty2, tfx1, tfx2, tfy1, tfy2, xx, yy;
   int num;

   if ((w <= 0) || (h <= 0)) return 0;
   RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, tb->outbuf_w, tb->outbuf_h);
   if ((w <= 0) || (h <= 0)) return 0;
   num = 0;
   /* wipes out any motion vectors in tiles it touches into redraws */
   if (tilebuf_x_intersect(tb, x, w, &tx1, &tx2, &tfx1, &tfx2) &&
       tilebuf_y_intersect(tb, y, h, &ty1, &ty2, &tfy1, &tfy2))
     {
        Tilebuf_Tile    *tbt;
        int             delta_x;
        int             delta_y;

        tbt = &(TILE(tb, tx1, ty1));
        delta_x = tx2 - tx1 + 1;
        delta_y = ty2 - ty1 + 1;
	for (yy = delta_y; yy > 0; yy--)
	  {
	     Tilebuf_Tile *tbti;

	     tbti = tbt;
	     for (xx = delta_x; xx > 0; xx--)
	       {
		  tbti->redraw = 1;
		  tbti++;
	       }
             tbt += tb->tiles.w;
	  }
	num = (tx2 - tx1 + 1) * (ty2 - ty1 + 1);
     }
   return num;
#endif
}
Пример #3
0
EAPI int
evas_common_tilebuf_add_redraw(Tilebuf *tb, int x, int y, int w, int h)
{
#ifdef RECTUPDATE
/*   
   int i;

   if ((w <= 0) || (h <= 0)) return 0;
   RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, tb->outbuf_w, tb->outbuf_h);
   if ((w <= 0) || (h <= 0)) return 0;
   for (i = 0; i < h; i++)
     evas_common_regionbuf_span_add(tb->rb, x, x + w - 1, y + i);
   return 1;
 */
#elif defined(EVAS_RECT_SPLIT)
   if ((w <= 0) || (h <= 0)) return 0;
   RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, tb->outbuf_w, tb->outbuf_h);
   if ((w <= 0) || (h <= 0)) return 0;
   // optimize a common case -> adding the exact same rect 2x in a row
   if ((tb->prev_add.x == x) && (tb->prev_add.y == y) && 
       (tb->prev_add.w == w) && (tb->prev_add.h == h)) return 1;
   tb->prev_add.x = x; tb->prev_add.y = y;
   tb->prev_add.w = w; tb->prev_add.h = h;
   tb->prev_del.w = 0; tb->prev_del.h = 0;
   return _add_redraw(&tb->rects, x, y, w, h);
#else
/*   
   int tx1, tx2, ty1, ty2, tfx1, tfx2, tfy1, tfy2, xx, yy;
   int num;

   if ((w <= 0) || (h <= 0)) return 0;
   RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, tb->outbuf_w, tb->outbuf_h);
   if ((w <= 0) || (h <= 0)) return 0;
   num = 0;
   // wipes out any motion vectors in tiles it touches into redraws
   if (tilebuf_x_intersect(tb, x, w, &tx1, &tx2, &tfx1, &tfx2) &&
       tilebuf_y_intersect(tb, y, h, &ty1, &ty2, &tfy1, &tfy2))
     {
        Tilebuf_Tile    *tbt;
        int             delta_x;
        int             delta_y;

        tbt = &(TILE(tb, tx1, ty1));
        delta_x = tx2 - tx1 + 1;
        delta_y = ty2 - ty1 + 1;
	for (yy = delta_y; yy > 0; yy--)
	  {
	     Tilebuf_Tile *tbti;

	     tbti = tbt;
	     for (xx = delta_x; xx > 0; xx--)
	       {
		  tbti->redraw = 1;
		  tbti++;
	       }
             tbt += tb->tiles.w;
	  }
	num = (tx2 - tx1 + 1) * (ty2 - ty1 + 1);
     }
   return num;
 */
#endif
}