diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2015-05-26 12:00:49 -0500 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2015-06-04 17:13:22 -0700 |
commit | 97b9b176682a24b9d4c31bdfb2a4a51decfbf013 (patch) | |
tree | f83b09963d04468bfc3c76357b630b00610d1632 /tests/internal-screenshot-test.c | |
parent | 2a746a52d466085ceff2ef949911d6d1a5c723cb (diff) | |
download | weston-97b9b176682a24b9d4c31bdfb2a4a51decfbf013.tar.gz weston-97b9b176682a24b9d4c31bdfb2a4a51decfbf013.tar.bz2 weston-97b9b176682a24b9d4c31bdfb2a4a51decfbf013.zip |
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>
Diffstat (limited to 'tests/internal-screenshot-test.c')
-rw-r--r-- | tests/internal-screenshot-test.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/internal-screenshot-test.c b/tests/internal-screenshot-test.c index 1db0722a..f0bf587c 100644 --- a/tests/internal-screenshot-test.c +++ b/tests/internal-screenshot-test.c @@ -184,16 +184,19 @@ capture_screenshot_of_output(struct client *client) { } static void -draw_stuff(char *pixels, int w, int h) +draw_stuff(void *pixels, int w, int h) { int x, y; + uint8_t r, g, b; + uint32_t *pixel; for (x = 0; x < w; x++) for (y = 0; y < h; y++) { - pixels[y * w * 4 + x * 4] = x; - pixels[y * w * 4 + x * 4 + 1] = x + y; - pixels[y * w * 4 + x * 4 + 2] = y; - pixels[y * w * 4 + x * 4 + 3] = 255; + b = x; + g = x + y; + r = y; + pixel = (uint32_t *)pixels + y * w + x; + *pixel = (255 << 24) | (r << 16) | (g << 8) | b; } } |