diff options
-rw-r--r-- | lib/igt_fb.c | 20 | ||||
-rw-r--r-- | lib/igt_fb.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c index eafbe7fd..5c4648fe 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -1466,6 +1466,26 @@ void igt_paint_color(cairo_t *cr, int x, int y, int w, int h, } /** + * igt_paint_color_rand: + * @cr: cairo drawing context + * @x: pixel x-coordination of the fill rectangle + * @y: pixel y-coordination of the fill rectangle + * @w: width of the fill rectangle + * @h: height of the fill rectangle + * + * This functions draws a solid rectangle with random colors using the drawing + * context @cr. + */ +void igt_paint_color_rand(cairo_t *cr, int x, int y, int w, int h) +{ + double r = rand() / (double)RAND_MAX; + double g = rand() / (double)RAND_MAX; + double b = rand() / (double)RAND_MAX; + + igt_paint_color(cr, x, y, w, h, r, g, b); +} + +/** * * igt_fill_cts_color_square_framebuffer: * @pixmap: handle to mapped buffer diff --git a/lib/igt_fb.h b/lib/igt_fb.h index 623a8caa..b3f096fe 100644 --- a/lib/igt_fb.h +++ b/lib/igt_fb.h @@ -191,6 +191,7 @@ cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb); void igt_put_cairo_ctx(cairo_t *cr); void igt_paint_color(cairo_t *cr, int x, int y, int w, int h, double r, double g, double b); +void igt_paint_color_rand(cairo_t *cr, int x, int y, int w, int h); void igt_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h, double r, double g, double b, double a); void igt_paint_color_gradient(cairo_t *cr, int x, int y, int w, int h, |