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 class Context;
15 class ContentContext;
16 
17 class DlImageImpeller : public flutter::DlImage {
18  public:
19  // |DlImage|
20  Type GetImageType() const override { return Type::kImpeller; }
21 
22  // |DlImage|
23  const DlImageImpeller* asImpellerImage() const override { return this; }
24 
25  // |DlImage|
26  bool isTextureBacked() const override { return true; }
27 
28  virtual std::shared_ptr<Texture> GetImpellerTexture(
29  const std::shared_ptr<Context>& context) const = 0;
30 
31  std::shared_ptr<Texture> GetCachedTexture(
32  const ContentContext& renderer) const;
33 
34  static sk_sp<DlImageImpeller> Make(
35  std::shared_ptr<Texture> texture,
36  OwningContext owning_context = OwningContext::kIO);
37 
38  static sk_sp<DlImageImpeller> MakeFromYUVTextures(
39  AiksContext* aiks_context,
40  std::shared_ptr<Texture> y_texture,
41  std::shared_ptr<Texture> uv_texture,
42  YUVColorSpace yuv_color_space);
43 };
44 
46  public:
47  DlImageImpellerTexture(std::shared_ptr<Texture> texture,
48  OwningContext owning_context);
49 
51 
52  // |DlImageImpeller|
53  std::shared_ptr<Texture> GetImpellerTexture(
54  const std::shared_ptr<Context>& context) const override;
55 
56  flutter::DlColorSpace GetColorSpace() const override;
57  bool isOpaque() const override;
58  bool isUIThreadSafe() const override;
59  flutter::DlISize GetSize() const override;
60  size_t GetApproximateByteSize() const override;
61  OwningContext owning_context() const override { return owning_context_; }
62 
63  private:
64  std::shared_ptr<Texture> texture_;
65  OwningContext owning_context_;
66 
68  DlImageImpellerTexture& operator=(const DlImageImpellerTexture&) = delete;
69 };
70 
71 } // namespace impeller
72 
73 #endif // FLUTTER_IMPELLER_DISPLAY_LIST_DL_IMAGE_IMPELLER_H_
std::shared_ptr< Texture > GetCachedTexture(const ContentContext &renderer) const
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
virtual std::shared_ptr< Texture > GetImpellerTexture(const std::shared_ptr< Context > &context) const =0
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
const DlImageImpeller * asImpellerImage() const override
Type GetImageType() const override
flutter::DlColorSpace GetColorSpace() const override
DlImageImpellerTexture(std::shared_ptr< Texture > texture, OwningContext owning_context)
bool isUIThreadSafe() const override
flutter::DlISize GetSize() const override
std::shared_ptr< Texture > GetImpellerTexture(const std::shared_ptr< Context > &context) const override
size_t GetApproximateByteSize() const override
OwningContext owning_context() const override
YUVColorSpace
Definition: color.h:54
std::shared_ptr< ContextGLES > context