| Flutter Impeller |

dl_image_impeller.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_DISPLAY_LIST_DL_IMAGE_IMPELLER_H_
6 #define FLUTTER_IMPELLER_DISPLAY_LIST_DL_IMAGE_IMPELLER_H_
7
8 #include "flutter/display_list/image/dl_image.h"
9 #include "impeller/core/texture.h"
10
11 namespace impeller {
12
13 class AiksContext;
14
15 class DlImageImpeller final : public flutter::DlImage {
16 public:
17 static sk_sp<DlImageImpeller> Make(
18 std::shared_ptr<Texture> texture,
19 OwningContext owning_context = OwningContext::kIO
20 #if FML_OS_IOS_SIMULATOR
21 ,
22 bool is_fake_image = false
23 #endif // FML_OS_IOS_SIMULATOR
24 );
25
26 static sk_sp<DlImageImpeller> MakeFromYUVTextures(
27 AiksContext* aiks_context,
28 std::shared_ptr<Texture> y_texture,
29 std::shared_ptr<Texture> uv_texture,
30 YUVColorSpace yuv_color_space);
31
32 // |DlImage|
33 ~DlImageImpeller() override;
34
35 // |DlImage|
36 sk_sp<SkImage> skia_image() const override;
37
38 // |DlImage|
39 std::shared_ptr<impeller::Texture> impeller_texture() const override;
40
41 // |DlImage|
42 bool isOpaque() const override;
43
44 // |DlImage|
45 bool isTextureBacked() const override;
46
47 // |DlImage|
48 bool isUIThreadSafe() const override;
49
50 // |DlImage|
51 SkISize dimensions() const override;
52
53 // |DlImage|
54 flutter::DlISize GetSize() const override;
55
56 // |DlImage|
57 size_t GetApproximateByteSize() const override;
58
59 // |DlImage|
60 OwningContext owning_context() const override { return owning_context_; }
61
62 #if FML_OS_IOS_SIMULATOR
63 // |DlImage|
64 bool IsFakeImage() const override { return is_fake_image_; }
65 #endif // FML_OS_IOS_SIMULATOR
66
67 private:
68 std::shared_ptr<Texture> texture_;
69 OwningContext owning_context_;
70 #if FML_OS_IOS_SIMULATOR
71 bool is_fake_image_ = false;
72 #endif // FML_OS_IOS_SIMULATOR
73
74 explicit DlImageImpeller(std::shared_ptr<Texture> texture,
75 OwningContext owning_context = OwningContext::kIO
76 #if FML_OS_IOS_SIMULATOR
77 ,
78 bool is_fake_image = false
79 #endif // FML_OS_IOS_SIMULATOR
80 );
81
82 DlImageImpeller(const DlImageImpeller&) = delete;
83
84 DlImageImpeller& operator=(const DlImageImpeller&) = delete;
85 };
86
87 } // namespace impeller
88
89 #endif // FLUTTER_IMPELLER_DISPLAY_LIST_DL_IMAGE_IMPELLER_H_
impeller::AiksContext
Definition: aiks_context.h:19
impeller::DlImageImpeller
Definition: dl_image_impeller.h:15
impeller::DlImageImpeller::GetApproximateByteSize
size_t GetApproximateByteSize() const override
Definition: dl_image_impeller.cc:120
impeller::DlImageImpeller::MakeFromYUVTextures
static sk_sp< DlImageImpeller > MakeFromYUVTextures(AiksContext *aiks_context, std::shared_ptr< Texture > y_texture, std::shared_ptr< Texture > uv_texture, YUVColorSpace yuv_color_space)
Definition: dl_image_impeller.cc:33
impeller::DlImageImpeller::isTextureBacked
bool isTextureBacked() const override
Definition: dl_image_impeller.cc:95
impeller::DlImageImpeller::impeller_texture
std::shared_ptr< impeller::Texture > impeller_texture() const override
Definition: dl_image_impeller.cc:84
impeller::DlImageImpeller::dimensions
SkISize dimensions() const override
Definition: dl_image_impeller.cc:107
impeller::DlImageImpeller::Make
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
Definition: dl_image_impeller.cc:23
impeller::DlImageImpeller::GetSize
flutter::DlISize GetSize() const override
Definition: dl_image_impeller.cc:113
impeller::DlImageImpeller::skia_image
sk_sp< SkImage > skia_image() const override
Definition: dl_image_impeller.cc:79
impeller::DlImageImpeller::~DlImageImpeller
~DlImageImpeller() override
impeller::DlImageImpeller::isUIThreadSafe
bool isUIThreadSafe() const override
Definition: dl_image_impeller.cc:101
impeller::DlImageImpeller::isOpaque
bool isOpaque() const override
Definition: dl_image_impeller.cc:89
impeller::DlImageImpeller::owning_context
OwningContext owning_context() const override
Definition: dl_image_impeller.h:60
texture.h
impeller
Definition: allocation.cc:12
impeller::YUVColorSpace
YUVColorSpace
Definition: color.h:54