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

Method make

snap_drawing/src/snap_drawing/cpp/Utils/Bitmap.cpp:31–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31Valdi::Result<Ref<Bitmap>> Bitmap::make(const Valdi::BitmapInfo& info) {
32 SkBitmap skBitmap;
33 auto imageInfo = toSkiaImageInfo(info);
34 if (!skBitmap.tryAllocPixels(imageInfo, std::max(info.rowBytes, imageInfo.minRowBytes()))) {
35 return Valdi::Error("Failed to allocate pixels for bitmap");
36 }
37
38 return Valdi::makeShared<Bitmap>(std::move(skBitmap));
39}
40
41} // namespace snap::drawing

Callers

nothing calls this directly

Calls 3

toSkiaImageInfoFunction · 0.85
maxFunction · 0.85
ErrorInterface · 0.50

Tested by

no test coverage detected