}
+#define FLIP(Y) Y = xrb->St.Base.Height - (Y) - 1;
+
+
/**
* quad reading/writing
* These functions are just wrappers around the existing renderbuffer
* functions.
+ * Note that Y=0 is the top of the surface.
*/
static void
read_quad_f(struct softpipe_surface *sps, GLint x, GLint y,
GLfloat (*rgba)[NUM_CHANNELS])
{
- struct xmesa_surface *xms = xmesa_surf(sps);
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
GLubyte temp[16];
GLfloat *dst = (GLfloat *) rgba;
GLuint i;
GET_CURRENT_CONTEXT(ctx);
+ FLIP(y);
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, temp);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y + 1, temp + 8);
+ xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8);
for (i = 0; i < 16; i++) {
dst[i] = UBYTE_TO_FLOAT(temp[i]);
}
read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
GLfloat (*rrrr)[QUAD_SIZE])
{
- struct xmesa_surface *xms = xmesa_surf(sps);
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
GLubyte temp[16];
GLfloat *dst = (GLfloat *) rrrr;
GLuint i, j;
GET_CURRENT_CONTEXT(ctx);
+ FLIP(y);
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, temp);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y + 1, temp + 8);
+ xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8);
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
dst[j * 4 + i] = UBYTE_TO_FLOAT(temp[i * 4 + j]);
const GLfloat *src = (const GLfloat *) rgba;
GLuint i;
GET_CURRENT_CONTEXT(ctx);
+ FLIP(y);
for (i = 0; i < 16; i++) {
UNCLAMPED_FLOAT_TO_UBYTE(temp[i], src[i]);
}
xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y, temp, NULL);
- xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y + 1, temp + 8, NULL);
+ xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8, NULL);
}
static void
const GLfloat *src = (const GLfloat *) rrrr;
GLuint i, j;
GET_CURRENT_CONTEXT(ctx);
+ FLIP(y);
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
UNCLAMPED_FLOAT_TO_UBYTE(temp[j * 4 + i], src[i * 4 + j]);
}
}
xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y, temp, NULL);
- xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y + 1, temp + 8, NULL);
+ xrb->St.Base.PutRow(ctx, &xrb->St.Base, 2, x, y - 1, temp + 8, NULL);
}
static void
{
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
GET_CURRENT_CONTEXT(ctx);
+ FLIP(y);
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, rgba);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y + 1, rgba + 2);
+ xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, rgba + 2);
}
static void
{
struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
GET_CURRENT_CONTEXT(ctx);
+ FLIP(y);
xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y, rgba);
- xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y + 1, rgba + 2);
-}
-
-#if 0
-static void
-write_mono_row_ub(struct softpipe_surface *sps, GLuint count, GLint x, GLint y,
- GLubyte rgba[NUM_CHANNELS])
-{
- struct xmesa_renderbuffer *xrb = xmesa_rb(sps);
- GET_CURRENT_CONTEXT(ctx);
- xrb->St.Base.PutMonoRow(ctx, &xrb->St.Base, count, x, y, rgba, NULL);
+ xrb->St.Base.GetRow(ctx, &xrb->St.Base, 2, x, y - 1, rgba + 2);
}
-#endif
/**