Flutter Impeller
texture.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_IMPELLER_TOOLKIT_INTEROP_TEXTURE_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_INTEROP_TEXTURE_H_
7 
13 
14 namespace impeller::interop {
15 
16 class Texture final
17  : public Object<Texture, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerTexture)> {
18  public:
19  explicit Texture(const Context& context, const TextureDescriptor& descriptor);
20 
21  explicit Texture(impeller::Context::BackendType backend,
22  std::shared_ptr<impeller::Texture> texture);
23 
24  ~Texture() override;
25 
26  Texture(const Texture&) = delete;
27 
28  Texture& operator=(const Texture&) = delete;
29 
30  bool IsValid() const;
31 
32  bool SetContents(const uint8_t* contents, uint64_t length);
33 
34  bool SetContents(std::shared_ptr<const fml::Mapping> contents);
35 
36  sk_sp<DlImageImpeller> MakeImage() const;
37 
39 
40  const std::shared_ptr<impeller::Texture>& GetTexture() const;
41 
42  private:
45  std::shared_ptr<impeller::Texture> texture_;
46 };
47 
48 } // namespace impeller::interop
49 
50 #endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_TEXTURE_H_
impeller::Context::BackendType GetBackendType() const
Definition: texture.cc:51
const std::shared_ptr< impeller::Texture > & GetTexture() const
Definition: texture.cc:55
bool IsValid() const
Definition: texture.cc:29
Texture(const Texture &)=delete
Texture & operator=(const Texture &)=delete
sk_sp< DlImageImpeller > MakeImage() const
Definition: texture.cc:47
bool SetContents(const uint8_t *contents, uint64_t length)
Definition: texture.cc:33
Texture(const Context &context, const TextureDescriptor &descriptor)
Definition: texture.cc:9
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...