Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
flutter::ImageDecoder Class Referenceabstract

#include <image_decoder.h>

Inheritance diagram for flutter::ImageDecoder:
flutter::ImageDecoderImpeller flutter::ImageDecoderSkia

Public Types

using ImageResult = std::function< void(sk_sp< DlImage >, std::string)>
 

Public Member Functions

virtual ~ImageDecoder ()
 
virtual void Decode (fml::RefPtr< ImageDescriptor > descriptor, uint32_t target_width, uint32_t target_height, const ImageResult &result)=0
 
fml::WeakPtr< ImageDecoderGetWeakPtr () const
 

Static Public Member Functions

static std::unique_ptr< ImageDecoderMake (const Settings &settings, const TaskRunners &runners, std::shared_ptr< fml::ConcurrentTaskRunner > concurrent_task_runner, fml::WeakPtr< IOManager > io_manager, const std::shared_ptr< fml::SyncSwitch > &gpu_disabled_switch)
 

Protected Member Functions

 ImageDecoder (const TaskRunners &runners, std::shared_ptr< fml::ConcurrentTaskRunner > concurrent_task_runner, fml::WeakPtr< IOManager > io_manager)
 

Protected Attributes

TaskRunners runners_
 
std::shared_ptr< fml::ConcurrentTaskRunnerconcurrent_task_runner_
 
fml::WeakPtr< IOManagerio_manager_
 

Detailed Description

Definition at line 24 of file image_decoder.h.

Member Typedef Documentation

◆ ImageResult

Definition at line 35 of file image_decoder.h.

Constructor & Destructor Documentation

◆ ~ImageDecoder()

flutter::ImageDecoder::~ImageDecoder ( )
virtualdefault

◆ ImageDecoder()

flutter::ImageDecoder::ImageDecoder ( const TaskRunners runners,
std::shared_ptr< fml::ConcurrentTaskRunner concurrent_task_runner,
fml::WeakPtr< IOManager io_manager 
)
protected

Definition at line 43 of file image_decoder.cc.

47 : runners_(runners),
48 concurrent_task_runner_(std::move(concurrent_task_runner)),
49 io_manager_(std::move(io_manager)),
50 weak_factory_(this) {
53 << "The image decoder must be created & collected on the UI thread.";
54}
std::shared_ptr< fml::ConcurrentTaskRunner > concurrent_task_runner_
Definition: image_decoder.h:51
fml::WeakPtr< IOManager > io_manager_
Definition: image_decoder.h:52
bool IsValid() const
Definition: task_runners.cc:46
fml::RefPtr< fml::TaskRunner > GetUITaskRunner() const
Definition: task_runners.cc:34
virtual bool RunsTasksOnCurrentThread()
Definition: task_runner.cc:43
#define FML_DCHECK(condition)
Definition: logging.h:103

Member Function Documentation

◆ Decode()

virtual void flutter::ImageDecoder::Decode ( fml::RefPtr< ImageDescriptor descriptor,
uint32_t  target_width,
uint32_t  target_height,
const ImageResult result 
)
pure virtual

◆ GetWeakPtr()

fml::WeakPtr< ImageDecoder > flutter::ImageDecoder::GetWeakPtr ( ) const

Definition at line 58 of file image_decoder.cc.

58 {
59 return weak_factory_.GetWeakPtr();
60}

◆ Make()

std::unique_ptr< ImageDecoder > flutter::ImageDecoder::Make ( const Settings settings,
const TaskRunners runners,
std::shared_ptr< fml::ConcurrentTaskRunner concurrent_task_runner,
fml::WeakPtr< IOManager io_manager,
const std::shared_ptr< fml::SyncSwitch > &  gpu_disabled_switch 
)
static

Definition at line 15 of file image_decoder.cc.

20 {
21#if IMPELLER_SUPPORTS_RENDERING
22 if (settings.enable_impeller) {
23 return std::make_unique<ImageDecoderImpeller>(
24 runners, //
25 std::move(concurrent_task_runner), //
26 std::move(io_manager), //
27 settings.enable_wide_gamut, //
28 gpu_disabled_switch);
29 }
30#endif // IMPELLER_SUPPORTS_RENDERING
31#if !SLIMPELLER
32 return std::make_unique<ImageDecoderSkia>(
33 runners, //
34 std::move(concurrent_task_runner), //
35 std::move(io_manager) //
36 );
37#else // !SLIMPELLER
38 FML_LOG(FATAL) << "Could not setup an image decoder.";
39 return nullptr;
40#endif // !SLIMPELLER
41}
#define FATAL(error)
#define FML_LOG(severity)
Definition: logging.h:82

Member Data Documentation

◆ concurrent_task_runner_

std::shared_ptr<fml::ConcurrentTaskRunner> flutter::ImageDecoder::concurrent_task_runner_
protected

Definition at line 51 of file image_decoder.h.

◆ io_manager_

fml::WeakPtr<IOManager> flutter::ImageDecoder::io_manager_
protected

Definition at line 52 of file image_decoder.h.

◆ runners_

TaskRunners flutter::ImageDecoder::runners_
protected

Definition at line 50 of file image_decoder.h.


The documentation for this class was generated from the following files: