Flutter Engine
The Flutter Engine
f16to8888drawImageBug.cpp
Go to the documentation of this file.
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.
4REG_FIDDLE(f16to8888drawImageBug, 256, 256, false, 0) {
5// f16to8888drawImageBug
6void draw(SkCanvas* canvas) {
8
9 SkImageInfo imageInfo =
12 SkPaint p;
13 surface->getCanvas()->drawRect(SkRect::MakeXYWH(20, 20, 40, 40), p);
14
16
17 SkImageInfo imageInfo2 =
18 SkImageInfo::Make(100, 100, kN32_SkColorType, kPremul_SkAlphaType, colorSpace2);
19 sk_sp<SkSurface> surface2 = SkSurfaces::Raster(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
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition: SkColorType.h:38
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkColorSpace > MakeSRGBLinear()
SkCanvas * getCanvas()
Definition: SkSurface.cpp:82
sk_sp< SkImage > makeImageSnapshot()
Definition: SkSurface.cpp:90
VkSurfaceKHR surface
Definition: main.cc:49
REG_FIDDLE(f16to8888drawImageBug, 256, 256, false, 0)
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659