|
|
Compute the bounds of the region resulting from zooming a pixel span. The resulting region will be entirely inside the window/scissor bounds so no additional clipping is needed.
- Parameters:
-
| imageX,imageY | position of the mage being drawn (gl WindowPos) |
| spanX,spanY | position of span being drawing |
| width | number of pixels in span |
| x0,x1 | returned X bounds of zoomed region [x0, x1) |
| y0,y1 | returned Y bounds of zoomed region [y0, y1) |
- Returns:
- GL_TRUE if any zoomed pixels visible, GL_FALSE if totally clipped
Definition at line 48 of file s_zoom.c.
Referenced by _swrast_write_zoomed_stencil_span(), _swrast_write_zoomed_z_span(), and zoom_span().
{
const struct gl_framebuffer *fb = ctx->DrawBuffer;
GLint c0, c1, r0, r1;
ASSERT(spanX >= imageX);
ASSERT(spanY >= imageY);
c0 = imageX + (GLint) ((spanX - imageX) * ctx->Pixel.ZoomX);
c1 = imageX + (GLint) ((spanX + width - imageX) * ctx->Pixel.ZoomX);
if (c1 < c0) {
GLint tmp = c1;
c1 = c0;
c0 = tmp;
}
c0 = CLAMP(c0, fb->_Xmin, fb->_Xmax);
c1 = CLAMP(c1, fb->_Xmin, fb->_Xmax);
if (c0 == c1) {
return GL_FALSE;
}
r0 = imageY + (GLint) ((spanY - imageY) * ctx->Pixel.ZoomY);
r1 = imageY + (GLint) ((spanY + 1 - imageY) * ctx->Pixel.ZoomY);
if (r1 < r0) {
GLint tmp = r1;
r1 = r0;
r0 = tmp;
}
r0 = CLAMP(r0, fb->_Ymin, fb->_Ymax);
r1 = CLAMP(r1, fb->_Ymin, fb->_Ymax);
if (r0 == r1) {
return GL_FALSE;
}
*x0 = c0;
*x1 = c1;
*y0 = r0;
*y1 = r1;
return GL_TRUE;
}
|