st/vega: Get rid of renderer_copy_texture.
authorChia-I Wu <olv@lunarg.com>
Sun, 28 Nov 2010 11:45:17 +0000 (19:45 +0800)
committerChia-I Wu <olv@lunarg.com>
Wed, 1 Dec 2010 03:23:51 +0000 (11:23 +0800)
src/gallium/state_trackers/vega/image.c
src/gallium/state_trackers/vega/mask.c
src/gallium/state_trackers/vega/renderer.c
src/gallium/state_trackers/vega/renderer.h

index 88705d093eafaa96c9aba44edb5002cc8acd705a..303e979012a8957236fd3af0b108855134a573ba 100644 (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,
index 3b042cec0e467d4b6636cb0c996b2c6a4ed79c99..e40df063470a769ad30e6eb6d4d568cfa5856c3e 100644 (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;
-
-    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,
index 868393a86fa1ea6b69ea10bc2d6bd8fd58cab017..f436ee56fe985a07fc86d8b58d3d851dc60e6952 100644 (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,
index 44ea972958ed7e785576117e3159115ed0db1386..3cbd1c5e69246246d9d6943f4d62ce02e497b4df 100644 (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,