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

Function EncodeImageData

exporter/src/utils/ImageData.cpp:164–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164pag::ByteData* EncodeImageData(uint8_t* rgbaBytes, int width, int height, int rowBytes,
165 int quality) {
166
167 pag::ByteData* bitmapBytes = nullptr;
168 uint8_t* output = nullptr;
169 auto size = WebPEncodeRGBA(rgbaBytes, width, height, rowBytes, quality, &output);
170 if (size > 0 && output != nullptr) {
171 auto bytes = new uint8_t[size];
172 memcpy(bytes, output, size);
173 bitmapBytes = pag::ByteData::MakeAdopted(bytes, size).release();
174 }
175 WebPFree(output);
176
177 return bitmapBytes;
178}
179
180void GetOpaqueRect(int& left, int& top, int& right, int& bottom, const uint8_t* data, int width,
181 int height, int stride) {

Callers 2

GetBitmapSequenceFunction · 0.85
GetImageBytesFunction · 0.85

Calls 2

memcpyFunction · 0.85
releaseMethod · 0.45

Tested by

no test coverage detected