Add SDL_UpdateNVTexture() to update NV12/21 Texture (bug )

for renderer software, opengl, and opengles2
This commit is contained in:
Sylvain Becker 2021-01-05 11:56:22 +01:00
parent d72dbd9883
commit be4cfd51c3
7 changed files with 254 additions and 0 deletions

View file

@ -450,6 +450,28 @@ extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture,
const Uint8 *Uplane, int Upitch,
const Uint8 *Vplane, int Vpitch);
/**
* \brief Update a rectangle within a planar NV12 or NV21 texture with new pixel data.
*
* \param texture The texture to update
* \param rect A pointer to the rectangle of pixels to update, or NULL to
* update the entire texture.
* \param Yplane The raw pixel data for the Y plane.
* \param Ypitch The number of bytes between rows of pixel data for the Y plane.
* \param UVplane The raw pixel data for the UV plane.
* \param UVpitch The number of bytes between rows of pixel data for the UV plane.
*
* \return 0 on success, or -1 if the texture is not valid.
*
* \note You can use SDL_UpdateTexture() as long as your pixel data is
* a contiguous block of NV12/21 planes in the proper order, but
* this function is available if your pixel data is not contiguous.
*/
extern DECLSPEC int SDLCALL SDL_UpdateNVTexture(SDL_Texture * texture,
const SDL_Rect * rect,
const Uint8 *Yplane, int Ypitch,
const Uint8 *UVplane, int UVpitch);
/**
* \brief Lock a portion of the texture for write-only pixel access.
*