small changes to the gif-loop fix

see https://github.com/libvips/libvips/pull/1362
This commit is contained in:
John Cupitt 2019-12-18 18:09:30 +00:00
parent 501fc38130
commit 4616cf1f5c
5 changed files with 26 additions and 9 deletions

View File

@ -1,9 +1,23 @@
# http://editorconfig.org
root = true
[*]
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true
[*.{cpp,c,h}]
indent_style = tab
indent_size = 8
[*.py]
indent_style = space
indent_size = 4
[Makefile.am]
indent_style = tab
indent_size = 8
[configure.ac]
indent_style = space
indent_size = 2

View File

@ -574,8 +574,8 @@ vips_foreign_load_gif_scan_application_ext( VipsForeignLoadGif *gif,
extension[0] == 3 &&
extension[1] == 1 ) {
gif->loop = extension[2] | (extension[3] << 8);
if (gif->loop != 0)
gif->loop = gif->loop + 1;
if( gif->loop != 0 )
gif->loop += 1;
}
}

View File

@ -170,12 +170,13 @@ vips_foreign_save_magick_next_image( VipsForeignSaveMagick *magick )
*/
if( vips_image_get_typeof( im, "loop" ) &&
!vips_image_get_int( im, "loop", &number ) ) {
image->iterations = (size_t) (number ? number : 0);
image->iterations = (size_t) number;
}
else {
/* DEPRECATED "gif-loop"
*
* We have the simple gif meaning, so we must add one unless it's zero.
* We have the simple gif meaning, so we must add one unless
* it's zero.
*/
if( vips_image_get_typeof( im, "gif-loop" ) &&
!vips_image_get_int( im, "gif-loop", &number ) )

View File

@ -439,7 +439,8 @@ read_header( Read *read, VipsImage *out )
* Not the correct behavior as loop=1 became gif-loop=0
* but we want to keep the old behavior untouched!
*/
vips_image_set_int( out, "gif-loop", loop_count == 0 ? 0 : loop_count - 1 );
vips_image_set_int( out, "gif-loop",
loop_count == 0 ? 0 : loop_count - 1 );
vips_image_set_int( out,
VIPS_META_PAGE_HEIGHT, read->frame_height );

View File

@ -1239,7 +1239,8 @@ vips_image_remove( VipsImage *image, const char *name )
*/
static const char *vips_image_header_deprecated[] = {
"ipct-data",
"gif-delay"
"gif-delay",
"gif-loop"
};
static void *