• Home
  • Raw
  • Download

Lines Matching +full:array +full:- +full:bounds

2  * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
44 * Flip the order of the 2 bytes in each word in the given array (src) and
45 * store the result in another array (dst). For in-place byte-swapping this
46 * function can be called with the same array for src and dst.
48 * \param dst the array where byte-swapped data will be stored.
49 * \param src the array with the source data we want to byte-swap.
68 * Flip the order of the 4 bytes in each word in the given array (src) and
69 * store the result in another array (dst). For in-place byte-swapping this
70 * function can be called with the same array for src and dst.
72 * \param dst the array where byte-swapped data will be stored.
73 * \param src the array with the source data we want to byte-swap.
127 GLint skipimages; /* for 3-D volume images */ in _mesa_image_offset()
132 alignment = packing->Alignment; in _mesa_image_offset()
133 if (packing->RowLength > 0) { in _mesa_image_offset()
134 pixels_per_row = packing->RowLength; in _mesa_image_offset()
139 if (packing->ImageHeight > 0) { in _mesa_image_offset()
140 rows_per_image = packing->ImageHeight; in _mesa_image_offset()
146 skippixels = packing->SkipPixels; in _mesa_image_offset()
148 skiprows = packing->SkipRows; in _mesa_image_offset()
150 skipimages = (dimensions == 3) ? packing->SkipImages : 0; in _mesa_image_offset()
172 /* Non-BITMAP data */ in _mesa_image_offset()
184 bytes_per_row += (alignment - remainder); in _mesa_image_offset()
190 if (packing->Invert) { in _mesa_image_offset()
192 topOfImage = bytes_per_row * (height - 1); in _mesa_image_offset()
193 bytes_per_row = -bytes_per_row; in _mesa_image_offset()
292 * \return the stride in bytes for the given parameters, or -1 if error
303 if (packing->RowLength == 0) { in _mesa_image_row_stride()
307 bytesPerRow = (packing->RowLength + 7) / 8; in _mesa_image_row_stride()
311 /* Non-BITMAP data */ in _mesa_image_row_stride()
314 return -1; /* error */ in _mesa_image_row_stride()
315 if (packing->RowLength == 0) { in _mesa_image_row_stride()
319 bytesPerRow = bytesPerPixel * packing->RowLength; in _mesa_image_row_stride()
323 remainder = bytesPerRow % packing->Alignment; in _mesa_image_row_stride()
325 bytesPerRow += (packing->Alignment - remainder); in _mesa_image_row_stride()
328 if (packing->Invert) { in _mesa_image_row_stride()
330 bytesPerRow = -bytesPerRow; in _mesa_image_row_stride()
351 if (packing->RowLength == 0) { in _mesa_image_image_stride()
355 bytesPerRow = (packing->RowLength + 7) / 8; in _mesa_image_image_stride()
362 return -1; /* error */ in _mesa_image_image_stride()
363 if (packing->RowLength == 0) { in _mesa_image_image_stride()
367 bytesPerRow = bytesPerPixel * packing->RowLength; in _mesa_image_image_stride()
371 remainder = bytesPerRow % packing->Alignment; in _mesa_image_image_stride()
373 bytesPerRow += (packing->Alignment - remainder); in _mesa_image_image_stride()
375 if (packing->ImageHeight == 0) in _mesa_image_image_stride()
378 bytesPerImage = bytesPerRow * packing->ImageHeight; in _mesa_image_image_stride()
386 * "Expand" a bitmap from 1-bit per pixel to 8-bits per pixel.
416 if (unpack->LsbFirst) { in _mesa_expand_bitmap()
418 GLubyte mask = 1U << (unpack->SkipPixels & 0x7); in _mesa_expand_bitmap()
440 GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); in _mesa_expand_bitmap()
472 * region is entirely within the window and scissor bounds.
473 * NOTE: this will only work when glPixelZoom is (1, 1) or (1, -1).
474 * If Pixel.ZoomY is -1, *destY will be changed to be the first row which
475 * we'll actually write. Beforehand, *destY-1 is the first drawing row.
486 const struct gl_framebuffer *buffer = ctx->DrawBuffer; in _mesa_clip_drawpixels()
488 if (unpack->RowLength == 0) { in _mesa_clip_drawpixels()
489 unpack->RowLength = *width; in _mesa_clip_drawpixels()
492 assert(ctx->Pixel.ZoomX == 1.0F); in _mesa_clip_drawpixels()
493 assert(ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F); in _mesa_clip_drawpixels()
496 if (*destX < buffer->_Xmin) { in _mesa_clip_drawpixels()
497 unpack->SkipPixels += (buffer->_Xmin - *destX); in _mesa_clip_drawpixels()
498 *width -= (buffer->_Xmin - *destX); in _mesa_clip_drawpixels()
499 *destX = buffer->_Xmin; in _mesa_clip_drawpixels()
502 if (*destX + *width > buffer->_Xmax) in _mesa_clip_drawpixels()
503 *width -= (*destX + *width - buffer->_Xmax); in _mesa_clip_drawpixels()
508 if (ctx->Pixel.ZoomY == 1.0F) { in _mesa_clip_drawpixels()
510 if (*destY < buffer->_Ymin) { in _mesa_clip_drawpixels()
511 unpack->SkipRows += (buffer->_Ymin - *destY); in _mesa_clip_drawpixels()
512 *height -= (buffer->_Ymin - *destY); in _mesa_clip_drawpixels()
513 *destY = buffer->_Ymin; in _mesa_clip_drawpixels()
516 if (*destY + *height > buffer->_Ymax) in _mesa_clip_drawpixels()
517 *height -= (*destY + *height - buffer->_Ymax); in _mesa_clip_drawpixels()
521 if (*destY > buffer->_Ymax) { in _mesa_clip_drawpixels()
522 unpack->SkipRows += (*destY - buffer->_Ymax); in _mesa_clip_drawpixels()
523 *height -= (*destY - buffer->_Ymax); in _mesa_clip_drawpixels()
524 *destY = buffer->_Ymax; in _mesa_clip_drawpixels()
527 if (*destY - *height < buffer->_Ymin) in _mesa_clip_drawpixels()
528 *height -= (buffer->_Ymin - (*destY - *height)); in _mesa_clip_drawpixels()
530 (*destY)--; in _mesa_clip_drawpixels()
543 * so that the image region is entirely within the window bounds.
545 * scissor box is ignored, and we use the bounds of the current readbuffer
548 * \return GL_TRUE if region to read is in bounds
549 * GL_FALSE if region is completely out of bounds (nothing to read)
557 const struct gl_framebuffer *buffer = ctx->ReadBuffer; in _mesa_clip_readpixels()
558 struct gl_renderbuffer *rb = buffer->_ColorReadBuffer; in _mesa_clip_readpixels()
563 clip_width = rb->Width; in _mesa_clip_readpixels()
564 clip_height = rb->Height; in _mesa_clip_readpixels()
566 clip_width = buffer->Width; in _mesa_clip_readpixels()
567 clip_height = buffer->Height; in _mesa_clip_readpixels()
571 if (pack->RowLength == 0) { in _mesa_clip_readpixels()
572 pack->RowLength = *width; in _mesa_clip_readpixels()
577 pack->SkipPixels += (0 - *srcX); in _mesa_clip_readpixels()
578 *width -= (0 - *srcX); in _mesa_clip_readpixels()
583 *width -= (*srcX + *width - clip_width); in _mesa_clip_readpixels()
590 pack->SkipRows += (0 - *srcY); in _mesa_clip_readpixels()
591 *height -= (0 - *srcY); in _mesa_clip_readpixels()
596 *height -= (*srcY + *height - clip_height); in _mesa_clip_readpixels()
608 * bounds. Clip the source region against the framebuffer bounds and
619 const struct gl_framebuffer *fb = ctx->ReadBuffer; in _mesa_clip_copytexsubimage()
622 if (_mesa_clip_to_region(0, 0, fb->Width, fb->Height, in _mesa_clip_copytexsubimage()
624 *destX = *destX + *srcX - srcX0; in _mesa_clip_copytexsubimage()
625 *destY = *destY + *srcY - srcY0; in _mesa_clip_copytexsubimage()
637 * Clip the rectangle defined by (x, y, width, height) against the bounds
649 *width -= (xmin - *x); in _mesa_clip_to_region()
655 *width -= (*x + *width - xmax); in _mesa_clip_to_region()
662 *height -= (ymin - *y); in _mesa_clip_to_region()
668 *height -= (*y + *height - ymax); in _mesa_clip_to_region()
690 t = (GLfloat) (maxValue - *dstX0) / (GLfloat) (*dstX1 - *dstX0); in clip_right_or_top()
694 bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F; in clip_right_or_top()
695 *srcX1 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias); in clip_right_or_top()
700 t = (GLfloat) (maxValue - *dstX1) / (GLfloat) (*dstX0 - *dstX1); in clip_right_or_top()
704 bias = (*srcX0 < *srcX1) ? -0.5F : 0.5F; in clip_right_or_top()
705 *srcX0 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias); in clip_right_or_top()
723 t = (GLfloat) (minValue - *dstX0) / (GLfloat) (*dstX1 - *dstX0); in clip_left_or_bottom()
727 bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F; in clip_left_or_bottom()
728 *srcX0 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias); in clip_left_or_bottom()
733 t = (GLfloat) (minValue - *dstX1) / (GLfloat) (*dstX0 - *dstX1); in clip_left_or_bottom()
737 bias = (*srcX0 < *srcX1) ? -0.5F : 0.5F; in clip_left_or_bottom()
738 *srcX1 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias); in clip_left_or_bottom()
745 * The dest rect is clipped against both the buffer bounds and scissor bounds.
746 * The src rect is just clipped against the buffer bounds.
764 const GLint srcXmax = readFb->Width; in _mesa_clip_blit()
766 const GLint srcYmax = readFb->Height; in _mesa_clip_blit()
768 /* these include scissor bounds */ in _mesa_clip_blit()
769 const GLint dstXmin = drawFb->_Xmin; in _mesa_clip_blit()
770 const GLint dstXmax = drawFb->_Xmax; in _mesa_clip_blit()
771 const GLint dstYmin = drawFb->_Ymin; in _mesa_clip_blit()
772 const GLint dstYmax = drawFb->_Ymax; in _mesa_clip_blit()
785 return GL_FALSE; /* totally out (left) of bounds */ in _mesa_clip_blit()
787 return GL_FALSE; /* totally out (right) of bounds */ in _mesa_clip_blit()
872 assert(packing->SwapBytes); in _mesa_swap_bytes_2d_image()