Flutter Engine
The Flutter Engine
Functions
CodecPriv.h File Reference
#include "include/codec/SkCodec.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkData.h"
#include "include/core/SkStream.h"
#include "include/encode/SkPngEncoder.h"
#include "src/utils/SkOSPath.h"
#include "tools/flags/CommandLineFlags.h"

Go to the source code of this file.

Functions

static DEFINE_string (codecWritePath, "", "Dump image decodes from codec unit tests here.")
 
bool decode_memory (const void *mem, size_t size, SkBitmap *bm)
 
void write_bm (const char *name, const SkBitmap &bm)
 

Function Documentation

◆ decode_memory()

bool decode_memory ( const void *  mem,
size_t  size,
SkBitmap bm 
)
inline

Definition at line 21 of file CodecPriv.h.

21 {
22 std::unique_ptr<SkCodec> codec(SkCodec::MakeFromData(SkData::MakeWithoutCopy(mem, size)));
23 if (!codec) {
24 return false;
25 }
26
27 bm->allocPixels(codec->getInfo());
28 const SkCodec::Result result = codec->getPixels(codec->getInfo(), bm->getPixels(),
29 bm->rowBytes());
31}
void allocPixels(const SkImageInfo &info, size_t rowBytes)
Definition: SkBitmap.cpp:258
size_t rowBytes() const
Definition: SkBitmap.h:238
void * getPixels() const
Definition: SkBitmap.h:283
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
Definition: SkCodec.cpp:241
Result
Definition: SkCodec.h:76
@ kIncompleteInput
Definition: SkCodec.h:84
@ kSuccess
Definition: SkCodec.h:80
static sk_sp< SkData > MakeWithoutCopy(const void *data, size_t length)
Definition: SkData.h:116
GAsyncResult * result
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
Definition: switches.h:259

◆ DEFINE_string()

static DEFINE_string ( codecWritePath  ,
""  ,
"Dump image decodes from codec unit tests here."   
)
static

◆ write_bm()

void write_bm ( const char *  name,
const SkBitmap bm 
)
inline

Definition at line 33 of file CodecPriv.h.

33 {
34 if (FLAGS_codecWritePath.isEmpty()) {
35 return;
36 }
37
38 SkString filename = SkOSPath::Join(FLAGS_codecWritePath[0], name);
39 filename.appendf(".png");
40 SkFILEWStream file(filename.c_str());
41 if (!SkPngEncoder::Encode(&file, bm.pixmap(), {})) {
42 SkDebugf("failed to write '%s'\n", filename.c_str());
43 }
44}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
const SkPixmap & pixmap() const
Definition: SkBitmap.h:133
static SkString Join(const char *rootPath, const char *relativePath)
Definition: SkOSPath.cpp:14
const char * c_str() const
Definition: SkString.h:133
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:550
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32