MCPcopy Create free account
hub / github.com/assaultcube/AC / writepngchunk

Function writepngchunk

source/src/main.cpp:243–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241VARP(pngcompress, 0, 9, 9);
242
243void writepngchunk(stream *f, const char *type, const void *data = NULL, uint len = 0)
244{
245 f->putbig<uint>(len);
246 f->write(type, 4);
247 if(data) f->write(data, len);
248
249 uint crc = crc32(0, Z_NULL, 0);
250 crc = ~crc32(crc, (const Bytef *)type, 4);
251 if(data) loopi(len) enet_crc32_inc(&crc, ((const uchar *)data)[i]);
252 f->putbig<uint>(~crc);
253}
254
255int save_png(const char *filename, SDL_Surface *image)
256{

Callers 1

save_pngFunction · 0.85

Calls 3

enet_crc32_incFunction · 0.85
loopiFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected