Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
animated_image.cc File Reference
#include <memory>
#include "flutter/display_list/image/dl_image.h"
#include "flutter/skwasm/export.h"
#include "flutter/skwasm/live_objects.h"
#include "flutter/skwasm/skwasm_support.h"
#include "third_party/skia/include/android/SkAnimatedImage.h"
#include "third_party/skia/include/codec/SkAndroidCodec.h"
#include "third_party/skia/include/codec/SkCodec.h"
#include "third_party/skia/include/codec/SkGifDecoder.h"
#include "third_party/skia/include/codec/SkWebpDecoder.h"

Go to the source code of this file.

Functions

SKWASM_EXPORT SkAnimatedImage * animatedImage_create (SkData *data, int target_width, int target_height)
 
SKWASM_EXPORT void animatedImage_dispose (SkAnimatedImage *image)
 
SKWASM_EXPORT int animatedImage_getFrameCount (SkAnimatedImage *image)
 
SKWASM_EXPORT int animatedImage_getRepetitionCount (SkAnimatedImage *image)
 
SKWASM_EXPORT int animatedImage_getCurrentFrameDurationMilliseconds (SkAnimatedImage *image)
 
SKWASM_EXPORT void animatedImage_decodeNextFrame (SkAnimatedImage *image)
 
SKWASM_EXPORT flutter::DlImageanimatedImage_getCurrentFrame (SkAnimatedImage *image)
 

Function Documentation

◆ animatedImage_create()

SKWASM_EXPORT SkAnimatedImage * animatedImage_create ( SkData *  data,
int  target_width,
int  target_height 
)

Definition at line 29 of file animated_image.cc.

31 {
33 auto codec = getCodecForData(data);
34 if (!codec) {
35 printf("Failed to create codec for animated image.\n");
36 return nullptr;
37 }
38
39 auto android_codec = SkAndroidCodec::MakeFromCodec(std::move(codec));
40 if (android_codec == nullptr) {
41 printf("Failed to create codec for animated image.\n");
42 return nullptr;
43 }
44
45 if (target_width == 0 || target_height == 0) {
46 return SkAnimatedImage::Make(std::move(android_codec)).release();
47 }
48
49 return SkAnimatedImage::Make(
50 std::move(android_codec),
51 SkImageInfo::MakeUnknown(target_width, target_height),
52 SkIRect::MakeWH(target_width, target_height), nullptr)
53 .release();
54}
uint32_t live_animated_image_count
std::shared_ptr< const fml::Mapping > data

References data, and Skwasm::live_animated_image_count.

◆ animatedImage_decodeNextFrame()

SKWASM_EXPORT void animatedImage_decodeNextFrame ( SkAnimatedImage *  image)

Definition at line 74 of file animated_image.cc.

74 {
75 image->decodeNextFrame();
76}
FlutterVulkanImage * image

References image.

◆ animatedImage_dispose()

SKWASM_EXPORT void animatedImage_dispose ( SkAnimatedImage *  image)

Definition at line 56 of file animated_image.cc.

56 {
58 image->unref();
59}

References image, and Skwasm::live_animated_image_count.

◆ animatedImage_getCurrentFrame()

SKWASM_EXPORT flutter::DlImage * animatedImage_getCurrentFrame ( SkAnimatedImage *  image)

Definition at line 78 of file animated_image.cc.

79 {
81 return flutter::DlImage::Make(image->getCurrentFrame()).release();
82}
static sk_sp< DlImage > Make(const SkImage *image)
Definition dl_image.cc:11
uint32_t live_image_count

References image, Skwasm::live_image_count, and flutter::DlImage::Make().

◆ animatedImage_getCurrentFrameDurationMilliseconds()

SKWASM_EXPORT int animatedImage_getCurrentFrameDurationMilliseconds ( SkAnimatedImage *  image)

Definition at line 69 of file animated_image.cc.

70 {
71 return image->currentFrameDuration();
72}

References image.

◆ animatedImage_getFrameCount()

SKWASM_EXPORT int animatedImage_getFrameCount ( SkAnimatedImage *  image)

Definition at line 61 of file animated_image.cc.

61 {
62 return image->getFrameCount();
63}

References image.

◆ animatedImage_getRepetitionCount()

SKWASM_EXPORT int animatedImage_getRepetitionCount ( SkAnimatedImage *  image)

Definition at line 65 of file animated_image.cc.

65 {
66 return image->getRepetitionCount();
67}

References image.