Lines Matching full:readptr
80 static void readDataFromStream(png_structp readPtr, png_bytep data, png_size_t length) {
81 std::istream* input = reinterpret_cast<std::istream*>(png_get_io_ptr(readPtr));
83 png_error(readPtr, strerror(errno));
96 static void logWarning(png_structp readPtr, png_const_charp warningMessage) {
97 IDiagnostics* diag = reinterpret_cast<IDiagnostics*>(png_get_error_ptr(readPtr));
102 static bool readPng(IDiagnostics* diag, png_structp readPtr, png_infop infoPtr, PngInfo* outInfo) {
103 if (setjmp(png_jmpbuf(readPtr))) {
108 png_set_sig_bytes(readPtr, kPngSignatureSize);
109 png_read_info(readPtr, infoPtr);
112 png_get_IHDR(readPtr, infoPtr, &outInfo->width, &outInfo->height, &bitDepth, &colorType,
116 png_set_palette_to_rgb(readPtr);
120 png_set_expand_gray_1_2_4_to_8(readPtr);
123 if (png_get_valid(readPtr, infoPtr, PNG_INFO_tRNS)) {
124 png_set_tRNS_to_alpha(readPtr);
128 png_set_strip_16(readPtr);
132 png_set_add_alpha(readPtr, 0xFF, PNG_FILLER_AFTER);
136 png_set_gray_to_rgb(readPtr);
139 png_set_interlace_handling(readPtr);
140 png_read_update_info(readPtr, infoPtr);
142 const uint32_t rowBytes = png_get_rowbytes(readPtr, infoPtr);
148 png_read_image(readPtr, outInfo->rows.data());
149 png_read_end(readPtr, infoPtr);
1210 png_structp readPtr = nullptr;
1216 readPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, nullptr, nullptr);
1217 if (!readPtr) {
1222 infoPtr = png_create_info_struct(readPtr);
1228 png_set_error_fn(readPtr, reinterpret_cast<png_voidp>(mDiag), nullptr, logWarning);
1231 png_set_read_fn(readPtr, (png_voidp) input, readDataFromStream);
1233 if (!readPng(mDiag, readPtr, infoPtr, &pngInfo)) {
1268 if (readPtr) {
1269 png_destroy_read_struct(&readPtr, &infoPtr, nullptr);