Flutter Engine
The Flutter Engine
Public Types | Static Public Member Functions | List of all members
SkPicturePriv Class Reference

#include <SkPicturePriv.h>

Public Types

enum  Version {
  kPictureShaderFilterParam_Version = 82 , kMatrixImageFilterSampling_Version = 83 , kImageFilterImageSampling_Version = 84 , kNoFilterQualityShaders_Version = 85 ,
  kVerticesRemoveCustomData_Version = 86 , kSkBlenderInSkPaint = 87 , kBlenderInEffects = 88 , kNoExpandingClipOps = 89 ,
  kBackdropScaleFactor = 90 , kRawImageShaders = 91 , kAnisotropicFilter = 92 , kBlend4fColorFilter = 93 ,
  kNoShaderLocalMatrix = 94 , kShaderImageFilterSerializeShader = 95 , kRevampMagnifierFilter = 96 , kRuntimeImageFilterSampleRadius = 97 ,
  kCombineBlendArithmeticFilters = 98 , kRemoveLegacyMagnifierFilter = 99 , kDropShadowImageFilterComposition = 100 , kCropImageFilterSupportsTiling = 101 ,
  kConvolutionImageFilterTilingUpdate = 102 , kRemoveDeprecatedCropRect = 103 , kMultipleFiltersOnSaveLayer = 104 , kMin_Version = kPictureShaderFilterParam_Version ,
  kCurrent_Version = kMultipleFiltersOnSaveLayer
}
 

Static Public Member Functions

static sk_sp< SkPictureMakeFromBuffer (SkReadBuffer &buffer)
 
static void Flatten (const sk_sp< const SkPicture >, SkWriteBuffer &buffer)
 
static const SkBigPictureAsSkBigPicture (const sk_sp< const SkPicture > &picture)
 
static uint64_t MakeSharedID (uint32_t pictureID)
 
static void AddedToCache (const SkPicture *pic)
 

Detailed Description

Definition at line 18 of file SkPicturePriv.h.

Member Enumeration Documentation

◆ Version

Enumerator
kPictureShaderFilterParam_Version 
kMatrixImageFilterSampling_Version 
kImageFilterImageSampling_Version 
kNoFilterQualityShaders_Version 
kVerticesRemoveCustomData_Version 
kSkBlenderInSkPaint 
kBlenderInEffects 
kNoExpandingClipOps 
kBackdropScaleFactor 
kRawImageShaders 
kAnisotropicFilter 
kBlend4fColorFilter 
kNoShaderLocalMatrix 
kShaderImageFilterSerializeShader 
kRevampMagnifierFilter 
kRuntimeImageFilterSampleRadius 
kCombineBlendArithmeticFilters 
kRemoveLegacyMagnifierFilter 
kDropShadowImageFilterComposition 
kCropImageFilterSupportsTiling 
kConvolutionImageFilterTilingUpdate 
kRemoveDeprecatedCropRect 
kMultipleFiltersOnSaveLayer 
kMin_Version 
kCurrent_Version 

Definition at line 119 of file SkPicturePriv.h.

119 {
129 kRawImageShaders = 91,
143
144 // Only SKPs within the min/current picture version range (inclusive) can be read.
145 //
146 // When updating kMin_Version also update oldestSupportedSkpVersion in
147 // infra/bots/gen_tasks_logic/gen_tasks_logic.go
148 //
149 // Steps on how to find which oldestSupportedSkpVersion to use:
150 // 1) Find the git hash when the desired kMin_Version was the kCurrent_Version from the
151 // git logs: https://skia.googlesource.com/skia/+log/main/src/core/SkPicturePriv.h
152 // Eg: https://skia.googlesource.com/skia/+/bfd330d081952424a93d51715653e4d1314d4822%5E%21/#F1
153 //
154 // 2) Use that git hash to find the SKP asset version number at that time here:
155 // https://skia.googlesource.com/skia/+/bfd330d081952424a93d51715653e4d1314d4822/infra/bots/assets/skp/VERSION
156 //
157 // 3) [Optional] Increment the SKP asset version number from step 3 and verify that it has
158 // the expected version number by downloading the asset and running skpinfo on it.
159 //
160 // 4) Use the incremented SKP asset version number as the oldestSupportedSkpVersion in
161 // infra/bots/gen_tasks_logic/gen_tasks_logic.go
162 //
163 // 5) Run `make -C infra/bots train`
164 //
165 // Contact the Infra Gardener if the above steps do not work for you.
168 };
@ kDropShadowImageFilterComposition
@ kCropImageFilterSupportsTiling
@ kVerticesRemoveCustomData_Version
@ kRuntimeImageFilterSampleRadius
@ kPictureShaderFilterParam_Version
@ kConvolutionImageFilterTilingUpdate
@ kImageFilterImageSampling_Version
@ kShaderImageFilterSerializeShader
@ kNoFilterQualityShaders_Version
@ kMultipleFiltersOnSaveLayer
@ kRemoveLegacyMagnifierFilter
@ kCombineBlendArithmeticFilters
@ kMatrixImageFilterSampling_Version

Member Function Documentation

◆ AddedToCache()

static void SkPicturePriv::AddedToCache ( const SkPicture pic)
inlinestatic

Definition at line 45 of file SkPicturePriv.h.

45 {
46 pic->fAddedToCache.store(true);
47 }

◆ AsSkBigPicture()

static const SkBigPicture * SkPicturePriv::AsSkBigPicture ( const sk_sp< const SkPicture > &  picture)
inlinestatic

Definition at line 36 of file SkPicturePriv.h.

36 {
37 return picture->asSkBigPicture();
38 }
virtual const class SkBigPicture * asSkBigPicture() const
Definition: SkPicture.h:277
sk_sp< const SkPicture > picture
Definition: SkRecords.h:299

◆ Flatten()

void SkPicturePriv::Flatten ( const sk_sp< const SkPicture picture,
SkWriteBuffer buffer 
)
static

Serialize to a buffer.

Definition at line 314 of file SkPicture.cpp.

314 {
315 SkPictInfo info = picture->createHeader();
316 std::unique_ptr<SkPictureData> data(picture->backport());
317
318 buffer.writeByteArray(&info.fMagic, sizeof(info.fMagic));
319 buffer.writeUInt(info.getVersion());
320 buffer.writeRect(info.fCullRect);
321
322 if (auto custom = custom_serialize(picture.get(), buffer.serialProcs())) {
323 int32_t size = SkToS32(custom->size());
324 buffer.write32(-size); // negative for custom format
325 buffer.writePad32(custom->data(), size);
326 return;
327 }
328
329 if (data) {
330 buffer.write32(1); // special size meaning SkPictureData
331 data->flatten(buffer);
332 } else {
333 buffer.write32(0); // signal no content
334 }
335}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static sk_sp< SkData > custom_serialize(const SkPicture *picture, const SkSerialProcs &procs)
Definition: SkPicture.cpp:255
constexpr int32_t SkToS32(S x)
Definition: SkTo.h:25
T * get() const
Definition: SkRefCnt.h:303
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
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
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ MakeFromBuffer()

sk_sp< SkPicture > SkPicturePriv::MakeFromBuffer ( SkReadBuffer buffer)
static

Recreate a picture that was serialized into a buffer. If the creation requires bitmap decoding, the decoder must be set on the SkReadBuffer parameter by calling SkReadBuffer::setBitmapDecoder() before calling SkPicture::MakeFromBuffer().

Parameters
bufferSerialized picture data.
Returns
A new SkPicture representing the serialized data, or NULL if the buffer is invalid.

Definition at line 213 of file SkPicture.cpp.

213 {
215 if (!SkPicture::BufferIsSKP(&buffer, &info)) {
216 return nullptr;
217 }
218 // size should be 0, 1, or negative
219 int32_t ssize = buffer.read32();
220 if (ssize < 0) {
221 const SkDeserialProcs& procs = buffer.getDeserialProcs();
222 if (!procs.fPictureProc) {
223 return nullptr;
224 }
225 size_t size = sk_negate_to_size_t(ssize);
226 return procs.fPictureProc(buffer.skip(size), size, procs.fPictureCtx);
227 }
228 if (ssize != 1) {
229 // 1 is the magic 'size' that means SkPictureData follows
230 return nullptr;
231 }
232 std::unique_ptr<SkPictureData> data(SkPictureData::CreateFromBuffer(buffer, info));
233 return SkPicture::Forwardport(info, data.get(), &buffer);
234}
static size_t sk_negate_to_size_t(int32_t value)
Definition: SkMathPriv.h:76
static SkPictureData * CreateFromBuffer(SkReadBuffer &, const SkPictInfo &)
SkDeserialPictureProc fPictureProc
Definition: SkSerialProcs.h:98

◆ MakeSharedID()

static uint64_t SkPicturePriv::MakeSharedID ( uint32_t  pictureID)
inlinestatic

Definition at line 40 of file SkPicturePriv.h.

40 {
41 uint64_t sharedID = SkSetFourByteTag('p', 'i', 'c', 't');
42 return (sharedID << 32) | pictureID;
43 }
static constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d)
Definition: SkTypes.h:167

The documentation for this class was generated from the following files: