Debian Codegraph @

src/gpu/ganesh/image/SkImage_LazyTexture.h

raw
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 #ifndef SkImage_LazyTexture_DEFINED
8 #define SkImage_LazyTexture_DEFINED
9
10 #include "include/core/SkRefCnt.h"
11 #include "include/core/SkTypes.h"
12 #include "src/image/SkImage_Lazy.h"
13
14 class GrDirectContext;
15 class SkImage;
16 class SkPixmap;
17 class SkRecorder;
18 struct SkIRect;
19
20 /**
21 * SkImage_LazyTexture is a GPU-backed SkImage that defers the creation of its backing texture
22 * until it is actually required for a draw. It is instantiated with a GrTextureGenerator, which is
23 * a factory object that knows how to create the texture on demand.
24 *
25 * This class is the concrete implementation for SkImages created from platform-specific objects
26 * like Android's AHardwareBuffer. In that case, the generator wraps the hardware buffer and the
27 * "generation" of the texture is simply the act of importing that buffer into the graphics API
28 * (e.g., Vulkan or GL).
29 */
30 class SkImage_LazyTexture final : public SkImage_Lazy {
31 public:
32 explicit SkImage_LazyTexture(SkImage_Lazy::Validator* validator) : SkImage_Lazy(validator) {}
33
34 bool readPixelsProxy(GrDirectContext*, const SkPixmap&) const override;
35
36 SkImage_Base::Type type() const override { return SkImage_Base::Type::kLazyTexture; }
37
38 sk_sp<SkImage> onMakeSubset(SkRecorder*, const SkIRect&, RequiredProperties) const override;
39 };
40
41 #endif