ilo: replace a boolean by bool
[mesa.git] / src / gallium / state_trackers / vega / image.c
index c42315e4bbade8f787bb09351b778153ea1f73ab..4434550c629bf9e4a01369a4f784ac8a108f005c 100644 (file)
@@ -139,7 +139,7 @@ static void vg_copy_texture(struct vg_context *ctx,
       struct pipe_surface *surf, surf_tmpl;
 
       /* get the destination surface */
-      u_surface_default_template(&surf_tmpl, dst, PIPE_BIND_RENDER_TARGET);
+      u_surface_default_template(&surf_tmpl, dst);
       surf = ctx->pipe->create_surface(ctx->pipe, dst, &surf_tmpl);
       if (surf && renderer_copy_begin(ctx->renderer, surf, VG_TRUE, src)) {
          renderer_copy(ctx->renderer,
@@ -418,17 +418,19 @@ void image_sub_data(struct vg_image *image,
    }
 
    { /* upload color_data */
-      struct pipe_transfer *transfer = pipe_get_transfer(
-         pipe, texture, 0, 0,
-         PIPE_TRANSFER_WRITE, 0, 0, texture->width0, texture->height0);
+      struct pipe_transfer *transfer;
+      void *map = pipe_transfer_map(pipe, texture, 0, 0,
+                                    PIPE_TRANSFER_WRITE, 0, 0,
+                                    texture->width0, texture->height0,
+                                    &transfer);
       src += (dataStride * yoffset);
       for (i = 0; i < height; i++) {
          _vega_unpack_float_span_rgba(ctx, width, xoffset, src, dataFormat, temp);
-         pipe_put_tile_rgba(pipe, transfer, x+image->x, y+image->y, width, 1, df);
+         pipe_put_tile_rgba(transfer, map, x+image->x, y+image->y, width, 1, df);
          y += yStep;
          src += dataStride;
       }
-      pipe->transfer_destroy(pipe, transfer);
+      pipe->transfer_unmap(pipe, transfer);
    }
 }
 
@@ -448,25 +450,26 @@ void image_get_sub_data(struct vg_image * image,
    VGubyte *dst = (VGubyte *)data;
 
    {
-      struct pipe_transfer *transfer =
-         pipe_get_transfer(pipe,
+      struct pipe_transfer *transfer;
+      void *map =
+         pipe_transfer_map(pipe,
                            image->sampler_view->texture,  0, 0,
                            PIPE_TRANSFER_READ,
                            0, 0,
                            image->x + image->width,
-                           image->y + image->height);
+                           image->y + image->height, &transfer);
       /* Do a row at a time to flip image data vertically */
       for (i = 0; i < height; i++) {
 #if 0
          debug_printf("%d-%d  == %d\n", sy, height, y);
 #endif
-         pipe_get_tile_rgba(pipe, transfer, sx+image->x, y, width, 1, df);
+         pipe_get_tile_rgba(transfer, map, sx+image->x, y, width, 1, df);
          y += yStep;
          _vega_pack_rgba_span_float(ctx, width, temp, dataFormat, dst);
          dst += dataStride;
       }
 
-      pipe->transfer_destroy(pipe, transfer);
+      pipe->transfer_unmap(pipe, transfer);
    }
 }
 
@@ -567,9 +570,7 @@ void image_set_pixels(VGint dx, VGint dy,
    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*/);
+   u_surface_default_template(&surf_tmpl, image_texture(src));
    surf = pipe->create_surface(pipe, image_texture(src), &surf_tmpl);
 
    vg_copy_surface(ctx, strb->surface, dx, dy,
@@ -590,9 +591,7 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
    /* 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);
+   u_surface_default_template(&surf_tmpl, image_texture(dst));
    surf = pipe->create_surface(pipe, image_texture(dst), &surf_tmpl);
 
    vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy,