Flutter Engine
The Flutter Engine
Functions
SkPictureData.cpp File Reference
#include "src/core/SkPictureData.h"
#include "include/core/SkFlattenable.h"
#include "include/core/SkFontMgr.h"
#include "include/core/SkSerialProcs.h"
#include "include/core/SkStream.h"
#include "include/core/SkString.h"
#include "include/core/SkTypeface.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkTFitsIn.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/base/SkTo.h"
#include "src/base/SkAutoMalloc.h"
#include "src/core/SkPicturePriv.h"
#include "src/core/SkPictureRecord.h"
#include "src/core/SkPtrRecorder.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkStreamPriv.h"
#include "src/core/SkTHash.h"
#include "src/core/SkTextBlobPriv.h"
#include "src/core/SkVerticesPriv.h"
#include "src/core/SkWriteBuffer.h"
#include <cstring>
#include <utility>

Go to the source code of this file.

Functions

template<typename T >
int SafeCount (const T *obj)
 
static size_t compute_chunk_size (SkFlattenable::Factory *array, int count)
 
static void write_tag_size (SkWriteBuffer &buffer, uint32_t tag, size_t size)
 
static void write_tag_size (SkWStream *stream, uint32_t tag, size_t size)
 
static SkSerialProcs skip_typeface_proc (const SkSerialProcs &procs)
 
static sk_sp< SkImagecreate_image_from_buffer (SkReadBuffer &buffer)
 
static sk_sp< SkDrawablecreate_drawable_from_buffer (SkReadBuffer &buffer)
 
template<typename T , typename U >
bool new_array_from_buffer (SkReadBuffer &buffer, uint32_t inCount, TArray< sk_sp< T > > &array, sk_sp< U >(*factory)(SkReadBuffer &))
 

Function Documentation

◆ compute_chunk_size()

static size_t compute_chunk_size ( SkFlattenable::Factory array,
int  count 
)
static

Definition at line 77 of file SkPictureData.cpp.

77 {
78 size_t size = 4; // for 'count'
79
80 for (int i = 0; i < count; i++) {
81 const char* name = SkFlattenable::FactoryToName(array[i]);
82 if (nullptr == name || 0 == *name) {
84 } else {
85 size_t len = strlen(name);
87 size += len;
88 }
89 }
90
91 return size;
92}
int count
Definition: FontMgrTest.cpp:50
static const char * FactoryToName(Factory)
static int SizeOfPackedUInt(size_t value)
Definition: SkStream.cpp:113
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
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

◆ create_drawable_from_buffer()

static sk_sp< SkDrawable > create_drawable_from_buffer ( SkReadBuffer buffer)
static

Definition at line 423 of file SkPictureData.cpp.

423 {
425}
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
Definition: switches.h:126

◆ create_image_from_buffer()

static sk_sp< SkImage > create_image_from_buffer ( SkReadBuffer buffer)
static

Definition at line 419 of file SkPictureData.cpp.

419 {
420 return buffer.readImage();
421}

◆ new_array_from_buffer()

template<typename T , typename U >
bool new_array_from_buffer ( SkReadBuffer buffer,
uint32_t  inCount,
TArray< sk_sp< T > > &  array,
sk_sp< U >(*)(SkReadBuffer &)  factory 
)

Definition at line 429 of file SkPictureData.cpp.

430 {
431 if (!buffer.validate(array.empty() && SkTFitsIn<int>(inCount))) {
432 return false;
433 }
434 if (0 == inCount) {
435 return true;
436 }
437
438 for (uint32_t i = 0; i < inCount; ++i) {
439 auto obj = factory(buffer);
440
441 if (!buffer.validate(obj != nullptr)) {
442 array.clear();
443 return false;
444 }
445
446 array.push_back(std::move(obj));
447 }
448
449 return true;
450}
bool empty() const
Definition: SkTArray.h:199

◆ SafeCount()

template<typename T >
int SafeCount ( const T obj)

Definition at line 36 of file SkPictureData.cpp.

36 {
37 return obj ? obj->size() : 0;
38}

◆ skip_typeface_proc()

static SkSerialProcs skip_typeface_proc ( const SkSerialProcs procs)
static

Definition at line 215 of file SkPictureData.cpp.

215 {
216 SkSerialProcs newProcs = procs;
217 newProcs.fTypefaceProc = nullptr;
218 newProcs.fTypefaceCtx = nullptr;
219 return newProcs;
220}
void * fTypefaceCtx
Definition: SkSerialProcs.h:94
SkSerialTypefaceProc fTypefaceProc
Definition: SkSerialProcs.h:93

◆ write_tag_size() [1/2]

static void write_tag_size ( SkWriteBuffer buffer,
uint32_t  tag,
size_t  size 
)
static

Definition at line 94 of file SkPictureData.cpp.

94 {
95 buffer.writeUInt(tag);
96 buffer.writeUInt(SkToU32(size));
97}
constexpr uint32_t SkToU32(S x)
Definition: SkTo.h:26

◆ write_tag_size() [2/2]

static void write_tag_size ( SkWStream stream,
uint32_t  tag,
size_t  size 
)
static

Definition at line 99 of file SkPictureData.cpp.

99 {
100 stream->write32(tag);
101 stream->write32(SkToU32(size));
102}