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=46d9bacf593deaaeabd74ff42f2571a0 6cb93a386Sopenharmony_ciREG_FIDDLE(Surface_draw_2, 256, 64, false, 0) { 7cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 8cb93a386Sopenharmony_ci SkPaint paint; 9cb93a386Sopenharmony_ci paint.setTextSize(16); 10cb93a386Sopenharmony_ci sk_sp<SkSurface> gpuSurface = SkSurface::MakeRasterN32Premul(64, 64); 11cb93a386Sopenharmony_ci SkSurfaceCharacterization characterization; 12cb93a386Sopenharmony_ci if (!gpuSurface->characterize(&characterization)) { 13cb93a386Sopenharmony_ci canvas->drawString("characterization unsupported", 20, 40, paint); 14cb93a386Sopenharmony_ci return; 15cb93a386Sopenharmony_ci } 16cb93a386Sopenharmony_ci // start of threadable work 17cb93a386Sopenharmony_ci SkDeferredDisplayListRecorder recorder(characterization); 18cb93a386Sopenharmony_ci SkCanvas* subCanvas = recorder.getCanvas(); 19cb93a386Sopenharmony_ci subCanvas->clear(SK_ColorGREEN); 20cb93a386Sopenharmony_ci sk_sp<SkDeferredDisplayList> displayList = recorder.detach(); 21cb93a386Sopenharmony_ci // end of threadable work 22cb93a386Sopenharmony_ci gpuSurface->draw(displayList); 23cb93a386Sopenharmony_ci sk_sp<SkImage> img = gpuSurface->makeImageSnapshot(); 24cb93a386Sopenharmony_ci canvas->drawImage(std::move(img), 0, 0); 25cb93a386Sopenharmony_ci} 26cb93a386Sopenharmony_ci} // END FIDDLE 27cb93a386Sopenharmony_ci#endif // Disabled until updated to use current API. 28