When resizing the window and locking the texture created from the renderer of the window on SDL_WINDOWEVENT_SIZE_CHANGED
, the pitch set by locking is 0 to 3 bytes larger than the new window width * size of 1 pixel (3 (bytes) with SDL_PIXELFORMAT_RGB24
).
How would I write to a x, y window coordinate?
Neither y * width * 3 + x * 3
nor y * pitch + x * 3
produce correct results (after unlocking) in cases where the “larger” is not 0. (operating on the pixels pointer set by locking)
EDIT: I memcpy
1 pixel = 3 bytes of RGB to that computation