if (flip) { \
for (dstCol = 0; dstCol < dstWidth; dstCol++) { \
GLint srcCol = (dstCol * srcWidth) / dstWidth; \
- ASSERT(srcCol >= 0); \
- ASSERT(srcCol < srcWidth); \
+ assert(srcCol >= 0); \
+ assert(srcCol < srcWidth); \
srcCol = srcWidth - 1 - srcCol; /* flip */ \
if (SIZE == 1) { \
dst[dstCol] = src[srcCol]; \
else { \
for (dstCol = 0; dstCol < dstWidth; dstCol++) { \
GLint srcCol = (dstCol * srcWidth) / dstWidth; \
- ASSERT(srcCol >= 0); \
- ASSERT(srcCol < srcWidth); \
+ assert(srcCol >= 0); \
+ assert(srcCol < srcWidth); \
if (SIZE == 1) { \
dst[dstCol] = src[srcCol]; \
} \
/* Blit to all the draw buffers */
for (i = 0; i < numDrawBuffers; i++) {
if (buffer == GL_COLOR_BUFFER_BIT) {
- int idx = drawFb->_ColorDrawBufferIndexes[i];
- if (idx == -1)
+ gl_buffer_index idx = drawFb->_ColorDrawBufferIndexes[i];
+ if (idx == BUFFER_NONE)
continue;
drawAtt = &drawFb->Attachment[idx];
drawRb = drawAtt->Renderbuffer;
ctx->Driver.MapRenderbuffer(ctx, readRb, 0, 0,
readRb->Width, readRb->Height,
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
- &map, &rowStride);
+ &map, &rowStride, readFb->FlipY);
if (!map) {
goto fail_no_memory;
}
ctx->Driver.MapRenderbuffer(ctx, readRb,
srcXpos, srcYpos,
srcWidth, srcHeight,
- GL_MAP_READ_BIT, &srcMap, &srcRowStride);
+ GL_MAP_READ_BIT, &srcMap, &srcRowStride,
+ readFb->FlipY);
if (!srcMap) {
goto fail_no_memory;
}
ctx->Driver.MapRenderbuffer(ctx, drawRb,
dstXpos, dstYpos,
dstWidth, dstHeight,
- GL_MAP_WRITE_BIT, &dstMap, &dstRowStride);
+ GL_MAP_WRITE_BIT, &dstMap, &dstRowStride,
+ drawFb->FlipY);
if (!dstMap) {
ctx->Driver.UnmapRenderbuffer(ctx, readRb);
goto fail_no_memory;
for (dstRow = 0; dstRow < dstHeight; dstRow++) {
GLfloat srcRowF = (dstRow + 0.5F) / dstHeight * srcHeight - 0.5F;
- GLint srcRow = IROUND(srcRowF);
+ GLint srcRow = lroundf(srcRowF);
GLubyte *dstRowStart = dstMap + dstRowStride * dstRow;
- ASSERT(srcRow >= 0);
- ASSERT(srcRow < srcHeight);
+ assert(srcRow >= 0);
+ assert(srcRow < srcHeight);
if (invertY) {
srcRow = srcHeight - 1 - srcRow;
break;
}
- (*resampleRow)(srcWidth, dstWidth, srcBuffer, dstBuffer, invertX);
+ resampleRow(srcWidth, dstWidth, srcBuffer, dstBuffer, invertX);
prevY = srcRow;
}
for (dstCol = 0; dstCol < dstWidth; dstCol++) {
const GLfloat srcCol = (dstCol + 0.5F) / dstWidth * srcWidth - 0.5F;
- GLint srcCol0 = MAX2(0, IFLOOR(srcCol));
+ GLint srcCol0 = MAX2(0, util_ifloor(srcCol));
GLint srcCol1 = srcCol0 + 1;
GLfloat colWeight = srcCol - srcCol0; /* fractional part of srcCol */
GLfloat red, green, blue, alpha;
- ASSERT(srcCol0 < srcWidth);
- ASSERT(srcCol1 <= srcWidth);
+ assert(srcCol0 < srcWidth);
+ assert(srcCol1 <= srcWidth);
if (srcCol1 == srcWidth) {
/* last column fudge */
alpha = lerp_2d(colWeight, rowWeight,
srcColor0[srcCol0][ACOMP], srcColor0[srcCol1][ACOMP],
srcColor1[srcCol0][ACOMP], srcColor1[srcCol1][ACOMP]);
-
- dstColor[dstCol][RCOMP] = IFLOOR(red);
- dstColor[dstCol][GCOMP] = IFLOOR(green);
- dstColor[dstCol][BCOMP] = IFLOOR(blue);
- dstColor[dstCol][ACOMP] = IFLOOR(alpha);
+
+ dstColor[dstCol][RCOMP] = util_ifloor(red);
+ dstColor[dstCol][GCOMP] = util_ifloor(green);
+ dstColor[dstCol][BCOMP] = util_ifloor(blue);
+ dstColor[dstCol][ACOMP] = util_ifloor(alpha);
}
}
for (dstCol = 0; dstCol < dstWidth; dstCol++) {
const GLfloat srcCol = (dstCol + 0.5F) / dstWidth * srcWidth - 0.5F;
- GLint srcCol0 = MAX2(0, IFLOOR(srcCol));
+ GLint srcCol0 = MAX2(0, util_ifloor(srcCol));
GLint srcCol1 = srcCol0 + 1;
GLfloat colWeight = srcCol - srcCol0; /* fractional part of srcCol */
GLfloat red, green, blue, alpha;
- ASSERT(srcCol0 < srcWidth);
- ASSERT(srcCol1 <= srcWidth);
+ assert(srcCol0 < srcWidth);
+ assert(srcCol1 <= srcWidth);
if (srcCol1 == srcWidth) {
/* last column fudge */
alpha = lerp_2d(colWeight, rowWeight,
srcColor0[srcCol0][ACOMP], srcColor0[srcCol1][ACOMP],
srcColor1[srcCol0][ACOMP], srcColor1[srcCol1][ACOMP]);
-
+
dstColor[dstCol][RCOMP] = red;
dstColor[dstCol][GCOMP] = green;
dstColor[dstCol][BCOMP] = blue;
}
for (i = 0; i < drawFb->_NumColorDrawBuffers; i++) {
- GLint idx = drawFb->_ColorDrawBufferIndexes[i];
+ gl_buffer_index idx = drawFb->_ColorDrawBufferIndexes[i];
struct gl_renderbuffer_attachment *drawAtt;
struct gl_renderbuffer *drawRb;
mesa_format drawFormat;
- if (idx == -1)
+ if (idx == BUFFER_NONE)
continue;
drawAtt = &drawFb->Attachment[idx];
ctx->Driver.MapRenderbuffer(ctx, readRb,
0, 0, readRb->Width, readRb->Height,
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
- &srcMap, &srcRowStride);
+ &srcMap, &srcRowStride,
+ readFb->FlipY);
if (!srcMap) {
goto fail_no_memory;
}
*/
ctx->Driver.MapRenderbuffer(ctx, readRb,
0, 0, readRb->Width, readRb->Height,
- GL_MAP_READ_BIT, &srcMap, &srcRowStride);
+ GL_MAP_READ_BIT, &srcMap, &srcRowStride,
+ readFb->FlipY);
if (!srcMap) {
goto fail_no_memory;
}
ctx->Driver.MapRenderbuffer(ctx, drawRb,
0, 0, drawRb->Width, drawRb->Height,
- GL_MAP_WRITE_BIT, &dstMap, &dstRowStride);
+ GL_MAP_WRITE_BIT, &dstMap, &dstRowStride,
+ drawFb->FlipY);
if (!dstMap) {
ctx->Driver.UnmapRenderbuffer(ctx, readRb);
goto fail_no_memory;
for (dstRow = 0; dstRow < dstHeight; dstRow++) {
const GLint dstY = dstYpos + dstRow;
GLfloat srcRow = (dstRow + 0.5F) / dstHeight * srcHeight - 0.5F;
- GLint srcRow0 = MAX2(0, IFLOOR(srcRow));
+ GLint srcRow0 = MAX2(0, util_ifloor(srcRow));
GLint srcRow1 = srcRow0 + 1;
GLfloat rowWeight = srcRow - srcRow0; /* fractional part of srcRow */
}
}
else {
- ASSERT(filter == GL_LINEAR);
+ assert(filter == GL_LINEAR);
if (mask & GL_COLOR_BUFFER_BIT) { /* depth/stencil not allowed */
blit_linear(ctx, readFb, drawFb, srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1);