5#include "flutter/lib/ui/painting/image_generator_registry.h"
7#include "flutter/fml/mapping.h"
8#include "flutter/shell/common/shell_test.h"
9#include "flutter/testing/testing.h"
24 fixture_mapping->GetSize(), on_release,
25 fixture_mapping.get());
28 fixture_mapping.release();
41 ASSERT_EQ(
info.width(), 3024);
42 ASSERT_EQ(
info.height(), 4032);
48 ASSERT_EQ(
result,
nullptr);
55 identifiableFakeWidth,
76 unsigned int frame_index,
77 std::optional<unsigned int> prior_frame) {
88 const int fake_width = 1337;
91 return std::make_unique<FakeImageGenerator>(fake_width);
97 ASSERT_EQ(
result->GetInfo().width(), fake_width);
105 return std::make_unique<FakeImageGenerator>(1337);
113 ASSERT_EQ(
result->GetInfo().width(), 3024);
121 return std::make_unique<FakeImageGenerator>(1337);
129 ASSERT_EQ(
result->GetInfo().width(), 3024);
138 return std::make_unique<FakeImageGenerator>(1337);
143 return std::make_unique<FakeImageGenerator>(7777);
150 ASSERT_EQ(
result->GetInfo().width(), 1337);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kOpaque_SkAlphaType
pixel is opaque
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
void(* ReleaseProc)(const void *ptr, void *context)
static sk_sp< SkData > MakeWithProc(const void *ptr, size_t length, ReleaseProc proc, void *ctx)
static sk_sp< SkData > MakeEmpty()
Keeps a priority-ordered registry of image generator builders to be used when decoding images....
std::shared_ptr< ImageGenerator > CreateCompatibleGenerator(const sk_sp< SkData > &buffer)
Walks the list of image generator builders in descending priority order until a compatible ImageGener...
void AddFactory(ImageGeneratorFactory factory, int32_t priority)
Install a new factory for image generators.
The minimal interface necessary for defining a decoder that can be used for both single and multi-fra...
FakeImageGenerator(int identifiableFakeWidth)
unsigned int GetPlayCount() const
The number of times an animated image should play through before playback stops.
~FakeImageGenerator()=default
bool GetPixels(const SkImageInfo &info, void *pixels, size_t row_bytes, unsigned int frame_index, std::optional< unsigned int > prior_frame)
Decode the image into a given buffer. This method is currently always used for sub-pixel image decodi...
const SkImageInfo & GetInfo()
Returns basic information about the contents of the encoded image. This information can almost always...
unsigned int GetFrameCount() const
Get the number of frames that the encoded image stores. This method is always expected to be called b...
SkISize GetScaledDimensions(float scale)
Given a scale value, find the closest image size that can be used for efficiently decoding the image....
const ImageGenerator::FrameInfo GetFrameInfo(unsigned int frame_index)
Get information about a single frame in the context of a multi-frame image, useful for animation and ...
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
TEST_F(DisplayListTest, Defaults)
std::unique_ptr< fml::Mapping > OpenFixtureAsMapping(const std::string &fixture_name)
Opens a fixture of the given file name and returns a mapping to its contents.
static sk_sp< SkData > LoadValidImageFixture()
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
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
static constexpr SkISize Make(int32_t w, int32_t h)
Info about a single frame in the context of a multi-frame image, useful for animation and blending.