MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / SDL_UpdateTexture

Function SDL_UpdateTexture

deps/SDL2/src/render/SDL_render.c:1518–1556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1516}
1517
1518int
1519SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect,
1520 const void *pixels, int pitch)
1521{
1522 SDL_Rect full_rect;
1523
1524 CHECK_TEXTURE_MAGIC(texture, -1);
1525
1526 if (!pixels) {
1527 return SDL_InvalidParamError("pixels");
1528 }
1529 if (!pitch) {
1530 return SDL_InvalidParamError("pitch");
1531 }
1532
1533 if (!rect) {
1534 full_rect.x = 0;
1535 full_rect.y = 0;
1536 full_rect.w = texture->w;
1537 full_rect.h = texture->h;
1538 rect = &full_rect;
1539 }
1540
1541 if ((rect->w == 0) || (rect->h == 0)) {
1542 return 0; /* nothing to do. */
1543#if SDL_HAVE_YUV
1544 } else if (texture->yuv) {
1545 return SDL_UpdateTextureYUV(texture, rect, pixels, pitch);
1546#endif
1547 } else if (texture->native) {
1548 return SDL_UpdateTextureNative(texture, rect, pixels, pitch);
1549 } else {
1550 SDL_Renderer *renderer = texture->renderer;
1551 if (FlushRenderCommandsIfTextureNeeded(texture) < 0) {
1552 return -1;
1553 }
1554 return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
1555 }
1556}
1557
1558#if SDL_HAVE_YUV
1559static int

Callers 8

mainFunction · 0.85
loopFunction · 0.85
unifont_load_textureFunction · 0.85
SDL_UpdateTextureYUVFunction · 0.85
SDL_UpdateTextureNativeFunction · 0.85
SDL_UpdateWindowTextureFunction · 0.85

Calls 3

SDL_UpdateTextureYUVFunction · 0.85
SDL_UpdateTextureNativeFunction · 0.85

Tested by 3

mainFunction · 0.68
loopFunction · 0.68
unifont_load_textureFunction · 0.68