xmesa_get_tile(struct pipe_context *pipe, struct pipe_surface *ps,
uint x, uint y, uint w, uint h, void *p, int dst_stride)
{
+ const uint w0 = w;
struct xmesa_surface *xms = xmesa_surface(ps);
XMesaImage *ximage = NULL;
ubyte *dst = (ubyte *) p;
switch (ps->format) {
case PIPE_FORMAT_U_A8_R8_G8_B8:
if (!dst_stride) {
- dst_stride = w * 4;
+ dst_stride = w0 * 4;
}
for (i = 0; i < h; i++) {
memcpy(dst, ximage->data + y * ximage->bytes_per_line + x * 4, 4 * w);
break;
case PIPE_FORMAT_U_R5_G6_B5:
if (!dst_stride) {
- dst_stride = w * 2;
+ dst_stride = w0 * 2;
}
for (i = 0; i < h; i++) {
memcpy(dst, ximage->data + y * ximage->bytes_per_line + x * 2, 4 * 2);
xmesa_put_tile(struct pipe_context *pipe, struct pipe_surface *ps,
uint x, uint y, uint w, uint h, const void *p, int src_stride)
{
+ const uint w0 = w;
struct xmesa_surface *xms = xmesa_surface(ps);
const ubyte *src = (const ubyte *) p;
XMesaImage *ximage;
switch (ps->format) {
case PIPE_FORMAT_U_A8_R8_G8_B8:
if (!src_stride) {
- src_stride = w * 4;
+ src_stride = w0 * 4;
}
dst = ximage->data + y * ximage->bytes_per_line + x * 4;
for (i = 0; i < h; i++) {
break;
case PIPE_FORMAT_U_R5_G6_B5:
if (!src_stride) {
- src_stride = w * 2;
+ src_stride = w0 * 2;
}
dst = ximage->data + y * ximage->bytes_per_line + x * 2;
for (i = 0; i < h; i++) {
void
xmesa_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps,
- uint x, uint y, uint w, uint h, float *p)
+ uint x, uint y, uint w, uint h, float *pixels)
{
+ const uint w0 = w;
struct xmesa_surface *xms = xmesa_surface(ps);
XMesaImage *ximage = NULL;
- float *pRow = p;
+ float *pRow = pixels;
uint i, j;
if (!xms->drawable && !xms->ximage) {
/* not an X surface */
- softpipe_get_tile_rgba(pipe, ps, x, y, w, h, p);
+ softpipe_get_tile_rgba(pipe, ps, x, y, w, h, pixels);
return;
}
p += 4;
}
src += ximage->width;
- pRow += 4 * w;
+ pRow += 4 * w0;
}
}
break;
p += 4;
}
src += ximage->width;
- pRow += 4 * w;
+ pRow += 4 * w0;
}
}
break;
void
xmesa_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps,
- uint x, uint y, uint w, uint h, const float *p)
+ uint x, uint y, uint w, uint h, const float *pixels)
{
- const uint x0 = x, y0 = y;
+ const uint x0 = x, y0 = y, w0 = w;
struct xmesa_surface *xms = xmesa_surface(ps);
XMesaImage *ximage;
uint i, j;
if (!xms->drawable && !xms->ximage) {
/* not an X surface */
- softpipe_put_tile_rgba(pipe, ps, x, y, w, h, p);
+ softpipe_put_tile_rgba(pipe, ps, x, y, w, h, pixels);
return;
}
{
uint *dst
= (uint *) (ximage->data + y * ximage->bytes_per_line + x * 4);
+ const float *pRow = pixels;
for (i = 0; i < h; i++) {
+ const float *p = pRow;
for (j = 0; j < w; j++) {
ubyte r, g, b, a;
UNCLAMPED_FLOAT_TO_UBYTE(r, p[0]);
p += 4;
}
dst += ximage->width;
+ pRow += 4 * w0;
}
}
break;
{
ushort *dst =
(ushort *) (ximage->data + y * ximage->bytes_per_line + x * 2);
+ const float *pRow = pixels;
for (i = 0; i < h; i++) {
+ const float *p = pRow;
for (j = 0; j < w; j++) {
ubyte r, g, b;
UNCLAMPED_FLOAT_TO_UBYTE(r, p[0]);
p += 4;
}
dst += ximage->width;
+ pRow += 4 * w0;
}
}
break;