2 * Copyright 2021 Google LLC
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef skgpu_graphite_TextureProxy_DEFINED
9 #define skgpu_graphite_TextureProxy_DEFINED
11 #include "include/core/SkRefCnt.h"
12 #include "include/core/SkSize.h"
13 #include "include/gpu/graphite/TextureInfo.h"
15 namespace skgpu::graphite {
17 class ResourceProvider;
20 class TextureProxy : public SkRefCnt {
22 TextureProxy(SkISize dimensions, const TextureInfo& info, SkBudgeted budgeted);
23 TextureProxy(sk_sp<Texture>);
25 ~TextureProxy() override;
27 int numSamples() const { return fInfo.numSamples(); }
28 Mipmapped mipmapped() const { return Mipmapped(fInfo.numMipLevels() > 1); }
30 SkISize dimensions() const { return fDimensions; }
31 const TextureInfo& textureInfo() const { return fInfo; }
33 bool instantiate(ResourceProvider*);
34 sk_sp<Texture> refTexture() const;
35 const Texture* texture() const;
39 void validateTexture(const Texture*);
47 sk_sp<Texture> fTexture;
50 } // namepsace skgpu::graphite
52 #endif // skgpu_graphite_TextureProxy_DEFINED