draw: corrections to allow for different cliptest cases
[mesa.git] / src / mesa / main / texgetimage.c
index d786c41d2ebb0fc9e2c74203e1b159ee73bc8741..00134ea9ffbbfb942eb05d349da45fe9809099c6 100644 (file)
 #include "context.h"
 #include "formats.h"
 #include "image.h"
-#include "texcompress.h"
 #include "texgetimage.h"
 #include "teximage.h"
-#include "texstate.h"
 
 
 
-#if FEATURE_EXT_texture_sRGB
-
-/**
- * Convert a float value from linear space to a
- * non-linear sRGB value in [0, 255].
- * Not terribly efficient.
- */
-static INLINE GLfloat
-linear_to_nonlinear(GLfloat cl)
-{
-   /* can't have values outside [0, 1] */
-   GLfloat cs;
-   if (cl < 0.0031308f) {
-      cs = 12.92f * cl;
-   }
-   else {
-      cs = (GLfloat)(1.055 * _mesa_pow(cl, 0.41666) - 0.055);
-   }
-   return cs;
-}
-
-#endif /* FEATURE_EXT_texture_sRGB */
-
-
 /**
  * Can the given type represent negative values?
  */
@@ -182,7 +156,7 @@ get_tex_depth_stencil(GLcontext *ctx, GLuint dimensions,
          void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
                                           width, height, format, type,
                                           img, row, 0);
-         _mesa_memcpy(dest, src, width * sizeof(GLuint));
+         memcpy(dest, src, width * sizeof(GLuint));
          if (ctx->Pack.SwapBytes) {
             _mesa_swap4((GLuint *) dest, width);
          }
@@ -213,7 +187,7 @@ get_tex_ycbcr(GLcontext *ctx, GLuint dimensions,
          void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels,
                                           width, height, format, type,
                                           img, row, 0);
-         _mesa_memcpy(dest, src, width * sizeof(GLushort));
+         memcpy(dest, src, width * sizeof(GLushort));
 
          /* check for byte swapping */
          if ((texImage->TexFormat == MESA_FORMAT_YCBCR
@@ -233,6 +207,29 @@ get_tex_ycbcr(GLcontext *ctx, GLuint dimensions,
 }
 
 
+#if FEATURE_EXT_texture_sRGB
+
+
+/**
+ * Convert a float value from linear space to a
+ * non-linear sRGB value in [0, 255].
+ * Not terribly efficient.
+ */
+static INLINE GLfloat
+linear_to_nonlinear(GLfloat cl)
+{
+   /* can't have values outside [0, 1] */
+   GLfloat cs;
+   if (cl < 0.0031308f) {
+      cs = 12.92f * cl;
+   }
+   else {
+      cs = (GLfloat)(1.055 * pow(cl, 0.41666) - 0.055);
+   }
+   return cs;
+}
+
+
 /**
  * glGetTexImagefor sRGB pixels;
  */
@@ -284,6 +281,21 @@ get_tex_srgb(GLcontext *ctx, GLuint dimensions,
 }
 
 
+#else /* FEATURE_EXT_texture_sRGB */
+
+
+static INLINE void
+get_tex_srgb(GLcontext *ctx, GLuint dimensions,
+             GLenum format, GLenum type, GLvoid *pixels,
+             const struct gl_texture_image *texImage)
+{
+   ASSERT_NO_FEATURE();
+}
+
+
+#endif /* FEATURE_EXT_texture_sRGB */
+
+
 /**
  * glGetTexImagefor RGBA, Luminance, etc. pixels.
  * This is the slow way since we use texture sampling.
@@ -548,7 +560,7 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
                                                   texImage->Width,
                                                   texImage->Height,
                                                   texImage->Depth);
-      _mesa_memcpy(img, texImage->Data, size);
+      memcpy(img, texImage->Data, size);
    }
    else {
       GLuint bw, bh;
@@ -578,7 +590,7 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
 {
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
-   const GLuint maxLevels = _mesa_max_texture_levels(ctx, target);
+   const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
    GLenum baseFormat;
 
    if (maxLevels == 0) {
@@ -764,7 +776,7 @@ getcompressedteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
 {
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
-   const GLuint maxLevels = _mesa_max_texture_levels(ctx, target);
+   const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
 
    if (maxLevels == 0) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImage(target=0x%x)",