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"
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  flutter::DlISize GetSize() const override;
52 
53  // |DlImage|
54  size_t GetApproximateByteSize() const override;
55 
56  // |DlImage|
57  OwningContext owning_context() const override { return owning_context_; }
58 
59 #if FML_OS_IOS_SIMULATOR
60  // |DlImage|
61  bool IsFakeImage() const override { return is_fake_image_; }
62 #endif // FML_OS_IOS_SIMULATOR
63 
64  private:
65  std::shared_ptr<Texture> texture_;
66  OwningContext owning_context_;
67 #if FML_OS_IOS_SIMULATOR
68  bool is_fake_image_ = false;
69 #endif // FML_OS_IOS_SIMULATOR
70 
71  explicit DlImageImpeller(std::shared_ptr<Texture> texture,
72  OwningContext owning_context = OwningContext::kIO
73 #if FML_OS_IOS_SIMULATOR
74  ,
75  bool is_fake_image = false
76 #endif // FML_OS_IOS_SIMULATOR
77  );
78 
79  DlImageImpeller(const DlImageImpeller&) = delete;
80 
81  DlImageImpeller& operator=(const DlImageImpeller&) = delete;
82 };
83 
84 } // namespace impeller
85 
86 #endif // FLUTTER_IMPELLER_DISPLAY_LIST_DL_IMAGE_IMPELLER_H_
size_t GetApproximateByteSize() const override
static sk_sp< DlImageImpeller > MakeFromYUVTextures(AiksContext *aiks_context, std::shared_ptr< Texture > y_texture, std::shared_ptr< Texture > uv_texture, YUVColorSpace yuv_color_space)
bool isTextureBacked() const override
std::shared_ptr< impeller::Texture > impeller_texture() const override
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
flutter::DlISize GetSize() const override
sk_sp< SkImage > skia_image() const override
bool isUIThreadSafe() const override
bool isOpaque() const override
OwningContext owning_context() const override
YUVColorSpace
Definition: color.h:54