MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / draw

Function draw

test/browser/test_sdl2_canvas_write.c:15–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15void draw(SDL_Window* window, SDL_Surface* surface) {
16 int x, y;
17
18 if (SDL_MUSTLOCK(surface)) {
19 if (SDL_LockSurface(surface) != 0)
20 sdlError("SDL_LockSurface");
21 }
22
23 for (y = 0; y < 256; y++) {
24 Uint32* p = (Uint32*)(((Uint8*)surface->pixels) + surface->pitch * y);
25 for (x = 0; x < 256; x++) {
26 *(p++) = SDL_MapRGB(surface->format, x, x ^ y, y);
27 }
28 }
29
30 if (SDL_MUSTLOCK(surface))
31 SDL_UnlockSurface(surface);
32 if (SDL_UpdateWindowSurface(window) != 0)
33 sdlError("SDL_UpdateWindowSurface");
34}
35
36void verify(void) {
37 int res = EM_ASM_INT({

Callers 1

mainFunction · 0.70

Calls 1

sdlErrorFunction · 0.70

Tested by

no test coverage detected