コード例 #1
0
ファイル: api_images.c プロジェクト: MttDs/new-rexeno-tindpe
void vgCopyPixels(VGint dx, VGint dy,
                  VGint sx, VGint sy,
                  VGint width, VGint height)
{
   struct vg_context *ctx = vg_current_context();
   struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
   struct st_renderbuffer *strb = ctx->draw_buffer->strb;

   if (width <= 0 || height <= 0) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return;
   }

   /* do nothing if we copy from outside the fb */
   if (dx >= (VGint)fb->width || dy >= (VGint)fb->height ||
       sx >= (VGint)fb->width || sy >= (VGint)fb->height)
      return;

   vg_validate_state(ctx);
   /* make sure rendering has completed */
   vgFinish();

   vg_copy_surface(ctx, strb->surface, dx, dy,
                   strb->surface, sx, sy, width, height);
}
コード例 #2
0
ファイル: image.c プロジェクト: ChillyWillyGuru/RSXGL
void image_set_pixels(VGint dx, VGint dy,
                      struct vg_image *src, VGint sx, VGint sy,
                      VGint width, VGint height)
{
   struct vg_context *ctx = vg_current_context();
   struct pipe_context *pipe = ctx->pipe;
   struct pipe_surface *surf, surf_tmpl;
   struct st_renderbuffer *strb = ctx->draw_buffer->strb;

   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
   u_surface_default_template(&surf_tmpl, image_texture(src),
                              0 /* no bind flag - not a surface*/);
   surf = pipe->create_surface(pipe, image_texture(src), &surf_tmpl);

   vg_copy_surface(ctx, strb->surface, dx, dy,
                   surf, sx+src->x, sy+src->y, width, height);

   pipe->surface_destroy(pipe, surf);
}
コード例 #3
0
ファイル: image.c プロジェクト: CPFDSoftware-Tony/gmv
void image_set_pixels(VGint dx, VGint dy,
                      struct vg_image *src, VGint sx, VGint sy,
                      VGint width, VGint height)
{
   struct vg_context *ctx = vg_current_context();
   struct pipe_context *pipe = ctx->pipe;
   struct pipe_screen *screen = pipe->screen;
   struct pipe_surface *surf;
   struct st_renderbuffer *strb = ctx->draw_buffer->strb;

   /* make sure rendering has completed */
   pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);

   surf = screen->get_tex_surface(screen, image_texture(src),  0, 0, 0,
                                  PIPE_BUFFER_USAGE_GPU_READ);

   vg_copy_surface(ctx, strb->surface, dx, dy,
                   surf, sx+src->x, sy+src->y, width, height);

   screen->tex_surface_destroy(surf);
}
コード例 #4
0
ファイル: image.c プロジェクト: ChillyWillyGuru/RSXGL
void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
                      VGint sx, VGint sy,
                      VGint width, VGint height)
{
   struct vg_context *ctx = vg_current_context();
   struct pipe_context *pipe = ctx->pipe;
   struct pipe_surface *surf, surf_tmpl;
   struct st_renderbuffer *strb = ctx->draw_buffer->strb;

   /* flip the y coordinates */
   /*dy = dst->height - dy - height;*/

   memset(&surf_tmpl, 0, sizeof(surf_tmpl));
   u_surface_default_template(&surf_tmpl, image_texture(dst),
                              PIPE_BIND_RENDER_TARGET);
   surf = pipe->create_surface(pipe, image_texture(dst), &surf_tmpl);

   vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy,
                   strb->surface, sx, sy, width, height);

   pipe_surface_reference(&surf, NULL);
}
コード例 #5
0
ファイル: image.c プロジェクト: CPFDSoftware-Tony/gmv
void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
                      VGint sx, VGint sy,
                      VGint width, VGint height)
{
   struct vg_context *ctx = vg_current_context();
   struct pipe_context *pipe = ctx->pipe;
   struct pipe_screen *screen = pipe->screen;
   struct pipe_surface *surf;
   struct st_renderbuffer *strb = ctx->draw_buffer->strb;

   /* flip the y coordinates */
   /*dy = dst->height - dy - height;*/

   /* make sure rendering has completed */
   pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);

   surf = screen->get_tex_surface(screen, image_texture(dst),  0, 0, 0,
                                  PIPE_BUFFER_USAGE_GPU_WRITE |
                                  PIPE_BUFFER_USAGE_GPU_READ);
   vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy,
                   strb->surface, sx, sy, width, height);

   pipe_surface_reference(&surf, NULL);
}