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=024200960eb52fee1f471514607e6001 5cb93a386Sopenharmony_ciREG_FIDDLE(Region_translate_2, 256, 256, 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 SkRegion second; 15cb93a386Sopenharmony_ci test.translate(10, test.getBounds().fBottom, &second); 16cb93a386Sopenharmony_ci test.op(second, SkRegion::kXOR_Op); 17cb93a386Sopenharmony_ci test.translate(30, 0); 18cb93a386Sopenharmony_ci } 19cb93a386Sopenharmony_ci} 20cb93a386Sopenharmony_ci} // END FIDDLE 21