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=d77790dd3bc9f678fa4f582347fb8fba
5cb93a386Sopenharmony_ciREG_FIDDLE(Surface_writePixels_2, 256, 96, false, 4) {
6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) {
7cb93a386Sopenharmony_ci    sk_sp<SkSurface> surf(SkSurface::MakeRasterN32Premul(64, 64));
8cb93a386Sopenharmony_ci    auto surfCanvas = surf->getCanvas();
9cb93a386Sopenharmony_ci    surfCanvas->clear(SK_ColorGREEN);
10cb93a386Sopenharmony_ci    surf->writePixels(source, 25, 25);
11cb93a386Sopenharmony_ci    sk_sp<SkImage> image(surf->makeImageSnapshot());
12cb93a386Sopenharmony_ci    canvas->drawImage(image, 0, 0);
13cb93a386Sopenharmony_ci}
14cb93a386Sopenharmony_ci}  // END FIDDLE
15