st/vega: Get rid of renderer_copy_texture.

This commit is contained in:
Chia-I Wu 2010-11-28 19:45:17 +08:00
parent 33ca973e7a
commit 20ce148c30
4 changed files with 28 additions and 77 deletions

View file

@ -135,19 +135,20 @@ static void vg_copy_texture(struct vg_context *ctx,
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,

View file

@ -399,16 +399,21 @@ void mask_copy(struct vg_mask_layer *layer,
VGint dx, VGint dy,
VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
struct st_framebuffer *fb_buffers = ctx->draw_buffer;
struct vg_context *ctx = vg_current_context();
struct pipe_sampler_view *src = ctx->draw_buffer->alpha_mask_view;
struct pipe_surface *surf;
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);
/* 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,

View file

@ -1308,55 +1308,6 @@ void renderer_validate_for_shader(struct renderer *renderer,
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,

View file

@ -139,13 +139,7 @@ void renderer_texture_quad(struct renderer *,
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,