MCPcopy Create free account
hub / github.com/Tencent/libpag / LoadDataFromAsset

Function LoadDataFromAsset

src/platform/ohos/JsHelper.cpp:496–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

494}
495
496std::shared_ptr<ByteData> LoadDataFromAsset(NativeResourceManager* mNativeResMgr, char* srcBuf) {
497 RawFile* rawFile = OH_ResourceManager_OpenRawFile(mNativeResMgr, srcBuf);
498 if (rawFile == NULL) {
499 return nullptr;
500 }
501 long len = OH_ResourceManager_GetRawFileSize(rawFile);
502 auto data = ByteData::Make(len);
503 if (!data) {
504 OH_ResourceManager_CloseRawFile(rawFile);
505 return nullptr;
506 }
507 OH_ResourceManager_ReadRawFile(rawFile, data->data(), len);
508 OH_ResourceManager_CloseRawFile(rawFile);
509 return data;
510}
511
512} // namespace pag

Callers 3

LoadFromAssetsFunction · 0.85
LoadFromAssetsFunction · 0.85
RegisterFontFromAssetFunction · 0.85

Calls 2

MakeFunction · 0.70
dataMethod · 0.45

Tested by

no test coverage detected