| 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
8 #include "impeller/core/texture.h"
9 #include "impeller/display_list/dl_image_impeller.h"
10 #include "impeller/toolkit/interop/context.h"
11 #include "impeller/toolkit/interop/impeller.h"
12 #include "impeller/toolkit/interop/object.h"
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
38 impeller::Context::BackendType GetBackendType() const;
39
40 const std::shared_ptr<impeller::Texture>& GetTexture() const;
41
42 private:
43 impeller::Context::BackendType backend_ =
44 impeller::Context::BackendType::kMetal;
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
BackendType
Definition: context.h:67
impeller::Context::BackendType::kMetal
@ kMetal
impeller::interop::Context
Definition: context.h:16
impeller::interop::Object
Definition: object.h:56
impeller::interop::Texture
Definition: texture.h:17
impeller::interop::Texture::~Texture
~Texture() override
impeller::interop::Texture::GetBackendType
impeller::Context::BackendType GetBackendType() const
Definition: texture.cc:51
impeller::interop::Texture::GetTexture
const std::shared_ptr< impeller::Texture > & GetTexture() const
Definition: texture.cc:55
impeller::interop::Texture::IsValid
bool IsValid() const
Definition: texture.cc:29
impeller::interop::Texture::Texture
Texture(const Texture &)=delete
impeller::interop::Texture::operator=
Texture & operator=(const Texture &)=delete
impeller::interop::Texture::MakeImage
sk_sp< DlImageImpeller > MakeImage() const
Definition: texture.cc:47
impeller::interop::Texture::SetContents
bool SetContents(const uint8_t *contents, uint64_t length)
Definition: texture.cc:33
impeller::interop::Texture::Texture
Texture(const Context &context, const TextureDescriptor &descriptor)
Definition: texture.cc:9
texture.h
dl_image_impeller.h
impeller.h
impeller::interop
Definition: context_gles.cc:12
object.h
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition: texture_descriptor.h:38
context.h