| 166 | } |
| 167 | |
| 168 | void ImageSourcePng::load( ImageTargetRef target ) |
| 169 | { |
| 170 | bool success = true; |
| 171 | if( setjmp( png_jmpbuf(mPngPtr) ) ) { |
| 172 | png_destroy_read_struct( &mPngPtr, &mInfoPtr, (png_infopp)NULL ); |
| 173 | mPngPtr = 0; |
| 174 | success = false; |
| 175 | } |
| 176 | else { |
| 177 | // get a pointer to the ImageSource function appropriate for handling our data configuration |
| 178 | ImageSource::RowFunc func = setupRowFunc( target ); |
| 179 | //int number_passes = png_set_interlace_handling( mPngPtr ); |
| 180 | unique_ptr<png_byte[]> row_pointer( new png_byte[png_get_rowbytes( mPngPtr, mInfoPtr )] ); |
| 181 | for( int32_t row = 0; row < mHeight; ++row ) { |
| 182 | png_read_row( mPngPtr, row_pointer.get(), NULL ); |
| 183 | ((*this).*func)( target, row, row_pointer.get() ); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | if( ! success ) |
| 188 | throw ImageSourcePngException( "Failure during load." ); |
| 189 | } |
| 190 | |
| 191 | } // namespace cinder |
nothing calls this directly
no test coverage detected