diff options
author | gareth <gareth> | 2001-03-06 04:37:36 +0000 |
---|---|---|
committer | gareth <gareth> | 2001-03-06 04:37:36 +0000 |
commit | 86e3f5696de77926473bad2a1d700eb5569f8c6c (patch) | |
tree | 809d5c85665de4e74a73f0f3104f0f57385149da /xc/extras/Mesa/src/macros.h | |
parent | 2819b0e7e1edccbc3ff52b4b90241ac94f78d1e9 (diff) |
Merge tdfx-3-1-0 branch.
Diffstat (limited to 'xc/extras/Mesa/src/macros.h')
-rw-r--r-- | xc/extras/Mesa/src/macros.h | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/xc/extras/Mesa/src/macros.h b/xc/extras/Mesa/src/macros.h index 16038d3b1..8010e28bd 100644 --- a/xc/extras/Mesa/src/macros.h +++ b/xc/extras/Mesa/src/macros.h @@ -2,19 +2,19 @@ /* * Mesa 3-D graphics library * Version: 3.3 - * + * * Copyright (C) 1999 Brian Paul All Rights Reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -89,7 +89,7 @@ #define TEST_BITS(WORD, BITS) ((WORD) & (BITS)) -/* Stepping a GLfloat pointer by a byte stride +/* Stepping a GLfloat pointer by a byte stride */ #define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i)) #define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i)) @@ -160,7 +160,7 @@ do { \ case 2: (DST)[1] = (SRC)[1]; \ case 1: (DST)[0] = (SRC)[0]; \ } \ -} while(0) +} while(0) #define SUB_4V( DST, SRCA, SRCB ) \ do { \ @@ -496,4 +496,31 @@ do { \ #define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) ) + +/* Generic color packing macros + */ + +#define PACK_COLOR_8888( a, b, c, d ) \ + (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) + +#define PACK_COLOR_888( a, b, c ) \ + (((a) << 16) | ((b) << 8) | (c)) + +#define PACK_COLOR_565( a, b, c ) \ + ((((a) & 0xf8) << 8) | (((b) & 0xfc) << 3) | (((c) & 0xf8) >> 3)) + +#define PACK_COLOR_1555( a, b, c, d ) \ + ((((b) & 0xf8) << 7) | (((c) & 0xf8) << 2) | (((d) & 0xf8) >> 3) | \ + ((a) ? 0x8000 : 0)) + +#define PACK_COLOR_4444( a, b, c, d ) \ + ((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((c) & 0xf0) | ((d) >> 4)) + +#define PACK_COLOR_88( a, b ) \ + (((a) << 8) | (b)) + +#define PACK_COLOR_332( a, b, c ) \ + (((a) & 0xe0) | (((b) & 0xe0) >> 3) | (((c) & 0xc0) >> 6)) + + #endif /*MACROS_H*/ |