[Mesa-dev] [PATCH 02/15] mesa: move _mesa_upscale_teximage2d() to texcompress_fxt1.c

Brian Paul brian.e.paul at gmail.com
Sat Sep 17 15:41:15 PDT 2011


From: Brian Paul <brianp at vmware.com>

Was used by no other code.
---
 src/mesa/main/mipmap.c           |   34 -------------------------------
 src/mesa/main/mipmap.h           |    6 -----
 src/mesa/main/texcompress_fxt1.c |   41 +++++++++++++++++++++++++++++++++++--
 3 files changed, 38 insertions(+), 43 deletions(-)

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 5f18c71..1ead5ee 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -2218,37 +2218,3 @@ do {									\
    }
 }
 
-
-/**
- * Upscale an image by replication, not (typical) stretching.
- * We use this when the image width or height is less than a
- * certain size (4, 8) and we need to upscale an image.
- */
-void
-_mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight,
-                         GLsizei outWidth, GLsizei outHeight,
-                         GLint comps, const GLchan *src, GLint srcRowStride,
-                         GLchan *dest )
-{
-   GLint i, j, k;
-
-   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);
-#endif
-
-   for (i = 0; i < outHeight; i++) {
-      const GLint ii = i % inHeight;
-      for (j = 0; j < outWidth; j++) {
-         const GLint jj = j % inWidth;
-         for (k = 0; k < comps; k++) {
-            dest[(i * outWidth + j) * comps + k]
-               = src[ii * srcRowStride + jj * comps + k];
-         }
-      }
-   }
-}
-
diff --git a/src/mesa/main/mipmap.h b/src/mesa/main/mipmap.h
index 4c7ee63..4783950 100644
--- a/src/mesa/main/mipmap.h
+++ b/src/mesa/main/mipmap.h
@@ -54,11 +54,5 @@ _mesa_rescale_teximage2d(GLuint bytesPerPixel,
                          GLint dstWidth, GLint dstHeight,
                          const GLvoid *srcImage, GLvoid *dstImage);
 
-extern void
-_mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight,
-                         GLsizei outWidth, GLsizei outHeight,
-                         GLint comps, const GLchan *src, GLint srcRowStride,
-                         GLchan *dest);
-
 
 #endif /* MIPMAP_H */
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index a75487c..1cbaba7 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -1289,6 +1289,41 @@ fxt1_quantize (GLuint *cc, const GLubyte *lines[], GLint comps)
 }
 
 
+
+/**
+ * Upscale an image by replication, not (typical) stretching.
+ * We use this when the image width or height is less than a
+ * certain size (4, 8) and we need to upscale an image.
+ */
+static void
+upscale_teximage2d(GLsizei inWidth, GLsizei inHeight,
+                   GLsizei outWidth, GLsizei outHeight,
+                   GLint comps, const GLchan *src, GLint srcRowStride,
+                   GLchan *dest )
+{
+   GLint i, j, k;
+
+   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);
+#endif
+
+   for (i = 0; i < outHeight; i++) {
+      const GLint ii = i % inHeight;
+      for (j = 0; j < outWidth; j++) {
+         const GLint jj = j % inWidth;
+         for (k = 0; k < comps; k++) {
+            dest[(i * outWidth + j) * comps + k]
+               = src[ii * srcRowStride + jj * comps + k];
+         }
+      }
+   }
+}
+
+
 static void
 fxt1_encode (GLuint width, GLuint height, GLint comps,
              const void *source, GLint srcRowStride,
@@ -1311,9 +1346,9 @@ fxt1_encode (GLuint width, GLuint height, GLint comps,
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture compression");
          goto cleanUp;
       }
-      _mesa_upscale_teximage2d(width, height, newWidth, newHeight,
-                               comps, (const GLchan *) source,
-                               srcRowStride, (GLchan *) newSource);
+      upscale_teximage2d(width, height, newWidth, newHeight,
+                         comps, (const GLchan *) source,
+                         srcRowStride, (GLchan *) newSource);
       source = newSource;
       width = newWidth;
       height = newHeight;
-- 
1.7.3.4



More information about the mesa-dev mailing list