blob: 6ba0d887ce2b2d16b9bfefe5690abba60f77ca7d [file] [log] [blame]
Hal Canary6c8422c2020-01-10 15:22:09 -05001// 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"
4REG_FIDDLE(f16to8888drawImageBug, 256, 256, false, 0) {
5// f16to8888drawImageBug
6void 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);
Kevin Lubick5c93acf2023-05-09 12:11:43 -040011 sk_sp<SkSurface> surface = SkSurfaces::Raster(imageInfo);
Hal Canary6c8422c2020-01-10 15:22:09 -050012 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);
Kevin Lubick5c93acf2023-05-09 12:11:43 -040019 sk_sp<SkSurface> surface2 = SkSurfaces::Raster(imageInfo2);
Hal Canary6c8422c2020-01-10 15:22:09 -050020 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