summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_format.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-03-31 21:16:16 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-03-31 21:27:47 +0100
commit018aae950df449a18d7d69de54d51af587be94c6 (patch)
tree6100c28b900120bdf2401cec854796e3a79efb6c /src/gallium/auxiliary/util/u_format.c
parentb8012643e1f5f6e49593ec8f04d3721df53e6afb (diff)
util: Make the accessors bidimensional again.
Otherwise there's no way to unpack blocks with height >1
Diffstat (limited to 'src/gallium/auxiliary/util/u_format.c')
-rw-r--r--src/gallium/auxiliary/util/u_format.c36
1 files changed, 4 insertions, 32 deletions
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
index 11ef839ec19..7f16cf7d018 100644
--- a/src/gallium/auxiliary/util/u_format.c
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -44,8 +44,6 @@ util_format_read_4f(enum pipe_format format,
const struct util_format_description *format_desc;
const uint8_t *src_row;
float *dst_row;
- unsigned row_blocks;
- unsigned i;
format_desc = util_format_description(format);
@@ -54,13 +52,8 @@ util_format_read_4f(enum pipe_format format,
src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
dst_row = dst;
- row_blocks = (w + format_desc->block.width - 1) / format_desc->block.width;
- for (i = 0; i < h; i += format_desc->block.height) {
- format_desc->unpack_float(dst_row, src_row, row_blocks);
- src_row += src_stride;
- dst_row += dst_stride/sizeof(*dst_row);
- }
+ format_desc->unpack_float(dst_row, dst_stride, src_row, src_stride, w, h);
}
@@ -73,8 +66,6 @@ util_format_write_4f(enum pipe_format format,
const struct util_format_description *format_desc;
uint8_t *dst_row;
const float *src_row;
- unsigned row_blocks;
- unsigned i;
format_desc = util_format_description(format);
@@ -83,13 +74,8 @@ util_format_write_4f(enum pipe_format format,
dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
src_row = src;
- row_blocks = (w + format_desc->block.width - 1) / format_desc->block.width;
- for (i = 0; i < h; i += format_desc->block.height) {
- format_desc->pack_float(dst_row, src_row, row_blocks);
- dst_row += dst_stride;
- src_row += src_stride/sizeof(*src_row);
- }
+ format_desc->pack_float(dst_row, dst_stride, src_row, src_stride, w, h);
}
@@ -99,8 +85,6 @@ util_format_read_4ub(enum pipe_format format, uint8_t *dst, unsigned dst_stride,
const struct util_format_description *format_desc;
const uint8_t *src_row;
uint8_t *dst_row;
- unsigned row_blocks;
- unsigned i;
format_desc = util_format_description(format);
@@ -109,13 +93,8 @@ util_format_read_4ub(enum pipe_format format, uint8_t *dst, unsigned dst_stride,
src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
dst_row = dst;
- row_blocks = (w + format_desc->block.width - 1) / format_desc->block.width;
- for (i = 0; i < h; i += format_desc->block.height) {
- format_desc->unpack_8unorm(dst_row, src_row, row_blocks);
- src_row += src_stride;
- dst_row += dst_stride/sizeof(*dst_row);
- }
+ format_desc->unpack_8unorm(dst_row, dst_stride, src_row, src_stride, w, h);
}
@@ -125,8 +104,6 @@ util_format_write_4ub(enum pipe_format format, const uint8_t *src, unsigned src_
const struct util_format_description *format_desc;
uint8_t *dst_row;
const uint8_t *src_row;
- unsigned row_blocks;
- unsigned i;
format_desc = util_format_description(format);
@@ -135,12 +112,7 @@ util_format_write_4ub(enum pipe_format format, const uint8_t *src, unsigned src_
dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
src_row = src;
- row_blocks = (w + format_desc->block.width - 1) / format_desc->block.width;
- for (i = 0; i < h; i += format_desc->block.height) {
- format_desc->pack_8unorm(dst_row, src_row, row_blocks);
- dst_row += dst_stride;
- src_row += src_stride/sizeof(*src_row);
- }
+ format_desc->pack_8unorm(dst_row, dst_stride, src_row, src_stride, w, h);
}