main: Fix whitespace in teximage.c.
[mesa.git] / src / mesa / main / texcompress_fxt1.c
index ef528b201e0c8ab1028c9be7bd3e6722910fb3ac..562359410b2b81b3922d9c98ed6fbb8b95cf578a 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.1
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  *
  * 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
- * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 
@@ -61,7 +61,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
    GLubyte *dst;
    const GLubyte *tempImage = NULL;
 
-   ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1);
+   assert(dstFormat == MESA_FORMAT_RGB_FXT1);
 
    if (srcFormat != GL_RGB ||
        srcType != GL_UNSIGNED_BYTE ||
@@ -69,14 +69,19 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
        srcPacking->RowLength != srcWidth ||
        srcPacking->SwapBytes) {
       /* convert image to RGB/GLubyte */
-      tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
-                                             baseInternalFormat,
-                                             _mesa_get_format_base_format(dstFormat),
-                                             srcWidth, srcHeight, srcDepth,
-                                             srcFormat, srcType, srcAddr,
-                                             srcPacking);
+      GLubyte *tempImageSlices[1];
+      int rgbRowStride = 3 * srcWidth * sizeof(GLubyte);
+      tempImage = malloc(srcWidth * srcHeight * 3 * sizeof(GLubyte));
       if (!tempImage)
          return GL_FALSE; /* out of memory */
+      tempImageSlices[0] = (GLubyte *) tempImage;
+      _mesa_texstore(ctx, dims,
+                     baseInternalFormat,
+                     MESA_FORMAT_RGB_UNORM8,
+                     rgbRowStride, tempImageSlices,
+                     srcWidth, srcHeight, srcDepth,
+                     srcFormat, srcType, srcAddr,
+                     srcPacking);
       pixels = tempImage;
       srcRowStride = 3 * srcWidth;
       srcFormat = GL_RGB;
@@ -111,21 +116,26 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
    GLubyte *dst;
    const GLubyte *tempImage = NULL;
 
-   ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1);
+   assert(dstFormat == MESA_FORMAT_RGBA_FXT1);
 
    if (srcFormat != GL_RGBA ||
        srcType != GL_UNSIGNED_BYTE ||
        ctx->_ImageTransferState ||
        srcPacking->SwapBytes) {
       /* convert image to RGBA/GLubyte */
-      tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
-                                             baseInternalFormat,
-                                             _mesa_get_format_base_format(dstFormat),
-                                             srcWidth, srcHeight, srcDepth,
-                                             srcFormat, srcType, srcAddr,
-                                             srcPacking);
+      GLubyte *tempImageSlices[1];
+      int rgbaRowStride = 4 * srcWidth * sizeof(GLubyte);
+      tempImage = malloc(srcWidth * srcHeight * 4 * sizeof(GLubyte));
       if (!tempImage)
          return GL_FALSE; /* out of memory */
+      tempImageSlices[0] = (GLubyte *) tempImage;
+      _mesa_texstore(ctx, dims,
+                     baseInternalFormat,
+                     MESA_FORMAT_R8G8B8A8_UNORM,
+                     rgbaRowStride, tempImageSlices,
+                     srcWidth, srcHeight, srcDepth,
+                     srcFormat, srcType, srcAddr,
+                     srcPacking);
       pixels = tempImage;
       srcRowStride = 4 * srcWidth;
       srcFormat = GL_RGBA;
@@ -1254,12 +1264,12 @@ upscale_teximage2d(GLsizei inWidth, GLsizei inHeight,
 {
    GLint i, j, k;
 
-   ASSERT(outWidth >= inWidth);
-   ASSERT(outHeight >= inHeight);
+   assert(outWidth >= inWidth);
+   assert(outHeight >= inHeight);
 #if 0
-   ASSERT(inWidth == 1 || inWidth == 2 || inHeight == 1 || inHeight == 2);
-   ASSERT((outWidth & 3) == 0);
-   ASSERT((outHeight & 3) == 0);
+   assert(inWidth == 1 || inWidth == 2 || inHeight == 1 || inHeight == 2);
+   assert((outWidth & 3) == 0);
+   assert((outHeight & 3) == 0);
 #endif
 
    for (i = 0; i < outHeight; i++) {
@@ -1615,8 +1625,8 @@ fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */
 
 
 static void
-fetch_rgb_fxt1(const GLubyte *map, const GLuint imageOffsets[],
-               GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel)
+fetch_rgb_fxt1(const GLubyte *map,
+               GLint rowStride, GLint i, GLint j, GLfloat *texel)
 {
    GLubyte rgba[4];
    fxt1_decode_1(map, rowStride, i, j, rgba);
@@ -1628,8 +1638,8 @@ fetch_rgb_fxt1(const GLubyte *map, const GLuint imageOffsets[],
 
 
 static void
-fetch_rgba_fxt1(const GLubyte *map, const GLuint imageOffsets[],
-                GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel)
+fetch_rgba_fxt1(const GLubyte *map,
+                GLint rowStride, GLint i, GLint j, GLfloat *texel)
 {
    GLubyte rgba[4];
    fxt1_decode_1(map, rowStride, i, j, rgba);
@@ -1641,7 +1651,7 @@ fetch_rgba_fxt1(const GLubyte *map, const GLuint imageOffsets[],
 
 
 compressed_fetch_func
-_mesa_get_fxt_fetch_func(gl_format format)
+_mesa_get_fxt_fetch_func(mesa_format format)
 {
    switch (format) {
    case MESA_FORMAT_RGB_FXT1: