glx: indent -br -i3 -npcs --no-tabs compsize.c

This commit is contained in:
RALOVICH, Kristóf 2008-10-13 13:12:37 +02:00 committed by Brian Paul
parent ee3a6cec36
commit f788a8ed69
1 changed files with 125 additions and 120 deletions

View File

@ -36,13 +36,14 @@
/*
** Return the number of elements per group of a specified format
*/
GLint __glElementsPerGroup(GLenum format, GLenum type)
GLint
__glElementsPerGroup(GLenum format, GLenum type)
{
/*
** To make row length computation valid for image extraction,
** packed pixel types assume elements per group equals one.
*/
switch(type) {
switch (type) {
case GL_UNSIGNED_BYTE_3_3_2:
case GL_UNSIGNED_BYTE_2_3_3_REV:
case GL_UNSIGNED_SHORT_5_6_5:
@ -67,7 +68,7 @@ GLint __glElementsPerGroup(GLenum format, GLenum type)
break;
}
switch(format) {
switch (format) {
case GL_RGB:
case GL_BGR:
return 3;
@ -101,9 +102,10 @@ GLint __glElementsPerGroup(GLenum format, GLenum type)
** Return the number of bytes per element, based on the element type (other
** than GL_BITMAP).
*/
GLint __glBytesPerElement(GLenum type)
GLint
__glBytesPerElement(GLenum type)
{
switch(type) {
switch (type) {
case GL_UNSIGNED_SHORT:
case GL_SHORT:
case GL_UNSIGNED_SHORT_5_6_5:
@ -142,13 +144,14 @@ GLint __glBytesPerElement(GLenum type)
** Compute memory required for internal packed array of data of given type
** and format.
*/
GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth,
GLint
__glImageSize(GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, GLenum target)
{
int bytes_per_row;
int components;
switch( target ) {
switch (target) {
case GL_PROXY_TEXTURE_1D:
case GL_PROXY_TEXTURE_2D:
case GL_PROXY_TEXTURE_3D:
@ -171,14 +174,16 @@ GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth,
/*
** Zero is returned if either format or type are invalid.
*/
components = __glElementsPerGroup(format,type);
components = __glElementsPerGroup(format, type);
if (type == GL_BITMAP) {
if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
bytes_per_row = (width + 7) >> 3;
} else {
}
else {
return 0;
}
} else {
}
else {
bytes_per_row = __glBytesPerElement(type) * width;
}