1cb93a386Sopenharmony_ci// Copyright 2020 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_ciREG_FIDDLE(draw_vertices, 256, 256, false, 6) { 5cb93a386Sopenharmony_ci// draw_vertices 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci SkPaint p; 8cb93a386Sopenharmony_ci p.setAntiAlias(true); 9cb93a386Sopenharmony_ci 10cb93a386Sopenharmony_ci SkPoint pts[3] = {{64, 32}, {0, 224}, {128, 224}}; 11cb93a386Sopenharmony_ci SkColor colors[3] = {SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN}; 12cb93a386Sopenharmony_ci canvas->drawVertices( 13cb93a386Sopenharmony_ci SkVertices::MakeCopy(SkVertices::kTriangles_VertexMode, 3, pts, nullptr, colors), 14cb93a386Sopenharmony_ci SkBlendMode::kSrcOver, p); 15cb93a386Sopenharmony_ci 16cb93a386Sopenharmony_ci canvas->translate(120, 0); 17cb93a386Sopenharmony_ci 18cb93a386Sopenharmony_ci p.setShader(image->makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat, SkSamplingOptions())); 19cb93a386Sopenharmony_ci SkPoint texs[3] = {{0, 0}, {0, 128}, {64, 256}}; 20cb93a386Sopenharmony_ci canvas->drawVertices( 21cb93a386Sopenharmony_ci SkVertices::MakeCopy(SkVertices::kTriangles_VertexMode, 3, pts, texs, nullptr), 22cb93a386Sopenharmony_ci SkBlendMode::kSrcOver, p); 23cb93a386Sopenharmony_ci} 24cb93a386Sopenharmony_ci} // END FIDDLE 25