if (src_loc[2] >= 0 && src_loc[3] >= 0 &&
dst_loc[2] >= 0 && dst_loc[3] >= 0) {
- renderer_copy_texture(ctx->renderer,
- src,
- src_loc[0],
- src_loc[1] + src_loc[3],
- src_loc[0] + src_loc[2],
- src_loc[1],
- dst,
- dst_loc[0],
- dst_loc[1] + dst_loc[3],
- dst_loc[0] + dst_loc[2],
- dst_loc[1]);
- }
+ struct pipe_surface *surf;
+
+ /* get the destination surface */
+ surf = ctx->pipe->screen->get_tex_surface(ctx->pipe->screen,
+ dst, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+ if (surf && renderer_copy_begin(ctx->renderer, surf, VG_TRUE, src)) {
+ renderer_copy(ctx->renderer,
+ dst_loc[0], dst_loc[1], dst_loc[2], dst_loc[3],
+ src_loc[0], src_loc[1], src_loc[2], src_loc[3]);
+ renderer_copy_end(ctx->renderer);
+ }
+ pipe_surface_reference(&surf, NULL);
+ }
}
void vg_copy_surface(struct vg_context *ctx,
VGint dx, VGint dy,
VGint width, VGint height)
{
- struct vg_context *ctx = vg_current_context();
- struct st_framebuffer *fb_buffers = ctx->draw_buffer;
-
- renderer_copy_texture(ctx->renderer,
- layer->sampler_view,
- sx, sy,
- sx + width, sy + height,
- fb_buffers->alpha_mask_view->texture,
- dx, dy,
- dx + width, dy + height);
+ struct vg_context *ctx = vg_current_context();
+ struct pipe_sampler_view *src = ctx->draw_buffer->alpha_mask_view;
+ struct pipe_surface *surf;
+
+ /* get the destination surface */
+ surf = ctx->pipe->screen->get_tex_surface(ctx->pipe->screen,
+ layer->sampler_view->texture, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+ if (surf && renderer_copy_begin(ctx->renderer, surf, VG_FALSE, src)) {
+ renderer_copy(ctx->renderer,
+ dx, dy, width, height,
+ sx, sy, width, height);
+ renderer_copy_end(ctx->renderer);
+ }
+
+ pipe_surface_reference(&surf, NULL);
}
static void mask_layer_render_to(struct vg_mask_layer *layer,
const_buffer, const_buffer_len);
}
-void renderer_copy_texture(struct renderer *ctx,
- struct pipe_sampler_view *src,
- VGfloat sx1, VGfloat sy1,
- VGfloat sx2, VGfloat sy2,
- struct pipe_resource *dst,
- VGfloat dx1, VGfloat dy1,
- VGfloat dx2, VGfloat dy2)
-{
- struct pipe_surface *surf;
- VGint x, y, w, h, sx, sy, sw, sh;
-
- /* get the destination surface */
- surf = ctx->pipe->screen->get_tex_surface(ctx->pipe->screen,
- dst, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
- if (!surf)
- return;
-
- assert(ctx->state == RENDERER_STATE_INIT);
- assert(src->texture->width0 != 0);
- assert(src->texture->height0 != 0);
- assert(dst->width0 != 0);
- assert(dst->height0 != 0);
-
- x = (VGint) dx1;
- y = (VGint) dy1;
- w = (VGint) (dx2 - dx1);
- h = (VGint) (dy2 - dy1);
- assert(floatsEqual(x, dx1) &&
- floatsEqual(y, dy1) &&
- floatsEqual(w, (dx2 - dx1)) &&
- floatsEqual(h, (dy2 - dy1)));
-
- sx = (VGint) sx1;
- sy = (VGint) sy1;
- sw = (VGint) (sx2 - sx1);
- sh = (VGint) (sy2 - sy1);
- assert(floatsEqual(sx, sx1) &&
- floatsEqual(sy, sy1) &&
- floatsEqual(sw, (sx2 - sx1)) &&
- floatsEqual(sh, (sy2 - sy1)));
-
- if (renderer_copy_begin(ctx, surf, VG_TRUE, src)) {
- renderer_copy(ctx, x, y, w, h, sx, sy, sw, sh);
- renderer_copy_end(ctx);
- }
-
- pipe_surface_reference(&surf, NULL);
-}
-
void renderer_copy_surface(struct renderer *ctx,
struct pipe_surface *src,
int srcX0, int srcY0,
VGfloat x2, VGfloat y2,
VGfloat x3, VGfloat y3,
VGfloat x4, VGfloat y4);
-void renderer_copy_texture(struct renderer *r,
- struct pipe_sampler_view *src,
- VGfloat sx1, VGfloat sy1,
- VGfloat sx2, VGfloat sy2,
- struct pipe_resource *dst,
- VGfloat dx1, VGfloat dy1,
- VGfloat dx2, VGfloat dy2);
+
void renderer_copy_surface(struct renderer *r,
struct pipe_surface *src,
int sx1, int sy1,