#include <image_generator.h>
|
| ~BuiltinSkiaCodecImageGenerator () |
|
| BuiltinSkiaCodecImageGenerator (std::unique_ptr< SkCodec > codec) |
|
| BuiltinSkiaCodecImageGenerator (sk_sp< SkData > buffer) |
|
const SkImageInfo & | GetInfo () override |
| Returns basic information about the contents of the encoded image. This information can almost always be collected by just interpreting the header of a decoded image.
|
|
unsigned int | GetFrameCount () const override |
| Get the number of frames that the encoded image stores. This method is always expected to be called before GetFrameInfo , as the underlying image decoder may interpret frame information that is then used when calling GetFrameInfo .
|
|
unsigned int | GetPlayCount () const override |
| The number of times an animated image should play through before playback stops.
|
|
const ImageGenerator::FrameInfo | GetFrameInfo (unsigned int frame_index) override |
| Get information about a single frame in the context of a multi-frame image, useful for animation and frame blending. This method should only ever be called after GetFrameCount has been called. This information is nonsensical for single-frame images.
|
|
SkISize | GetScaledDimensions (float desired_scale) override |
| Given a scale value, find the closest image size that can be used for efficiently decoding the image. If subpixel image decoding is not supported by the decoder, this method should just return the original image size.
|
|
bool | GetPixels (const SkImageInfo &info, void *pixels, size_t row_bytes, unsigned int frame_index=0, std::optional< unsigned int > prior_frame=std::nullopt) override |
| Decode the image into a given buffer. This method is currently always used for sub-pixel image decoding. For full-sized still images, GetImage is always attempted first.
|
|
virtual | ~ImageGenerator () |
|
sk_sp< SkImage > | GetImage () |
| Creates an SkImage based on the current ImageInfo of this ImageGenerator .
|
|
Definition at line 183 of file image_generator.h.
◆ ~BuiltinSkiaCodecImageGenerator()
flutter::BuiltinSkiaCodecImageGenerator::~BuiltinSkiaCodecImageGenerator |
( |
| ) |
|
|
default |
◆ BuiltinSkiaCodecImageGenerator() [1/2]
flutter::BuiltinSkiaCodecImageGenerator::BuiltinSkiaCodecImageGenerator |
( |
std::unique_ptr< SkCodec > |
codec | ) |
|
|
explicit |
Definition at line 98 of file image_generator.cc.
100 : codec_(std::move(codec)) {
102}
static SkImageInfo getInfoIncludingExif(SkCodec *codec)
◆ BuiltinSkiaCodecImageGenerator() [2/2]
flutter::BuiltinSkiaCodecImageGenerator::BuiltinSkiaCodecImageGenerator |
( |
sk_sp< SkData > |
buffer | ) |
|
|
explicit |
Definition at line 104 of file image_generator.cc.
108}
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
◆ GetFrameCount()
unsigned int flutter::BuiltinSkiaCodecImageGenerator::GetFrameCount |
( |
| ) |
const |
|
overridevirtual |
Get the number of frames that the encoded image stores. This method is always expected to be called before GetFrameInfo
, as the underlying image decoder may interpret frame information that is then used when calling GetFrameInfo
.
- Returns
- The number of frames that the encoded image stores. This will always be 1 for single-frame images.
Implements flutter::ImageGenerator.
Definition at line 114 of file image_generator.cc.
114 {
115 return codec_->getFrameCount();
116}
◆ GetFrameInfo()
Get information about a single frame in the context of a multi-frame image, useful for animation and frame blending. This method should only ever be called after GetFrameCount
has been called. This information is nonsensical for single-frame images.
- Parameters
-
[in] | frame_index | The index of the frame to get information about. |
- Returns
- Information about the given frame. If the image is single-frame, a default result is returned.
- See also
GetFrameCount
Implements flutter::ImageGenerator.
Definition at line 123 of file image_generator.cc.
124 {
126 codec_->getFrameInfo(frame_index, &
info);
127 return {
129 ? std::nullopt
130 : std::optional<unsigned int>(
info.fRequiredFrame),
131 .duration =
static_cast<unsigned int>(
info.fDuration),
132 .disposal_method =
info.fDisposalMethod};
133}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static constexpr int kNoFrame
◆ GetInfo()
const SkImageInfo & flutter::BuiltinSkiaCodecImageGenerator::GetInfo |
( |
| ) |
|
|
overridevirtual |
Returns basic information about the contents of the encoded image. This information can almost always be collected by just interpreting the header of a decoded image.
- Returns
- Size and color information describing the image.
- Note
- This method is executed on the UI thread and used for layout purposes by the framework, and so this method should not perform long synchronous tasks.
Implements flutter::ImageGenerator.
Definition at line 110 of file image_generator.cc.
110 {
111 return image_info_;
112}
◆ GetPixels()
bool flutter::BuiltinSkiaCodecImageGenerator::GetPixels |
( |
const SkImageInfo & |
info, |
|
|
void * |
pixels, |
|
|
size_t |
row_bytes, |
|
|
unsigned int |
frame_index = 0 , |
|
|
std::optional< unsigned int > |
prior_frame = std::nullopt |
|
) |
| |
|
overridevirtual |
Decode the image into a given buffer. This method is currently always used for sub-pixel image decoding. For full-sized still images, GetImage
is always attempted first.
- Parameters
-
[in] | info | The desired size and color info of the decoded image to be returned. The implementation of GetScaledDimensions determines which sizes are supported by the image decoder. |
[in] | pixels | The location where the raw decoded image data should be written. |
[in] | row_bytes | The total number of bytes that should make up a single row of decoded image data (i.e. width * bytes_per_pixel). |
[in] | frame_index | Which frame to decode. This is only useful for multi-frame images. |
[in] | prior_frame | Optional frame index parameter for multi-frame images which specifies the previous frame that should be use for blending. This hints to the decoder that it should use a previously cached frame instead of decoding dependency frame(s). If an empty value is supplied, the decoder should decode any necessary frames first. |
- Returns
- True if the image was successfully decoded.
- Note
- This method performs potentially long synchronous work, and so it should never be executed on the UI thread. Image decoders do not require GPU acceleration, and so threads without a GPU context may also be used.
- See also
GetScaledDimensions
Implements flutter::ImageGenerator.
Definition at line 144 of file image_generator.cc.
149 {
152 if (prior_frame.has_value()) {
153 options.fPriorFrame = prior_frame.value();
154 }
156
161
162 temp_pixmap = output_pixmap;
163 } else {
164
165
168
170 }
172 FML_DLOG(
ERROR) <<
"Failed to allocate memory for bitmap of size "
174 return false;
175 }
176 temp_pixmap = temp_bitmap.
pixmap();
177 }
178
181 FML_DLOG(WARNING) <<
"codec could not get pixels. "
183 return false;
184 }
186 return true;
187 }
189}
@ kTopLeft_SkEncodedOrigin
static bool SkEncodedOriginSwapsWidthHeight(SkEncodedOrigin origin)
const SkPixmap & pixmap() const
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
static const char * ResultToString(Result)
#define FML_DLOG(severity)
SK_API bool Orient(const SkPixmap &dst, const SkPixmap &src, SkEncodedOrigin origin)
SK_API SkImageInfo SwapWidthHeight(const SkImageInfo &info)
size_t computeMinByteSize() const
◆ GetPlayCount()
unsigned int flutter::BuiltinSkiaCodecImageGenerator::GetPlayCount |
( |
| ) |
const |
|
overridevirtual |
The number of times an animated image should play through before playback stops.
- Returns
- If this image is animated, the number of times the animation should play through is returned, otherwise it'll just return 1. If the animation should loop forever,
kInfinitePlayCount
is returned.
Implements flutter::ImageGenerator.
Definition at line 118 of file image_generator.cc.
118 {
119 auto repetition_count = codec_->getRepetitionCount();
121}
static const unsigned int kInfinitePlayCount
Frame count value to denote infinite looping.
◆ GetScaledDimensions()
SkISize flutter::BuiltinSkiaCodecImageGenerator::GetScaledDimensions |
( |
float |
scale | ) |
|
|
overridevirtual |
Given a scale value, find the closest image size that can be used for efficiently decoding the image. If subpixel image decoding is not supported by the decoder, this method should just return the original image size.
- Parameters
-
[in] | scale | The desired scale factor of the image for decoding. |
- Returns
- The closest image size that can be used for efficiently decoding the image.
- Note
- This method is called prior to
GetPixels
in order to query for supported sizes.
- See also
GetPixels
Implements flutter::ImageGenerator.
Definition at line 135 of file image_generator.cc.
136 {
137 SkISize size = codec_->getScaledDimensions(desired_scale);
139 std::swap(
size.fWidth,
size.fHeight);
140 }
142}
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
◆ MakeFromData()
Definition at line 191 of file image_generator.cc.
192 {
194 if (!codec) {
195 return nullptr;
196 }
197 return std::make_unique<BuiltinSkiaCodecImageGenerator>(std::move(codec));
198}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
The documentation for this class was generated from the following files: