Flutter Engine
The Flutter Engine
|
Keeps a priority-ordered registry of image generator builders to be used when decoding images. This object must be created, accessed, and collected on the UI thread (typically the engine or its runtime controller). More...
#include <image_generator_registry.h>
Public Member Functions | |
ImageGeneratorRegistry () | |
~ImageGeneratorRegistry () | |
void | AddFactory (ImageGeneratorFactory factory, int32_t priority) |
Install a new factory for image generators. More... | |
std::shared_ptr< ImageGenerator > | CreateCompatibleGenerator (const sk_sp< SkData > &buffer) |
Walks the list of image generator builders in descending priority order until a compatible ImageGenerator is able to be built. This method is safe to perform on the UI thread, as checking for ImageGenerator compatibility is expected to be a lightweight operation. The returned ImageGenerator can then be used to fully decode the image on e.g. the IO thread. More... | |
fml::WeakPtr< ImageGeneratorRegistry > | GetWeakPtr () const |
Keeps a priority-ordered registry of image generator builders to be used when decoding images. This object must be created, accessed, and collected on the UI thread (typically the engine or its runtime controller).
Definition at line 28 of file image_generator_registry.h.
flutter::ImageGeneratorRegistry::ImageGeneratorRegistry | ( | ) |
Definition at line 21 of file image_generator_registry.cc.
|
default |
void flutter::ImageGeneratorRegistry::AddFactory | ( | ImageGeneratorFactory | factory, |
int32_t | priority | ||
) |
Install a new factory for image generators.
[in] | factory | Callback that produces ImageGenerator s for compatible input data. |
[in] | priority | The priority used to determine the order in which factories are tried. Higher values mean higher priority. The built-in Skia decoders are installed at priority 0, and so a priority > 0 takes precedent over the builtin decoders. When multiple decoders are added with the same priority, those which are added earlier take precedent. |
CreateCompatibleGenerator
Definition at line 57 of file image_generator_registry.cc.
std::shared_ptr< ImageGenerator > flutter::ImageGeneratorRegistry::CreateCompatibleGenerator | ( | const sk_sp< SkData > & | buffer | ) |
Walks the list of image generator builders in descending priority order until a compatible ImageGenerator
is able to be built. This method is safe to perform on the UI thread, as checking for ImageGenerator
compatibility is expected to be a lightweight operation. The returned ImageGenerator
can then be used to fully decode the image on e.g. the IO thread.
[in] | buffer | The raw encoded image data. |
ImageGenerator
that is compatible with the input buffer. If no compatible ImageGenerator
type was found, then std::shared_ptr<ImageGenerator>(nullptr)
is returned. ImageGenerator
Definition at line 63 of file image_generator_registry.cc.
fml::WeakPtr< ImageGeneratorRegistry > flutter::ImageGeneratorRegistry::GetWeakPtr | ( | ) | const |
Definition at line 82 of file image_generator_registry.cc.