static void optimistic_palette_callback(unsigned num,rgba *pixels) { unsigned prev_size = paletteSize ; if( !palettify_row(pixels,num) || paletteSize != prev_size ) FatalUnexpected("Oops! Somehow the precomputed palette does not suffice " "after all..."); raw_callback(num,pixels); }
int palettify_rows (rgba *rows[],unsigned ncols,unsigned nlines) { unsigned i ; for( i=0; i<nlines; i++ ) { if( !palettify_row(rows[i],ncols) ) { while( i-- ) unpalettify_row(rows[i],ncols); return 0 ; } } return 1 ; }