1 #if 0 // Disabled until updated to use current API. 2 // Copyright 2019 Google LLC. 3 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 4 #include "tools/fiddle/examples.h" 5 // HASH=c0216b3f7ebd80b9589ae5728f08fc80 6 REG_FIDDLE(Path_contains, 256, 256, false, 0) { 7 void draw(SkCanvas* canvas) { 8 SkPath path; 9 SkPaint paint; 10 paint.setTextSize(256); 11 paint.getTextPath("&", 1, 30, 220, &path); 12 for (int y = 2; y < 256; y += 9) { 13 for (int x = 2; x < 256; x += 9) { 14 int coverage = 0; 15 for (int iy = -4; iy <= 4; iy += 2) { 16 for (int ix = -4; ix <= 4; ix += 2) { 17 coverage += path.contains(x + ix, y + iy); 18 } 19 } 20 paint.setColor(SkColorSetARGB(0x5f, 0xff * coverage / 25, 0, 0xff * (25 - coverage) / 25)); 21 canvas->drawCircle(x, y, 8, paint); 22 } 23 } 24 } 25 } // END FIDDLE 26 #endif // Disabled until updated to use current API. 27