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 void accum_accum ( GLcontext *  ctx,
GLfloat  value,
GLint  xpos,
GLint  ypos,
GLint  width,
GLint  height 
) [static]

Definition at line 273 of file s_accum.c.

Referenced by _swrast_Accum().

{
   SWcontext *swrast = SWRAST_CONTEXT(ctx);
   struct gl_renderbuffer *rb
      = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
   const GLboolean directAccess = (rb->GetPointer(ctx, rb, 0, 0) != NULL);

   assert(rb);

   if (!ctx->ReadBuffer->_ColorReadBuffer) {
      /* no read buffer - OK */
      return;
   }

   /* May have to leave optimized accum buffer mode */
   if (swrast->_IntegerAccumScaler == 0.0 && value > 0.0 && value <= 1.0)
      swrast->_IntegerAccumScaler = value;
   if (swrast->_IntegerAccumMode && value != swrast->_IntegerAccumScaler)
      rescale_accum(ctx);

   if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
      const GLfloat scale = value * ACCUM_SCALE16 / CHAN_MAXF;
      GLshort accumRow[4 * MAX_WIDTH];
      GLchan rgba[MAX_WIDTH][4];
      GLint i;

      for (i = 0; i < height; i++) {
         GLshort *acc;
         if (directAccess) {
            acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i);
         }
         else {
            rb->GetRow(ctx, rb, width, xpos, ypos + i, accumRow);
            acc = accumRow;
         }

         /* read colors from color buffer */
         _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, width,
                                xpos, ypos + i, CHAN_TYPE, rgba);

         /* do accumulation */
         if (swrast->_IntegerAccumMode) {
            /* simply add integer color values into accum buffer */
            GLint j;
            for (j = 0; j < width; j++) {
               acc[j * 4 + 0] += rgba[j][RCOMP];
               acc[j * 4 + 1] += rgba[j][GCOMP];
               acc[j * 4 + 2] += rgba[j][BCOMP];
               acc[j * 4 + 3] += rgba[j][ACOMP];
            }
         }
         else {
            /* scaled integer (or float) accum buffer */
            GLint j;
            for (j = 0; j < width; j++) {
               acc[j * 4 + 0] += (GLshort) ((GLfloat) rgba[j][RCOMP] * scale);
               acc[j * 4 + 1] += (GLshort) ((GLfloat) rgba[j][GCOMP] * scale);
               acc[j * 4 + 2] += (GLshort) ((GLfloat) rgba[j][BCOMP] * scale);
               acc[j * 4 + 3] += (GLshort) ((GLfloat) rgba[j][ACOMP] * scale);
            }
         }

         if (!directAccess) {
            rb->PutRow(ctx, rb, width, xpos, ypos + i, accumRow, NULL);
         }
      }
   }
   else {
      /* other types someday */
   }
}

Generated on Sun May 27 2012 04:59:40 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.