From cba22d0e39db8abc68ac21d021c386ecc31ca217 Mon Sep 17 00:00:00 2001 From: Linus Svensson Date: Wed, 16 Nov 2016 13:59:32 +0100 Subject: [PATCH] spa/plugins/videotestsrc: Draw correctly for all resolutions Use an incremented variable to support all resolutions. If the width of the pludge part of the test image was not dividable by three, a rounding error made the resulting pattern containing noise. --- spa/plugins/videotestsrc/draw.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/spa/plugins/videotestsrc/draw.c b/spa/plugins/videotestsrc/draw.c index cd43704cd..300809b67 100644 --- a/spa/plugins/videotestsrc/draw.c +++ b/spa/plugins/videotestsrc/draw.c @@ -217,22 +217,30 @@ draw_smpte_snow (DrawingData *dd) } for (i = y2; i < h; i++) { + int x = 0; + /* negative I */ - draw_pixels (dd, 0 * w / 6, NEG_I, w / 6); + draw_pixels (dd, x, NEG_I, w / 6); + x += w / 6; /* white */ - draw_pixels (dd, 1 * w / 6, WHITE, w / 6); + draw_pixels (dd, x, WHITE, w / 6); + x += w / 6; /* positive Q */ - draw_pixels (dd, 2 * w / 6, POS_Q, w / 6); + draw_pixels (dd, x, POS_Q, w / 6); + x += w / 6; /* pluge */ - draw_pixels (dd, 6 * w / 12, DARK_BLACK, w / 12); - draw_pixels (dd, 7 * w / 12, BLACK, w / 12); - draw_pixels (dd, 8 * w / 12, LIGHT_BLACK, w / 12); + draw_pixels (dd, x, DARK_BLACK, w / 12); + x += w / 12; + draw_pixels (dd, x, BLACK, w / 12); + x += w / 12; + draw_pixels (dd, x, LIGHT_BLACK, w / 12); + x += w / 12; /* war of the ants (a.k.a. snow) */ - for (j = 9 * w / 12; j < w; j++) { + for (j = x; j < w; j++) { Pixel p; unsigned char r = rand ();