Add safety notes to 'Update_' functions

This commit is contained in:
Amy Wilder
2025-07-07 21:51:27 -04:00
parent cb3168a048
commit d4f09984ac
3 changed files with 10 additions and 5 deletions

View File

@@ -4337,14 +4337,17 @@ void UnloadRenderTexture(RenderTexture2D target)
}
// Update GPU texture with new data
// NOTE: pixels data must match texture.format
// NOTE 1: pixels data must match texture.format
// NOTE 2: pixels data must contain at least as many pixels as texture
void UpdateTexture(Texture2D texture, const void *pixels)
{
rlUpdateTexture(texture.id, 0, 0, texture.width, texture.height, texture.format, pixels);
}
// Update GPU texture rectangle with new data
// NOTE: pixels data must match texture.format
// NOTE 1: pixels data must match texture.format
// NOTE 2: pixels data must contain as many pixels as rec contains
// NOTE 3: rec must fit completely within texture's width and height
void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels)
{
rlUpdateTexture(texture.id, (int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, texture.format, pixels);