internal-screenshot-test: Fix endian problem

Use bit-shifts to properly generate pixel data.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Derek Foreman 10 years ago committed by Bryce Harrington
parent 2a746a52d4
commit 97b9b17668
  1. 13
      tests/internal-screenshot-test.c

@ -184,16 +184,19 @@ capture_screenshot_of_output(struct client *client) {
} }
static void static void
draw_stuff(char *pixels, int w, int h) draw_stuff(void *pixels, int w, int h)
{ {
int x, y; int x, y;
uint8_t r, g, b;
uint32_t *pixel;
for (x = 0; x < w; x++) for (x = 0; x < w; x++)
for (y = 0; y < h; y++) { for (y = 0; y < h; y++) {
pixels[y * w * 4 + x * 4] = x; b = x;
pixels[y * w * 4 + x * 4 + 1] = x + y; g = x + y;
pixels[y * w * 4 + x * 4 + 2] = y; r = y;
pixels[y * w * 4 + x * 4 + 3] = 255; pixel = (uint32_t *)pixels + y * w + x;
*pixel = (255 << 24) | (r << 16) | (g << 8) | b;
} }
} }

Loading…
Cancel
Save