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

Function SDL_UnlockTextureNative

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

Source from the content-addressed store, hash-verified

1797#endif /* SDL_HAVE_YUV */
1798
1799static void
1800SDL_UnlockTextureNative(SDL_Texture * texture)
1801{
1802 SDL_Texture *native = texture->native;
1803 void *native_pixels = NULL;
1804 int native_pitch = 0;
1805 const SDL_Rect *rect = &texture->locked_rect;
1806 const void* pixels = (void *) ((Uint8 *) texture->pixels +
1807 rect->y * texture->pitch +
1808 rect->x * SDL_BYTESPERPIXEL(texture->format));
1809 int pitch = texture->pitch;
1810
1811 if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
1812 return;
1813 }
1814 SDL_ConvertPixels(rect->w, rect->h,
1815 texture->format, pixels, pitch,
1816 native->format, native_pixels, native_pitch);
1817 SDL_UnlockTexture(native);
1818}
1819
1820void
1821SDL_UnlockTexture(SDL_Texture * texture)

Callers 1

SDL_UnlockTextureFunction · 0.85

Calls 3

SDL_LockTextureFunction · 0.85
SDL_ConvertPixelsFunction · 0.85
SDL_UnlockTextureFunction · 0.85

Tested by

no test coverage detected