static size_t consumer_put(void* info, const void* buffer, size_t count) { SkWStream* stream = reinterpret_cast<SkWStream*>(info); return stream->write(buffer, count) ? count : 0; }
static void write_png_callback(png_structp png_ptr, png_bytep data, png_size_t length) { SkWStream* out = (SkWStream*) png_get_io_ptr(png_ptr); out->write(data, length); }
static void sk_write_fn(png_structp png_ptr, png_bytep data, png_size_t len) { SkWStream* stream = (SkWStream*)png_get_io_ptr(png_ptr); if (!stream->write(data, len)) { png_error(png_ptr, "sk_write_fn cannot write to stream"); } }