summaryrefslogtreecommitdiff
path: root/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp
diff options
context:
space:
mode:
authorGuy Zadikario <guy@graphtech.co.il>2011-04-10 10:31:14 +0300
committerGuy Zadikario <guy@graphtech.co.il>2011-04-13 13:33:26 +0300
commitfc2d0b09ececb6316cf054264e58c8f453737cfb (patch)
tree190c137db95002ec723c507ca6465dae1407861e /tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp
parentcaafd4df2e0443e0c20dc405b1bfe3e947df36f8 (diff)
emulator opengl: Added glUtilsPixelBitSize function to glUtils.
moved pixel size calculation from GLClientState to glUtils to be used outside the client state scope. (needed for the renderControl encoder which will follow in next commit). Change-Id: I5adbc40b241537054c6743e2afc52ba44454664f
Diffstat (limited to 'tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp')
-rw-r--r--tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp51
1 files changed, 1 insertions, 50 deletions
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp
index 7fc506821..9c70fc16c 100644
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp
@@ -164,56 +164,7 @@ int GLClientState::setPixelStore(GLenum param, GLint value)
size_t GLClientState::pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack)
{
-
- int components = 0;
- int componentsize = 0;
- int pixelsize = 0;
- switch(type) {
- case GL_UNSIGNED_BYTE:
- componentsize = 1;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- pixelsize = 2;
- break;
- default:
- ERR("pixelDataSize: unknown pixel type - assuming pixel data 0\n");
- componentsize = 0;
- }
-
- if (pixelsize == 0) {
- switch(format) {
-#if 0
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
-#endif
- case GL_ALPHA:
- case GL_LUMINANCE:
- components = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- components = 2;
- break;
- case GL_RGB:
-#if 0
- case GL_BGR:
-#endif
- components = 3;
- break;
- case GL_RGBA:
-#if 0
- case GL_BGRA:
-#endif
- components = 4;
- break;
- default:
- ERR("pixelDataSize: unknown pixel format...\n");
- components = 0;
- }
- pixelsize = components * componentsize;
- }
+ int pixelsize = glUtilsPixelBitSize(format, type) >> 3;
int alignment = pack ? m_pixelStore.pack_alignment : m_pixelStore.unpack_alignment;