Commit 96085017 authored by Zhigang Gong's avatar Zhigang Gong Committed by Eric Anholt

Consolidate the choose of internal texture format to one function.

Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent a74596be
......@@ -169,20 +169,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
if (w == 0 || h == 0 || type == GLAMOR_MEMORY)
return pixmap;
switch (depth) {
#if 0
case 8:
format = GL_ALPHA;
break;
#endif
case 24:
format = GL_RGB;
break;
default:
format = GL_RGBA;
break;
}
gl_iformat_for_depth(depth, &format);
/* Create the texture used to store the pixmap's data. */
dispatch->glGenTextures(1, &tex);
dispatch->glBindTexture(GL_TEXTURE_2D, tex);
......
......@@ -221,23 +221,10 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, GLenum format,
void *texels;
GLenum iformat;
switch (pixmap->drawable.depth) {
#if 0
case 8:
iformat = GL_ALPHA;
break;
#endif
case 24:
iformat = GL_RGB;
break;
default:
iformat = GL_RGBA;
break;
}
if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) {
if (glamor_priv->gl_flavor == GLAMOR_GL_ES2)
iformat = format;
}
else
gl_iformat_for_depth(pixmap->drawable.depth, &iformat);
stride = pixmap->devKind;
row_length = (stride * 8) / pixmap->drawable.bitsPerPixel;
......
......@@ -224,6 +224,26 @@ format_for_depth(int depth)
}
}
static inline void
gl_iformat_for_depth(int depth, GLenum * format)
{
switch (depth) {
#if 0
case 8:
*format = GL_ALPHA;
break;
#endif
case 24:
*format = GL_RGB;
break;
default:
*format = GL_RGBA;
break;
}
}
static inline CARD32
format_for_pixmap(PixmapPtr pixmap)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment