ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

static GLboolean compute_zoomed_bounds ( GLcontext *  ctx,
GLint  imageX,
GLint  imageY,
GLint  spanX,
GLint  spanY,
GLint  width,
GLint x0,
GLint x1,
GLint y0,
GLint y1 
) [static]

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,imageYposition of the mage being drawn (gl WindowPos)
spanX,spanYposition of span being drawing
widthnumber of pixels in span
x0,x1returned X bounds of zoomed region [x0, x1)
y0,y1returned 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);

   /*
    * Compute destination columns: [c0, c1)
    */
   c0 = imageX + (GLint) ((spanX - imageX) * ctx->Pixel.ZoomX);
   c1 = imageX + (GLint) ((spanX + width - imageX) * ctx->Pixel.ZoomX);
   if (c1 < c0) {
      /* swap */
      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; /* no width */
   }

   /*
    * Compute destination rows: [r0, r1)
    */
   r0 = imageY + (GLint) ((spanY - imageY) * ctx->Pixel.ZoomY);
   r1 = imageY + (GLint) ((spanY + 1 - imageY) * ctx->Pixel.ZoomY);
   if (r1 < r0) {
      /* swap */
      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; /* no height */
   }

   *x0 = c0;
   *x1 = c1;
   *y0 = r0;
   *y1 = r1;

   return GL_TRUE;
}

Generated on Sun May 27 2012 04:59:54 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.