1cb93a386Sopenharmony_ci#if 0  // Disabled until updated to use current API.
2cb93a386Sopenharmony_ci// Copyright 2019 Google LLC.
3cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4cb93a386Sopenharmony_ci#include "tools/fiddle/examples.h"
5cb93a386Sopenharmony_ci// HASH=a8b8bd4bfe968e2c63085f867665227f
6cb93a386Sopenharmony_ciREG_FIDDLE(Image_isLazyGenerated_a, 256, 80, false, 0) {
7cb93a386Sopenharmony_ciclass TestImageGenerator : public SkImageGenerator {
8cb93a386Sopenharmony_cipublic:
9cb93a386Sopenharmony_ci    TestImageGenerator() : SkImageGenerator(SkImageInfo::MakeN32Premul(10, 10)) {}
10cb93a386Sopenharmony_ci    ~TestImageGenerator() override {}
11cb93a386Sopenharmony_ciprotected:
12cb93a386Sopenharmony_ci    bool onGetPixels(const SkImageInfo& info, void* pixelPtr, size_t rowBytes,
13cb93a386Sopenharmony_ci                     const Options& options) override {
14cb93a386Sopenharmony_ci        SkPMColor* pixels = static_cast<SkPMColor*>(pixelPtr);
15cb93a386Sopenharmony_ci        for (int y = 0; y < info.height(); ++y) {
16cb93a386Sopenharmony_ci            for (int x = 0; x < info.width(); ++x) {
17cb93a386Sopenharmony_ci                pixels[y * info.width() + x] = 0xff223344 + y * 0x000C0811;
18cb93a386Sopenharmony_ci            }
19cb93a386Sopenharmony_ci        }
20cb93a386Sopenharmony_ci        return true;
21cb93a386Sopenharmony_ci    }
22cb93a386Sopenharmony_ci};
23cb93a386Sopenharmony_ci
24cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) {
25cb93a386Sopenharmony_ci    auto gen = std::unique_ptr<TestImageGenerator>(new TestImageGenerator());
26cb93a386Sopenharmony_ci    sk_sp<SkImage> image(SkImage::MakeFromGenerator(std::move(gen)));
27cb93a386Sopenharmony_ci    SkString lazy(image->isLazyGenerated() ? "is lazy" : "not lazy");
28cb93a386Sopenharmony_ci    canvas->scale(8, 8);
29cb93a386Sopenharmony_ci    canvas->drawImage(image, 0, 0, nullptr);
30cb93a386Sopenharmony_ci    SkPaint paint;
31cb93a386Sopenharmony_ci    paint.setTextSize(4);
32cb93a386Sopenharmony_ci    canvas->drawString(lazy, 2, 5, paint);
33cb93a386Sopenharmony_ci}
34cb93a386Sopenharmony_ci}  // END FIDDLE
35cb93a386Sopenharmony_ci#endif  // Disabled until updated to use current API.
36