mesa: Fix the size per pixel for packed pixel format data type.
authorXiang, Haihao <haihao.xiang@intel.com>
Tue, 6 Jan 2009 07:37:45 +0000 (15:37 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Tue, 6 Jan 2009 07:37:45 +0000 (15:37 +0800)
src/mesa/main/image.c
src/mesa/main/image.h
src/mesa/main/mipmap.c

index c205b4b766da71fae0c3f9bfade664cf5f30e754..4d86c5477753960575998845fbcbdab0199bf997 100644 (file)
@@ -61,7 +61,7 @@
 /**
  * \return GL_TRUE if type is packed pixel type, GL_FALSE otherwise.
  */
-static GLboolean
+GLboolean
 _mesa_type_is_packed(GLenum type)
 {
    switch (type) {
index 38e1374c20ca3da0c8d15000850e9b3058ed0e24..0e0bbd96d85db1f7ea924bb9eaf81b9d45527830 100644 (file)
@@ -36,6 +36,9 @@ _mesa_swap2( GLushort *p, GLuint n );
 extern void
 _mesa_swap4( GLuint *p, GLuint n );
 
+extern GLboolean
+_mesa_type_is_packed(GLenum type);
+
 extern GLint
 _mesa_sizeof_type( GLenum type );
 
index 9e051ace25b2abaeb5a19661981850345b2ff491..3dd4b3391b9b191af23cdb166bb33fa17d17346c 100644 (file)
@@ -41,7 +41,11 @@ bytes_per_pixel(GLenum datatype, GLuint comps)
 {
    GLint b = _mesa_sizeof_packed_type(datatype);
    assert(b >= 0);
-   return b * comps;
+
+   if (_mesa_type_is_packed(datatype))
+       return b;
+   else
+       return b * comps;
 }