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=a9889b519a26896b900da0444e423c61
5cb93a386Sopenharmony_ciREG_FIDDLE(Surface_makeSurface, 256, 96, false, 0) {
6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) {
7cb93a386Sopenharmony_ci    sk_sp<SkSurface> big(SkSurface::MakeRasterN32Premul(64, 64));
8cb93a386Sopenharmony_ci    sk_sp<SkSurface> lil(big->makeSurface(SkImageInfo::MakeN32(32, 32, kPremul_SkAlphaType)));
9cb93a386Sopenharmony_ci    big->getCanvas()->clear(SK_ColorRED);
10cb93a386Sopenharmony_ci    lil->getCanvas()->clear(SK_ColorBLACK);
11cb93a386Sopenharmony_ci    SkPixmap pixmap;
12cb93a386Sopenharmony_ci    if (big->peekPixels(&pixmap)) {
13cb93a386Sopenharmony_ci        SkBitmap bigBits;
14cb93a386Sopenharmony_ci        bigBits.installPixels(pixmap);
15cb93a386Sopenharmony_ci        canvas->drawImage(bigBits.asImage(), 0, 0);
16cb93a386Sopenharmony_ci    }
17cb93a386Sopenharmony_ci    if (lil->peekPixels(&pixmap)) {
18cb93a386Sopenharmony_ci        SkBitmap lilBits;
19cb93a386Sopenharmony_ci        lilBits.installPixels(pixmap);
20cb93a386Sopenharmony_ci        canvas->drawImage(lilBits.asImage(), 64, 64);
21cb93a386Sopenharmony_ci    }
22cb93a386Sopenharmony_ci}
23cb93a386Sopenharmony_ci}  // END FIDDLE
24