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/display_list/image/dl_image_skia.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 30 of file animated_image.cc.

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

References Skwasm::live_animated_image_count.

◆ animatedImage_decodeNextFrame()

SKWASM_EXPORT void animatedImage_decodeNextFrame ( SkAnimatedImage *  image)

Definition at line 75 of file animated_image.cc.

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

References image.

◆ animatedImage_dispose()

SKWASM_EXPORT void animatedImage_dispose ( SkAnimatedImage *  image)

Definition at line 57 of file animated_image.cc.

57 {
59 image->unref();
60}

References image, and Skwasm::live_animated_image_count.

◆ animatedImage_getCurrentFrame()

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

Definition at line 79 of file animated_image.cc.

80 {
82 return flutter::DlImageSkia::Make(image->getCurrentFrame()).release();
83}
static sk_sp< DlImage > Make(const SkImage *image)
uint32_t live_image_count

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

◆ animatedImage_getCurrentFrameDurationMilliseconds()

SKWASM_EXPORT int animatedImage_getCurrentFrameDurationMilliseconds ( SkAnimatedImage *  image)

Definition at line 70 of file animated_image.cc.

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

References image.

◆ animatedImage_getFrameCount()

SKWASM_EXPORT int animatedImage_getFrameCount ( SkAnimatedImage *  image)

Definition at line 62 of file animated_image.cc.

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

References image.

◆ animatedImage_getRepetitionCount()

SKWASM_EXPORT int animatedImage_getRepetitionCount ( SkAnimatedImage *  image)

Definition at line 66 of file animated_image.cc.

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

References image.