summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-03-30 19:48:30 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-03-30 19:48:30 +0100
commitb4de7c4c5fc1a6b103fea1139c7a01f0d6a401ad (patch)
tree2be787b2637f3c625a1fa89aa32b87c8b2af05df /src
parentffaff2736f703523a603f758254b682e6e698ae5 (diff)
python: Read rgba8 with a single transfer.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/python/p_texture.i31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i
index 47bcd4ba3c..db7a1358e1 100644
--- a/src/gallium/state_trackers/python/p_texture.i
+++ b/src/gallium/state_trackers/python/p_texture.i
@@ -225,31 +225,28 @@ struct st_surface
if(!*STRING)
return;
- rgba = malloc(w*4*sizeof(float));
+ rgba = malloc(h*w*4*sizeof(float));
if(!rgba)
return;
rgba8 = (unsigned char *) *STRING;
- for(j = 0; j < h; ++j) {
- transfer = screen->get_tex_transfer(screen,
- $self->texture,
- $self->face,
- $self->level,
- $self->zslice,
- PIPE_TRANSFER_READ,
- x, y + j,
- w,
- 1);
- if(transfer) {
- pipe_get_tile_rgba(transfer,
- 0, 0, w, 1,
- rgba);
+ transfer = screen->get_tex_transfer(screen,
+ $self->texture,
+ $self->face,
+ $self->level,
+ $self->zslice,
+ PIPE_TRANSFER_READ,
+ x, y,
+ w, h);
+ if(transfer) {
+ pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba);
+ for(j = 0; j < h; ++j) {
for(i = 0; i < w; ++i)
for(k = 0; k <4; ++k)
- rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[i*4 + k]);
- screen->tex_transfer_destroy(transfer);
+ rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[j*w*4 + i*4 + k]);
}
+ screen->tex_transfer_destroy(transfer);
}
free(rgba);