Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / src / gpu / graphite / TextureProxy.h
1 /*
2  * Copyright 2021 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 skgpu_graphite_TextureProxy_DEFINED
9 #define skgpu_graphite_TextureProxy_DEFINED
10
11 #include "include/core/SkRefCnt.h"
12 #include "include/core/SkSize.h"
13 #include "include/gpu/graphite/TextureInfo.h"
14
15 namespace skgpu::graphite {
16
17 class ResourceProvider;
18 class Texture;
19
20 class TextureProxy : public SkRefCnt {
21 public:
22     TextureProxy(SkISize dimensions, const TextureInfo& info, SkBudgeted budgeted);
23     TextureProxy(sk_sp<Texture>);
24
25     ~TextureProxy() override;
26
27     int numSamples() const { return fInfo.numSamples(); }
28     Mipmapped mipmapped() const { return Mipmapped(fInfo.numMipLevels() > 1); }
29
30     SkISize dimensions() const { return fDimensions; }
31     const TextureInfo& textureInfo() const { return fInfo; }
32
33     bool instantiate(ResourceProvider*);
34     sk_sp<Texture> refTexture() const;
35     const Texture* texture() const;
36
37 private:
38 #ifdef SK_DEBUG
39     void validateTexture(const Texture*);
40 #endif
41
42     SkISize fDimensions;
43     TextureInfo fInfo;
44
45     SkBudgeted fBudgeted;
46
47     sk_sp<Texture> fTexture;
48 };
49
50 } // namepsace skgpu::graphite
51
52 #endif // skgpu_graphite_TextureProxy_DEFINED