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

Function draw

test/browser/test_sdl3_canvas_write.c:17–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls 1

sdlErrorFunction · 0.70

Tested by

no test coverage detected