From e391ae2091be6d736dee7734b0a9e4c2beaddef5 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Thu, 24 Apr 2014 00:14:09 -0700 Subject: Add cairoRandomizeColor and skiaRandomizeColor --- src/skia-tests/stroke.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/skia-tests/stroke.cpp') diff --git a/src/skia-tests/stroke.cpp b/src/skia-tests/stroke.cpp index 6340480..3792af6 100644 --- a/src/skia-tests/stroke.cpp +++ b/src/skia-tests/stroke.cpp @@ -109,11 +109,7 @@ static void draw_stroke(caskbench_context_t *ctx,SkCanvas* canvas,kinetics_t* pa for (i=0; ix : i * element_spacing; ctx->skia_paint->setStrokeCap((SkPaint::Cap)(i % 5)); - red = int( 255 * (double)rand()/RAND_MAX ); - green = int( 255 * (double)rand()/RAND_MAX ); - blue = int( 255 * (double)rand()/RAND_MAX ); - alpha = int( 255 * (double)rand()/RAND_MAX ); - ctx->skia_paint->setARGB(alpha,red, green, blue ); + skiaRandomizeColor(ctx); drawShape(ctx, x,y); } } @@ -164,11 +160,7 @@ sk_test_stroke(caskbench_context_t *ctx) ctx->skia_canvas->drawColor(SK_ColorWHITE); for (i = 0; i < num_particles; i++) { kinetics_update(&particles[i], 0.3); - red = int( 255 * (double)rand()/RAND_MAX ); - green = int( 255 * (double)rand()/RAND_MAX ); - blue = int( 255 * (double)rand()/RAND_MAX ); - alpha = int( 255 * (double)rand()/RAND_MAX ); - ctx->skia_paint->setARGB(alpha,red, green, blue ); + skiaRandomizeColor(ctx); //draw_stroke(ctx,ctx->skia_canvas,&particles[i]); drawShape(ctx,particles[i].x,particles[i].y,&particles[i]); } -- cgit v1.3.1-4-g156e