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

Function UpdateTexture

deps/SDL2/test/teststreaming.c:70–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void UpdateTexture(SDL_Texture *texture, int frame)
71{
72 SDL_Color *color;
73 Uint8 *src;
74 Uint32 *dst;
75 int row, col;
76 void *pixels;
77 int pitch;
78
79 if (SDL_LockTexture(texture, NULL, &pixels, &pitch) < 0) {
80 SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock texture: %s\n", SDL_GetError());
81 quit(5);
82 }
83 src = MooseFrames[frame];
84 for (row = 0; row < MOOSEPIC_H; ++row) {
85 dst = (Uint32*)((Uint8*)pixels + row * pitch);
86 for (col = 0; col < MOOSEPIC_W; ++col) {
87 color = &MooseColors[*src++];
88 *dst++ = (0xFF000000|(color->r<<16)|(color->g<<8)|color->b);
89 }
90 }
91 SDL_UnlockTexture(texture);
92}
93
94void
95loop()

Callers 1

loopFunction · 0.85

Calls 5

SDL_LockTextureFunction · 0.85
SDL_LogErrorFunction · 0.85
SDL_GetErrorFunction · 0.85
SDL_UnlockTextureFunction · 0.85
quitFunction · 0.70

Tested by

no test coverage detected