diff options
author | Eric Anholt <[email protected]> | 2007-05-18 14:14:12 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2007-05-18 14:14:12 -0700 |
commit | 1bdee1853627e08894bd267b8f0ec176a1b5978f (patch) | |
tree | 78c3b8bb81e866de4544d2621abb633b008095ab /src/mesa/swrast/s_zoom.c | |
parent | c085e350df593ab2af60f53b86265db4c3eab38a (diff) | |
parent | 4fca6bfa5d211a093c54b0bbeadaa38081e8c141 (diff) |
Merge branch 'master' into i915-unification
Conflicts:
src/mesa/drivers/dri/common/dri_bufmgr.c
src/mesa/drivers/dri/common/dri_drmpool.c
src/mesa/drivers/dri/i915tex/intel_batchpool.c
src/mesa/drivers/dri/i915tex/intel_buffer_objects.c
src/mesa/drivers/dri/i915tex/intel_regions.c
src/mesa/drivers/dri/i915tex/intel_screen.c
src/mesa/drivers/dri/i915tex/intel_screen.h
Diffstat (limited to 'src/mesa/swrast/s_zoom.c')
-rw-r--r-- | src/mesa/swrast/s_zoom.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c index 1fac7498aa8..0908265fe9d 100644 --- a/src/mesa/swrast/s_zoom.c +++ b/src/mesa/swrast/s_zoom.c @@ -37,8 +37,9 @@ * 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. - * \param imageX, imageY position of the overall image being drawn + * \param imageX, imageY position of the mage being drawn (gl WindowPos) * \param spanX, spanY position of span being drawing + * \param width number of pixels in span * \param x0, x1 returned X bounds of zoomed region [x0, x1) * \param y0, y1 returned Y bounds of zoomed region [y0, y1) * \return GL_TRUE if any zoomed pixels visible, GL_FALSE if totally clipped @@ -98,7 +99,11 @@ compute_zoomed_bounds(GLcontext *ctx, GLint imageX, GLint imageY, /** - * Can use this for unzooming X or Y values. + * Convert a zoomed x image coordinate back to an unzoomed x coord. + * 'zx' is screen position of a pixel in the zoomed image, who's left edge + * is at 'imageX'. + * return corresponding x coord in the original, unzoomed image. + * This can use this for unzooming X or Y values. */ static INLINE GLint unzoom_x(GLfloat zoomX, GLint imageX, GLint zx) @@ -108,7 +113,10 @@ unzoom_x(GLfloat zoomX, GLint imageX, GLint zx) zx - imageX = (x - imageX) * zoomX; (zx - imageX) / zoomX = x - imageX; */ - GLint x = imageX + (GLint) ((zx - imageX) / zoomX); + GLint x; + if (zoomX < 0.0) + zx++; + x = imageX + (GLint) ((zx - imageX) / zoomX); return x; } |