1cb93a386Sopenharmony_ci// Copyright 2019 Google LLC. 2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 3cb93a386Sopenharmony_ci#include "tools/fiddle/examples.h" 4cb93a386Sopenharmony_ci// HASH=4e5b9e53aa1b200fed3ee6596ca01f0e 5cb93a386Sopenharmony_ciREG_FIDDLE(Region_translate, 256, 90, false, 0) { 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci SkRegion test; 8cb93a386Sopenharmony_ci SkIRect rects[] = {{40, 20, 50, 30}, {70, 40, 80, 50}, { 60, 10, 70, 20}}; 9cb93a386Sopenharmony_ci test.setRects(rects, SK_ARRAY_COUNT(rects)); 10cb93a386Sopenharmony_ci SkPaint paint; 11cb93a386Sopenharmony_ci for (auto color : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN, SK_ColorMAGENTA } ) { 12cb93a386Sopenharmony_ci paint.setColor(color); 13cb93a386Sopenharmony_ci canvas->drawRegion(test, paint); 14cb93a386Sopenharmony_ci test.translate(10, 10); 15cb93a386Sopenharmony_ci } 16cb93a386Sopenharmony_ci} 17cb93a386Sopenharmony_ci} // END FIDDLE 18