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

Function SDL_LockTexture

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

Source from the content-addressed store, hash-verified

1698}
1699
1700int
1701SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect,
1702 void **pixels, int *pitch)
1703{
1704 SDL_Rect full_rect;
1705
1706 CHECK_TEXTURE_MAGIC(texture, -1);
1707
1708 if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
1709 return SDL_SetError("SDL_LockTexture(): texture must be streaming");
1710 }
1711
1712 if (!rect) {
1713 full_rect.x = 0;
1714 full_rect.y = 0;
1715 full_rect.w = texture->w;
1716 full_rect.h = texture->h;
1717 rect = &full_rect;
1718 }
1719
1720#if SDL_HAVE_YUV
1721 if (texture->yuv) {
1722 if (FlushRenderCommandsIfTextureNeeded(texture) < 0) {
1723 return -1;
1724 }
1725 return SDL_LockTextureYUV(texture, rect, pixels, pitch);
1726 } else
1727#endif
1728 if (texture->native) {
1729 /* Calls a real SDL_LockTexture/SDL_UnlockTexture on unlock, flushing then. */
1730 return SDL_LockTextureNative(texture, rect, pixels, pitch);
1731 } else {
1732 SDL_Renderer *renderer = texture->renderer;
1733 if (FlushRenderCommandsIfTextureNeeded(texture) < 0) {
1734 return -1;
1735 }
1736 return renderer->LockTexture(renderer, texture, rect, pixels, pitch);
1737 }
1738}
1739
1740int
1741SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect,

Callers 7

UpdateTextureFunction · 0.85
SDL_UpdateTextureYUVFunction · 0.85
SDL_UpdateTextureNativeFunction · 0.85
SDL_LockTextureToSurfaceFunction · 0.85
SDL_UnlockTextureYUVFunction · 0.85
SDL_UnlockTextureNativeFunction · 0.85

Calls 4

SDL_SetErrorFunction · 0.85
SDL_LockTextureYUVFunction · 0.85
SDL_LockTextureNativeFunction · 0.85

Tested by 1

UpdateTextureFunction · 0.68