formatting: use tabs instead of spaces

This commit is contained in:
Tomáš Szabo 2019-06-21 15:59:32 +02:00
parent ae50136845
commit 42218cd613
No known key found for this signature in database
GPG Key ID: 96F1E84929851783
4 changed files with 51 additions and 51 deletions

View File

@ -519,10 +519,10 @@ vips_foreign_load_gif_scan_extension( VipsForeignLoadGif *gif )
gif->has_transparency = TRUE;
}
if( gif->n_pages % 64 == 0 ) {
gif->delays = (int *) g_realloc( gif->delays, (gif->n_pages + 64) * sizeof(int) );
}
gif->delays[gif->n_pages] = (extension[2] | (extension[3] << 8)) * 10;
if( gif->n_pages % 64 == 0 ) {
gif->delays = (int *) g_realloc( gif->delays, (gif->n_pages + 64) * sizeof(int) );
}
gif->delays[gif->n_pages] = (extension[2] | (extension[3] << 8)) * 10;
while( extension != NULL )
if( vips_foreign_load_gif_ext_next( gif,
@ -574,12 +574,12 @@ vips_foreign_load_gif_set_header( VipsForeignLoadGif *gif, VipsImage *image )
vips_image_set_int( image, VIPS_META_N_PAGES, gif->n_pages );
vips_image_set_int( image, "gif-loop", gif->loop );
if ( gif->delays ) {
vips_image_set_int( image, "gif-delay", VIPS_RINT( gif->delays[0] / 10.0 ) );
vips_image_set_array_int( image, "delay", gif->delays, gif->n_pages );
} else {
vips_image_set_int( image, "gif-delay", 4 );
}
if( gif->delays ) {
vips_image_set_int( image, "gif-delay", VIPS_RINT( gif->delays[0] / 10.0 ) );
vips_image_set_array_int( image, "delay", gif->delays, gif->n_pages );
} else {
vips_image_set_int( image, "gif-delay", 4 );
}
if( gif->comment )
vips_image_set_string( image, "gif-comment", gif->comment );
@ -1121,7 +1121,7 @@ vips_foreign_load_gif_init( VipsForeignLoadGif *gif )
{
gif->n = 1;
gif->transparency = -1;
gif->delays = NULL;
gif->delays = NULL;
gif->loop = 0;
gif->comment = NULL;
gif->dispose = 0;

View File

@ -109,8 +109,8 @@ vips_foreign_save_magick_next_image( VipsForeignSaveMagick *magick )
Image *image;
int number;
int *numbers;
int numbers_length;
int *numbers;
int numbers_length;
const char *str;
g_assert( !magick->current_image );
@ -143,10 +143,10 @@ vips_foreign_save_magick_next_image( VipsForeignSaveMagick *magick )
if( vips_image_get_typeof( im, "delay" ) &&
!vips_image_get_array_int( im, "delay", &numbers, &numbers_length ) ) {
int page_index = magick->position.top / magick->page_height;
if( page_index < numbers_length )
image->delay = (size_t) VIPS_RINT( numbers[page_index] / 10.0 );
}
int page_index = magick->position.top / magick->page_height;
if( page_index < numbers_length )
image->delay = (size_t) VIPS_RINT( numbers[page_index] / 10.0 );
}
/* ImageMagick uses iterations like this (at least in gif save):
* 0 - set 0 loops (infinite)

View File

@ -308,8 +308,8 @@ get_array_int( VipsImage *image, const char *field, int* n )
static int
extract_delay( int index, int *delays, int delays_length, int default_delay )
{
if( delays == NULL || index > delays_length ) return( default_delay );
return( delays[index] );
if( delays == NULL || index > delays_length ) return( default_delay );
return( delays[index] );
}
/* Write a set of animated frames into write->memory_writer.
@ -321,8 +321,8 @@ write_webp_anim( VipsWebPWrite *write, VipsImage *image, int page_height )
* standard).
*/
const int default_delay = 10 * get_int( image, "gif-delay", 10 );
int delays_length;
const int *delays = get_array_int( image, "delay", &delays_length );
int delays_length;
const int *delays = get_array_int( image, "delay", &delays_length );
WebPAnimEncoderOptions anim_config;
WebPData webp_data;
@ -373,18 +373,18 @@ write_webp_anim( VipsWebPWrite *write, VipsImage *image, int page_height )
WebPPictureFree( &pic );
int page_index = top / page_height;
int page_index = top / page_height;
timestamp_ms += extract_delay( page_index, delays, delays_length, default_delay );
}
/* Closes encoder and add last frame delay.
*/
if( !WebPAnimEncoderAdd( write->enc,
NULL, timestamp_ms, NULL ) ) {
vips_error( "vips2webp",
"%s", _( "anim close error" ) );
return( -1 );
}
/* Closes encoder and add last frame delay.
*/
if( !WebPAnimEncoderAdd( write->enc,
NULL, timestamp_ms, NULL ) ) {
vips_error( "vips2webp",
"%s", _( "anim close error" ) );
return( -1 );
}
if( !WebPAnimEncoderAssemble( write->enc, &webp_data ) ) {
vips_error( "vips2webp",

View File

@ -470,32 +470,32 @@ read_header( Read *read, VipsImage *out )
vips_image_set_int( out,
VIPS_META_PAGE_HEIGHT, read->frame_height );
if ( read->frame_count > 1) {
read->delays = (int *) g_malloc( read->frame_count * sizeof(int) );
for( int i = 0; i < read->frame_count; i++ ) {
if( WebPDemuxGetFrame( read->demux, i + 1, &iter ) ) {
read->delays[i] = iter.duration;
} else {
read->delays[i] = 0;
}
}
if ( read->frame_count > 1) {
read->delays = (int *) g_malloc( read->frame_count * sizeof(int) );
for( int i = 0; i < read->frame_count; i++ ) {
if( WebPDemuxGetFrame( read->demux, i + 1, &iter ) ) {
read->delays[i] = iter.duration;
} else {
read->delays[i] = 0;
}
}
#ifdef DEBUG
for( int i = 0; i < read->frame_count; i++ ) {
printf( "webp2vips: frame = %d; duration = %d\n", i + 1, read->delays[i] );
}
for( int i = 0; i < read->frame_count; i++ ) {
printf( "webp2vips: frame = %d; duration = %d\n", i + 1, read->delays[i] );
}
#endif /*DEBUG*/
vips_image_set_array_int( out, "delay", read->delays, read->frame_count );
g_free( read->delays );
vips_image_set_array_int( out, "delay", read->delays, read->frame_count );
g_free( read->delays );
/* webp uses ms for delays, gif uses centiseconds.
*/
vips_image_set_int( out, "gif-delay",
VIPS_RINT( read->delays[0] / 10.0 ) );
}
/* webp uses ms for delays, gif uses centiseconds.
*/
vips_image_set_int( out, "gif-delay",
VIPS_RINT( read->delays[0] / 10.0 ) );
}
WebPDemuxReleaseIterator( &iter );
if( read->n == -1 )