Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
ProtectedUtils_Graphite.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
15
16using namespace skgpu;
17using namespace skgpu::graphite;
18
19namespace ProtectedUtils {
20
22 SkISize size,
23 Protected isProtected) {
25
27 ii,
28 Mipmapped::kNo,
29 isProtected,
30 /* surfaceProps= */ nullptr);
31 if (!surface) {
32 SK_ABORT("Could not create %s surface.",
33 isProtected == Protected::kYes ? "protected" : "unprotected");
34 return nullptr;
35 }
36
37 SkCanvas* canvas = surface->getCanvas();
38
39 canvas->clear(SkColors::kBlue);
40
41 return surface;
42}
43
45 SkISize size,
47 Protected isProtected) {
49
50 sk_sp<SkImage> image = sk_gpu_test::MakeBackendTextureImage(recorder,
51 ii,
52 color,
53 Mipmapped::kNo,
54 Renderable::kNo,
55 Origin::kTopLeft,
56 isProtected);
57 if (!image) {
58 SK_ABORT("Could not create %s image.",
59 isProtected == Protected::kYes ? "protected" : "unprotected");
60 return nullptr;
61 }
62
63 return image;
64}
65
66} // namespace ProtectedUtils
SkColor4f color
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition SkAlphaType.h:29
#define SK_ABORT(message,...)
Definition SkAssert.h:70
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition SkColorType.h:24
void clear(SkColor color)
Definition SkCanvas.h:1199
VkSurfaceKHR surface
Definition main.cc:49
sk_sp< SkImage > image
Definition examples.cpp:29
sk_sp< SkSurface > CreateProtectedSkSurface(GrDirectContext *dContext, SkISize size, bool textureable, bool isProtected, const SkSurfaceProps *surfaceProps)
sk_sp< SkImage > CreateProtectedSkImage(GrDirectContext *dContext, SkISize size, SkColor4f color, bool isProtected)
constexpr SkColor4f kBlue
Definition SkColor.h:442
sk_sp< SkSurface > MakeBackendTextureSurface(GrDirectContext *dContext, const SkImageInfo &ii, GrSurfaceOrigin origin, int sampleCnt, skgpu::Mipmapped mipmapped, GrProtected isProtected, const SkSurfaceProps *props)
Protected
Definition GpuTypes.h:61
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)