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

Method loadImage

valdi/test/snap_drawing/ImageLoader_tests.cpp:51–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 }
50
51 Result<Valdi::Ref<Image>> loadImage(const StringBox& url,
52 int32_t width,
53 int32_t height,
54 const Valdi::Value filter = Valdi::Value()) {
55 auto payload = _assetLoader->requestPayloadFromURL(url);
56
57 auto completionHandler = makeShared<BlockingAssetCompletionHandler>().toShared();
58
59 _assetLoader->loadAsset(payload.value(), width, height, filter, completionHandler);
60
61 auto retvalResult = completionHandler->getResult();
62 if (!retvalResult) {
63 return retvalResult.error();
64 } else {
65 auto retval = retvalResult.moveValue();
66 return castOrNull<Image>(retval);
67 }
68 }
69
70 void TearDown() override {
71 _queue->fullTeardown();

Callers

nothing calls this directly

Calls 7

toSharedMethod · 0.80
getResultMethod · 0.80
valueMethod · 0.65
errorMethod · 0.65
ValueInterface · 0.50
requestPayloadFromURLMethod · 0.45
loadAssetMethod · 0.45

Tested by

no test coverage detected