1 // Copyright 2020 Google LLC. 2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 3 #include "tools/fiddle/examples.h" 4 REG_FIDDLE(f16to8888drawImageBug, 256, 256, false, 0) { 5 // f16to8888drawImageBug draw(SkCanvas * canvas)6 void draw(SkCanvas* canvas) { 7 sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeSRGBLinear(); 8 9 SkImageInfo imageInfo = 10 SkImageInfo::Make(100, 100, kRGBA_F16_SkColorType, kPremul_SkAlphaType, colorSpace); 11 sk_sp<SkSurface> surface = SkSurface::MakeRaster(imageInfo); 12 SkPaint p; 13 surface->getCanvas()->drawRect(SkRect::MakeXYWH(20, 20, 40, 40), p); 14 15 sk_sp<SkColorSpace> colorSpace2 = SkColorSpace::MakeSRGB(); 16 17 SkImageInfo imageInfo2 = 18 SkImageInfo::Make(100, 100, kN32_SkColorType, kPremul_SkAlphaType, colorSpace2); 19 sk_sp<SkSurface> surface2 = SkSurface::MakeRaster(imageInfo2); 20 surface2->getCanvas()->drawImage(surface->makeImageSnapshot(), 0, 0); 21 22 canvas->drawImage(surface->makeImageSnapshot(), 0, 0); 23 canvas->drawImage(surface2->makeImageSnapshot(), 50, 0); 24 } 25 } // END FIDDLE 26