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(f16to8888drawImageBug, 256, 256, false, 0) { 5cb93a386Sopenharmony_ci// f16to8888drawImageBug 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeSRGBLinear(); 8cb93a386Sopenharmony_ci 9cb93a386Sopenharmony_ci SkImageInfo imageInfo = 10cb93a386Sopenharmony_ci SkImageInfo::Make(100, 100, kRGBA_F16_SkColorType, kPremul_SkAlphaType, colorSpace); 11cb93a386Sopenharmony_ci sk_sp<SkSurface> surface = SkSurface::MakeRaster(imageInfo); 12cb93a386Sopenharmony_ci SkPaint p; 13cb93a386Sopenharmony_ci surface->getCanvas()->drawRect(SkRect::MakeXYWH(20, 20, 40, 40), p); 14cb93a386Sopenharmony_ci 15cb93a386Sopenharmony_ci sk_sp<SkColorSpace> colorSpace2 = SkColorSpace::MakeSRGB(); 16cb93a386Sopenharmony_ci 17cb93a386Sopenharmony_ci SkImageInfo imageInfo2 = 18cb93a386Sopenharmony_ci SkImageInfo::Make(100, 100, kN32_SkColorType, kPremul_SkAlphaType, colorSpace2); 19cb93a386Sopenharmony_ci sk_sp<SkSurface> surface2 = SkSurface::MakeRaster(imageInfo2); 20cb93a386Sopenharmony_ci surface2->getCanvas()->drawImage(surface->makeImageSnapshot(), 0, 0); 21cb93a386Sopenharmony_ci 22cb93a386Sopenharmony_ci canvas->drawImage(surface->makeImageSnapshot(), 0, 0); 23cb93a386Sopenharmony_ci canvas->drawImage(surface2->makeImageSnapshot(), 50, 0); 24cb93a386Sopenharmony_ci} 25cb93a386Sopenharmony_ci} // END FIDDLE 26