From e1ac3ca65064874308e9512bb6779b416034b594 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 10 Nov 2016 18:21:12 -0800 Subject: [PATCH] Randomize the color of the checkerboard pattern per raster cache entry. (#3218) --- flow/raster_cache.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 2ff8e7d02..e0a0eff22 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -4,6 +4,8 @@ #include "flutter/flow/raster_cache.h" +#include + #include #include "flutter/common/threads.h" @@ -49,13 +51,17 @@ static void DrawCheckerboard(SkCanvas* canvas, const SkRect& rect) { // Draw a checkerboard canvas->save(); canvas->clipRect(rect); - DrawCheckerboard(canvas, 0x4400FF00, 0x00000000, 12); + + auto checkerboard_color = + SkColorSetARGBInline(64, rand() % 256, rand() % 256, rand() % 256); + + DrawCheckerboard(canvas, checkerboard_color, 0x00000000, 12); canvas->restore(); // Stroke the drawn area SkPaint debugPaint; - debugPaint.setStrokeWidth(3); - debugPaint.setColor(SK_ColorRED); + debugPaint.setStrokeWidth(8); + debugPaint.setColor(SkColorSetA(checkerboard_color, 255)); debugPaint.setStyle(SkPaint::kStroke_Style); canvas->drawRect(rect, debugPaint); } -- GitLab