Progress, maybe. :)
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403300
This commit is contained in:
parent
535f3bf809
commit
2eb5631950
1 changed files with 15 additions and 3 deletions
|
@ -45,14 +45,21 @@
|
||||||
static __inline__ int
|
static __inline__ int
|
||||||
bytes_per_pixel(const Uint32 format)
|
bytes_per_pixel(const Uint32 format)
|
||||||
{
|
{
|
||||||
switch (format) {
|
if (!SDL_ISPIXELFORMAT_FOURCC(format)) {
|
||||||
case SDL_PIXELFORMAT_UYVY:
|
|
||||||
/* !!! FIXME: other YUV formats here... */
|
|
||||||
return 2;
|
|
||||||
default:
|
|
||||||
return SDL_BYTESPERPIXEL(format);
|
return SDL_BYTESPERPIXEL(format);
|
||||||
}
|
}
|
||||||
return -1; /* shouldn't ever hit this. */
|
|
||||||
|
/* FOURCC format */
|
||||||
|
switch (format) {
|
||||||
|
case SDL_PIXELFORMAT_YV12:
|
||||||
|
case SDL_PIXELFORMAT_IYUV:
|
||||||
|
case SDL_PIXELFORMAT_YUY2:
|
||||||
|
case SDL_PIXELFORMAT_UYVY:
|
||||||
|
case SDL_PIXELFORMAT_YVYU:
|
||||||
|
return 2;
|
||||||
|
default:
|
||||||
|
return 1; /* shouldn't ever hit this. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -723,6 +730,11 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
data->texh = (GLfloat) texture->h / texture_h;
|
data->texh = (GLfloat) texture->h / texture_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* YUV formats use RGBA but are really two bytes per pixel */
|
||||||
|
if (internalFormat == GL_RGBA && bytes_per_pixel(texture->format) < 4) {
|
||||||
|
texture_w = (texture_w * bytes_per_pixel(texture->format)) / 4;
|
||||||
|
}
|
||||||
|
|
||||||
data->format = format;
|
data->format = format;
|
||||||
data->formattype = type;
|
data->formattype = type;
|
||||||
renderdata->glBindTexture(data->type, data->texture);
|
renderdata->glBindTexture(data->type, data->texture);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue