Flutter Engine
The Flutter Engine
GrPromiseImageTexture.h
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
8#ifndef GrPromiseImageTexture_DEFINED
9#define GrPromiseImageTexture_DEFINED
10
14/**
15 * This type is used to fulfill textures for PromiseImages. Once an instance is returned from a
16 * PromiseImageTextureFulfillProc the GrBackendTexture it wraps must remain valid until the
17 * corresponding PromiseImageTextureReleaseProc is called.
18 */
19class SK_API GrPromiseImageTexture : public SkNVRefCnt<GrPromiseImageTexture> {
20public:
27
28 static sk_sp<GrPromiseImageTexture> Make(const GrBackendTexture& backendTexture) {
29 if (!backendTexture.isValid()) {
30 return nullptr;
31 }
32 return sk_sp<GrPromiseImageTexture>(new GrPromiseImageTexture(backendTexture));
33 }
34
35 GrBackendTexture backendTexture() const { return fBackendTexture; }
36
37private:
38 explicit GrPromiseImageTexture(const GrBackendTexture& backendTexture);
39
40 GrBackendTexture fBackendTexture;
41};
42
43#endif // GrPromiseImageTexture_DEFINED
#define SK_API
Definition: SkAPI.h:35
bool isValid() const
GrPromiseImageTexture & operator=(const GrPromiseImageTexture &)=delete
GrPromiseImageTexture & operator=(GrPromiseImageTexture &&)=delete
GrPromiseImageTexture()=delete
GrBackendTexture backendTexture() const
GrPromiseImageTexture(const GrPromiseImageTexture &)=delete
GrPromiseImageTexture(GrPromiseImageTexture &&)=delete
static sk_sp< GrPromiseImageTexture > Make(const GrBackendTexture &backendTexture)