MCPcopy Create free account
hub / github.com/Snapchat/Valdi / load

Method load

valdi/src/valdi/snap_drawing/Graphics/ShaderCache.cpp:123–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123sk_sp<SkData> ShaderCache::load(const SkData& key) {
124 auto keyByteViewUnowned = Valdi::BytesView(nullptr, static_cast<const Byte*>(key.data()), key.size());
125 auto loadResult = loadShaderFromDisk(keyByteViewUnowned);
126 if (loadResult.failure()) {
127 return nullptr;
128 } else {
129 auto result = loadResult.moveValue();
130 // TODO(rjaber): Data copy is temporary; Skia expects the returned SkData pointer to be 4 bytes aligned. By
131 // doing the copy, we rely on SkData being correctly aligned on creation.
132 return snap::drawing::skDataFromBytes(result, snap::drawing::DataConversionModeAlwaysCopy);
133 }
134}
135
136} // namespace snap::drawing

Callers

nothing calls this directly

Calls 5

skDataFromBytesFunction · 0.85
BytesViewClass · 0.50
dataMethod · 0.45
sizeMethod · 0.45
failureMethod · 0.45

Tested by

no test coverage detected