Пример #1
0
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);
}
Пример #2
0
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;
}
Eina_List* DumpRenderTreeSupportEfl::trackedRepaintRects(const Evas_Object* ewkFrame)
{
    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0);

    if (!frame->view())
        return 0;

    const Vector<WebCore::IntRect>& repaintRects = frame->view()->trackedRepaintRects();
    size_t count = repaintRects.size();
    Eina_List* rectList = 0;

    for (size_t i = 0; i < count; ++i) {
        Eina_Rectangle* rect = eina_rectangle_new(repaintRects[i].x(), repaintRects[i].y(), repaintRects[i].width(), repaintRects[i].height());
        rectList = eina_list_append(rectList, rect);
    }

    return rectList;
}
Пример #4
0
void *
evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) 
{
   RGBA_Image *im = NULL;
   Outbuf_Region *obr = NULL;
   Eina_Bool use_shm = EINA_TRUE;
   Eina_Bool alpha = EINA_FALSE;
   int bpl = 0;

   if ((buf->onebuf) && (buf->priv.x11.xcb.shm)) 
     {
        Eina_Rectangle *rect;

        RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h);

        if (!(obr = calloc(1, sizeof(Outbuf_Region))))
          return NULL;

        if (!(rect = eina_rectangle_new(x, y, w, h))) 
          {
             free(obr);
             return NULL;
          }

        if ((eina_array_push(&buf->priv.onebuf_regions, rect)) &&
            (buf->priv.onebuf))
          {
             if (cx) *cx = x;
             if (cy) *cy = y;
             if (cw) *cw = w;
             if (ch) *ch = h;
             if (!buf->priv.synced) 
               {
                  _xcbob_sync(buf->priv.x11.xcb.conn);
                  buf->priv.synced = EINA_TRUE;
               }
             free(obr);
             return buf->priv.onebuf;
          }
        obr->x = 0;
        obr->y = 0;
        obr->w = buf->w;
        obr->h = buf->h;
        if (cx) *cx = x;
        if (cy) *cy = y;
        if (cw) *cw = w;
        if (ch) *ch = h;

        alpha = ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha));
        use_shm = buf->priv.x11.xcb.shm;

        if ((buf->rot == 0) &&
            (buf->priv.x11.xcb.imdepth == 32) &&
            (buf->priv.mask.r == 0xff0000) &&
            (buf->priv.mask.g == 0x00ff00) &&
            (buf->priv.mask.b == 0x0000ff))
          {
             obr->xcbob = 
               evas_software_xcb_output_buffer_new(buf->priv.x11.xcb.conn, 
                                                   buf->priv.x11.xcb.visual, 
                                                   buf->priv.x11.xcb.depth, 
                                                   buf->w, buf->h, use_shm, 
                                                   NULL);
             if (!obr->xcbob) 
               {
                  free(obr);
                  return NULL;
               }
#ifdef EVAS_CSERVE2
             if (evas_cserve2_use_get())
               {
                  im = 
                    (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(), 
                                                         buf->w, buf->h, 
                                                         (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), 
                                                         alpha, EVAS_COLORSPACE_ARGB8888);
               }
             else
#endif
               {
                  im = 
                    (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 
                                                        buf->w, buf->h, 
                                                        (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), 
                                                        alpha, EVAS_COLORSPACE_ARGB8888);
               }

             if (!im) 
               {
                  evas_software_xcb_output_buffer_free(obr->xcbob, EINA_FALSE);
                  free(obr);
                  return NULL;
               }
             im->extended_info = obr;
             if (buf->priv.x11.xcb.mask) 
               {
                  obr->mask = 
                    evas_software_xcb_output_buffer_new(buf->priv.x11.xcb.conn, 
                                                        buf->priv.x11.xcb.visual, 
                                                        1, buf->w, buf->h, 
                                                        use_shm, NULL);
               }
          }
        else 
          {
             int bw = 0, bh = 0;

#ifdef EVAS_CSERVE2
             if (evas_cserve2_use_get())
               {
                  im = 
                    (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get());
               }
             else
#endif
               {
                  im = 
                    (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
               }

             if (!im) 
               {
                  free(obr);
                  return NULL;
               }
             im->cache_entry.flags.alpha |= (alpha ? 1 : 0);
#ifdef EVAS_CSERVE2
             if (evas_cserve2_use_get())
               evas_cache2_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
             else
#endif
               evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);

             im->extended_info = obr;
             if ((buf->rot == 0) || (buf->rot == 180)) 
               {
                  bw = buf->w;
                  bh = buf->h;
               }
             else if ((buf->rot == 90) || (buf->rot == 270)) 
               {
                  bw = buf->h;
                  bh = buf->w;
               }
             obr->xcbob = 
               evas_software_xcb_output_buffer_new(buf->priv.x11.xcb.conn, 
                                                   buf->priv.x11.xcb.visual, 
                                                   buf->priv.x11.xcb.depth, 
                                                   bw, bh, use_shm, NULL);
             if (!obr->xcbob) 
               {
#ifdef EVAS_CSERVE2
                  if (evas_cserve2_use_get())
                    evas_cache2_image_close(&im->cache_entry);
                  else
#endif
                    evas_cache_image_drop(&im->cache_entry);

                  free(obr);
                  return NULL;
               }
             if (buf->priv.x11.xcb.mask) 
               {
                  obr->mask = 
                    evas_software_xcb_output_buffer_new(buf->priv.x11.xcb.conn, 
                                                        buf->priv.x11.xcb.visual, 
                                                        1, bw, bh, use_shm, 
                                                        NULL);
               }
          }
        /* FIXME: We should be able to remove this memset. */
        if ((alpha) && (im->image.data)) 
          {
             /* FIXME: Faster memset */
//             memset(im->image.data, 0, (w * h * sizeof(DATA32)));
          }
        buf->priv.onebuf = im;
        return im;
     }

   if (!(obr = calloc(1, sizeof(Outbuf_Region))))
     return NULL;

   obr->x = x;
   obr->y = y;
   obr->w = w;
   obr->h = h;
   if (cx) *cx = 0;
   if (cy) *cy = 0;
   if (cw) *cw = w;
   if (ch) *ch = h;

   use_shm = buf->priv.x11.xcb.shm;
   alpha = ((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha));
   if ((buf->rot == 0) &&
       (buf->priv.x11.xcb.imdepth == 32) &&
       (buf->priv.mask.r == 0xff0000) && 
       (buf->priv.mask.g == 0x00ff00) &&
       (buf->priv.mask.b == 0x0000ff)) 
     {
        obr->xcbob = 
          _find_xcbob(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.visual, 
                      buf->priv.x11.xcb.depth, w, h, use_shm, NULL);
        if (!obr->xcbob) 
          {
             free(obr);
             return NULL;
          }
#ifdef EVAS_CSERVE2
        if (evas_cserve2_use_get())
          {
             im = 
               (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(), 
                                                   w, h, 
                                                   (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), 
                                                   alpha, EVAS_COLORSPACE_ARGB8888);
          }
        else
#endif
          {
             im = 
               (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 
                                                   w, h, 
                                                   (DATA32 *)evas_software_xcb_output_buffer_data(obr->xcbob, &bpl), 
                                                   alpha, EVAS_COLORSPACE_ARGB8888);
          }

        if (!im) 
          {
             _unfind_xcbob(obr->xcbob, EINA_FALSE);
             free(obr);
             return NULL;
          }
        im->extended_info = obr;
        if (buf->priv.x11.xcb.mask) 
          {
             obr->mask = 
               _find_xcbob(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.visual, 
                           1, w, h, use_shm, NULL);
          }
     }
   else 
     {
        int bw = 0, bh = 0;

#ifdef EVAS_CSERVE2
        if (evas_cserve2_use_get())
          {
             im = 
               (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get());
          }
        else
#endif
          {
             im = 
               (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
          }

        if (!im) 
          {
             free(obr);
             return NULL;
          }
        im->cache_entry.flags.alpha |= (alpha ? 1 : 0);
#ifdef EVAS_CSERVE2
        if (evas_cserve2_use_get())
          evas_cache2_image_surface_alloc(&im->cache_entry, w, h);
        else
#endif
          evas_cache_image_surface_alloc(&im->cache_entry, w, h);

        im->extended_info = obr;
        if ((buf->rot == 0) || (buf->rot == 180)) 
          {
             bw = w;
             bh = h;
          }
        else if ((buf->rot == 90) || (buf->rot == 270)) 
          {
             bw = h;
             bh = w;
          }
        obr->xcbob = 
          _find_xcbob(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.visual, 
                      buf->priv.x11.xcb.depth, bw, bh, use_shm, NULL);
        if (!obr->xcbob) 
          {
#ifdef EVAS_CSERVE2
             if (evas_cserve2_use_get())
               evas_cache2_image_close(&im->cache_entry);
             else
#endif
               evas_cache_image_drop(&im->cache_entry);
             free(obr);
             return NULL;
          }
        if (buf->priv.x11.xcb.mask) 
          {
             obr->mask = 
               _find_xcbob(buf->priv.x11.xcb.conn, buf->priv.x11.xcb.visual, 1, 
                           bw, bh, use_shm, NULL);
          }
     }
   /* FIXME: We should be able to remove this memset. */
   if (((buf->priv.x11.xcb.mask) || (buf->priv.destination_alpha)) && 
       (im->image.data)) 
     {
        /* FIXME: Faster memset */
//        memset(im->image.data, 0, (w * h * sizeof(DATA32)));
     }

   buf->priv.pending_writes = eina_list_append(buf->priv.pending_writes, im);

   return im;
}
Пример #5
0
static Eina_List *
_eina_rectangle_empty_space_find(Eina_List *empty, int w, int h, int *x, int *y)
{
   Eina_Rectangle *r;
   Eina_List *l;

   EINA_LIST_FOREACH(empty, l, r)
   {
      if (r->w >= w && r->h >= h)
        {
           /* Remove l from empty */
           empty = eina_list_remove_list(empty, l);
           /* Remember x and y */
           *x = r->x;
           *y = r->y;
           /* Split r in 2 rectangle if needed (only the empty one) and insert them */
           if (r->w == w)
             {
                r->y += h;
                r->h -= h;
             }
           else if (r->h == h)
             {
                r->x += w;
                r->w -= w;
             }
           else
             {
                int rx1, ry1, rw1, rh1;
                int x2, y2, w2, h2;

                rx1 = r->x + w;
                ry1 = r->y;
                rw1 = r->w - w;
                /* h1 could be h or r->h */
                x2 = r->x;
                y2 = r->y + h;
                /* w2 could be w or r->w */
                h2 = r->h - h;

                if (rw1 * r->h > h2 * r->w)
                  {
                     rh1 = r->h;
                     w2 = w;
                  }
                else
                  {
                     rh1 = h;
                     w2 = r->w;
                  }

                EINA_RECTANGLE_SET(r, rx1, ry1, rw1, rh1);
                empty = _eina_rectangle_merge_list(empty, r);

                r = eina_rectangle_new(x2, y2, w2, h2);
             }

           if (r)
             {
                empty = _eina_rectangle_merge_list(empty, r); /* Return empty */

             }

           return empty;
        }
   }

   *x = -1;
   *y = -1;
   return empty;
}