--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403247
This commit is contained in:
Sam Lantinga 2008-11-25 02:21:53 +00:00
parent de690ebe5d
commit a733eee1b8
10 changed files with 120 additions and 113 deletions

View File

@ -1445,7 +1445,8 @@ SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display)
/* Create a supported RGB format texture for display */
overlay->hwdata->textureID =
SDL_CreateTexture(SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_STREAMING, w, h);
SDL_CreateTexture(SDL_PIXELFORMAT_RGB888,
SDL_TEXTUREACCESS_STREAMING, w, h);
}
if (!overlay->hwdata->textureID) {
SDL_FreeYUVOverlay(overlay);
@ -1466,11 +1467,13 @@ SDL_LockYUVOverlay(SDL_Overlay * overlay)
return -1;
}
if (overlay->hwdata->sw) {
if (SDL_SW_QueryYUVTexturePixels(overlay->hwdata->sw, &pixels, &pitch) < 0) {
if (SDL_SW_QueryYUVTexturePixels(overlay->hwdata->sw, &pixels, &pitch)
< 0) {
return -1;
}
} else {
if (SDL_LockTexture(overlay->hwdata->textureID, NULL, 1, &pixels, &pitch)
if (SDL_LockTexture
(overlay->hwdata->textureID, NULL, 1, &pixels, &pitch)
< 0) {
return -1;
}
@ -1504,14 +1507,17 @@ SDL_UnlockYUVOverlay(SDL_Overlay * overlay)
if (overlay->hwdata->sw) {
void *pixels;
int pitch;
if (SDL_LockTexture(overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) == 0) {
if (SDL_LockTexture
(overlay->hwdata->textureID, NULL, 1, &pixels, &pitch) == 0) {
SDL_Rect srcrect;
srcrect.x = 0;
srcrect.y = 0;
srcrect.w = overlay->w;
srcrect.h = overlay->h;
SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect, SDL_PIXELFORMAT_RGB888, overlay->w, overlay->h, pixels, pitch);
SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect,
SDL_PIXELFORMAT_RGB888, overlay->w,
overlay->h, pixels, pitch);
SDL_UnlockTexture(overlay->hwdata->textureID);
}
} else {

View File

@ -361,7 +361,8 @@ static int
SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
texture->driverdata = SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
texture->driverdata =
SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
} else {
int bpp;
Uint32 Rmask, Gmask, Bmask, Amask;

View File

@ -1110,10 +1110,8 @@ SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
swdata->pitches[1] = swdata->pitches[0] / 2;
swdata->pitches[2] = swdata->pitches[0] / 2;
swdata->planes[0] = swdata->pixels;
swdata->planes[1] =
swdata->planes[0] + swdata->pitches[0] * h;
swdata->planes[2] =
swdata->planes[1] + swdata->pitches[1] * h / 2;
swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h;
swdata->planes[2] = swdata->planes[1] + swdata->pitches[1] * h / 2;
break;
case SDL_PIXELFORMAT_YUY2:
case SDL_PIXELFORMAT_UYVY:

View File

@ -633,7 +633,8 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
d3drect.top = rect->y;
d3drect.bottom = rect->y + rect->h;
result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
result =
IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
if (FAILED(result)) {
D3D_SetError("LockRect()", result);
return -1;

View File

@ -294,7 +294,8 @@ GDI_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
texture->driverdata = data;
if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
data->yuv = SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
data->yuv =
SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
if (!data->yuv) {
return -1;
}