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

Method encodeSKImageToSKData

snap_drawing/src/snap_drawing/cpp/Utils/Image.cpp:112–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110 }
111 }
112}
113
114sk_sp<SkData> Image::encodeSKImageToSKData(SkImage& image, EncodedImageFormat format, int quality) {
115 Image::initializeCodecs();
116 SkBitmap bm;
117 if (!as_IB(&image)->getROPixels(nullptr, &bm)) {
118 return nullptr;
119 }
120
121 SkPixmap pixmap;
122 if (!bm.peekPixels(&pixmap)) {
123 return nullptr;
124 }
125
126 SkDynamicMemoryWStream stream;
127 if (!encodeImage(&stream, pixmap, format, quality)) {
128 return nullptr;
129 }
130 return stream.detachAsData();
131}
132

Callers

nothing calls this directly

Calls 1

encodeImageFunction · 0.85

Tested by

no test coverage detected