Fixed the texture format for the software fallback
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403264
This commit is contained in:
parent
4dd90ea023
commit
f6ac2f5c20
1 changed files with 6 additions and 3 deletions
|
@ -1355,6 +1355,7 @@ struct private_yuvhwdata
|
||||||
SDL_SW_YUVTexture *sw;
|
SDL_SW_YUVTexture *sw;
|
||||||
|
|
||||||
SDL_TextureID textureID;
|
SDL_TextureID textureID;
|
||||||
|
Uint32 texture_format;
|
||||||
};
|
};
|
||||||
|
|
||||||
SDL_Overlay *
|
SDL_Overlay *
|
||||||
|
@ -1449,14 +1450,16 @@ SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display)
|
||||||
|
|
||||||
/* Create a supported RGB format texture for display */
|
/* Create a supported RGB format texture for display */
|
||||||
SDL_GetCurrentDisplayMode(¤t_mode);
|
SDL_GetCurrentDisplayMode(¤t_mode);
|
||||||
|
texture_format = current_mode.format;
|
||||||
overlay->hwdata->textureID =
|
overlay->hwdata->textureID =
|
||||||
SDL_CreateTexture(current_mode.format,
|
SDL_CreateTexture(texture_format,
|
||||||
SDL_TEXTUREACCESS_STREAMING, w, h);
|
SDL_TEXTUREACCESS_STREAMING, w, h);
|
||||||
}
|
}
|
||||||
if (!overlay->hwdata->textureID) {
|
if (!overlay->hwdata->textureID) {
|
||||||
SDL_FreeYUVOverlay(overlay);
|
SDL_FreeYUVOverlay(overlay);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
overlay->hwdata->texture_format = texture_format;
|
||||||
|
|
||||||
return overlay;
|
return overlay;
|
||||||
}
|
}
|
||||||
|
@ -1521,8 +1524,8 @@ SDL_UnlockYUVOverlay(SDL_Overlay * overlay)
|
||||||
srcrect.w = overlay->w;
|
srcrect.w = overlay->w;
|
||||||
srcrect.h = overlay->h;
|
srcrect.h = overlay->h;
|
||||||
SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect,
|
SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect,
|
||||||
SDL_PIXELFORMAT_RGB888, overlay->w,
|
overlay->hwdata->texture_format,
|
||||||
overlay->h, pixels, pitch);
|
overlay->w, overlay->h, pixels, pitch);
|
||||||
SDL_UnlockTexture(overlay->hwdata->textureID);
|
SDL_UnlockTexture(overlay->hwdata->textureID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue