Merge branch '8.8'

This commit is contained in:
John Cupitt 2019-08-09 10:12:55 +01:00
commit cdee0feb93
6 changed files with 80776 additions and 17060 deletions

View File

@ -17,6 +17,7 @@
- better support for PNGs with long comment names
- fix build with GM
- add locks for pdfium load
- fix build with MSVC
24/5/19 started 8.8.1
- improve realpath() use on older libc

View File

@ -58,58 +58,19 @@ typedef VipsOperationClass VipsProfileLoadClass;
G_DEFINE_TYPE( VipsProfileLoad, vips_profile_load, VIPS_TYPE_OPERATION );
/* Created on first use from a base64 string in profiles.c.
*/
typedef struct _VipsFallbackProfile {
const char *name;
void *data;
size_t data_length;
} VipsFallbackProfile;
static GSList *vips_fallback_profile_list = NULL;
static void *
vips_fallback_profile_get_init( void )
static const void *
vips_profile_fallback_get( const char *name, size_t *length )
{
int i;
VipsProfileFallback *fallback;
for( i = 0; vips__coded_profiles[i].name; i++ ) {
size_t data_length;
unsigned char *data;
VipsFallbackProfile *fallback;
if( !(data = vips__b64_decode(
vips__coded_profiles[i].data, &data_length )) )
return( NULL );
fallback = g_new( VipsFallbackProfile,1 );
fallback->name = vips__coded_profiles[i].name;
fallback->data = data;
fallback->data_length = data_length;
vips_fallback_profile_list = g_slist_prepend(
vips_fallback_profile_list, fallback );
}
return( NULL );
}
static void *
vips_fallback_profile_get( const char *name, size_t *length )
{
static GOnce once = G_ONCE_INIT;
GSList *p;
VIPS_ONCE( &once, (GThreadFunc) vips_fallback_profile_get_init, NULL );
for( p = vips_fallback_profile_list; p; p = p->next ) {
VipsFallbackProfile *fallback = (VipsFallbackProfile *) p->data;
for( i = 0; (fallback = vips__profile_fallback_table[i]); i++ )
if( g_ascii_strcasecmp( fallback->name, name ) == 0 ) {
*length = fallback->data_length;
if( length )
*length = fallback->length;
return( fallback->data );
}
}
return( NULL );
}
@ -131,7 +92,7 @@ vips_profile_load_build( VipsObject *object )
if( g_ascii_strcasecmp( load->name, "none" ) == 0 ) {
profile = NULL;
}
else if( (data = vips_fallback_profile_get( load->name, &length )) ) {
else if( (data = vips_profile_fallback_get( load->name, &length )) ) {
profile = vips_blob_new( NULL, data, length );
}
else if( (data = vips__file_read_name( load->name,

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,13 @@
/* The fallback profiles, coded as a set of base64 strings, see
* wrap-profiles.sh
/* The fallback profiles, coded as a set of uchar arrays, see wrap-profiles.sh
*/
typedef struct _VipsCodedProfile {
#include <stddef.h>
typedef struct _VipsProfileFallback {
const char *name;
const char *data;
} VipsCodedProfile;
size_t length;
const unsigned char data[];
} VipsProfileFallback;
extern VipsCodedProfile vips__coded_profiles[];
extern VipsProfileFallback *vips__profile_fallback_table[];

View File

@ -1,22 +1,38 @@
#!/bin/bash
# code up the binary files in $1 as a set of name / base64-encoded strings
# code up the binary files in $1 as a set of name / string pairs
# in $2
# we have to use arrays for the strings, since MSVC won't allow string
# literals larger than 64kb
in=$1
out=$2
echo "/* coded files, generated automatically */" > $out
echo "/* this file generated automatically, do not edit */" > $out
echo "" >> $out
echo "#include \"profiles.h\"" >> $out
echo "" >> $out
echo "VipsCodedProfile vips__coded_profiles[] = {" >> $out
profile_names=
for file in $in/*; do
root=${file%.icm}
base=${root##*/}
echo " { \"$base\"," >> $out
base64 $file | sed 's/\(.*\)/"\1"/g' >> $out
echo " }," >> $out
profile_name=vips__profile_fallback_$base
profile_names="$profile_names $profile_name"
echo "static VipsProfileFallback $profile_name = {" >> $out
echo " \"$base\"," >> $out
echo " $(stat --format=%s $file)," >> $out
echo " {" >> $out
hexdump -v -e '" 0x" 1/1 "%02X,"' $file | fmt >> $out
echo " }" >> $out
echo "};" >> $out
echo >> $out
done
echo " { 0, 0 }" >> $out
echo "VipsProfileFallback *vips__profile_fallback_table[] = {" >> $out
for profile_name in $profile_names; do
echo " &$profile_name," >> $out
done
echo " NULL" >> $out
echo "};" >> $out

View File

@ -471,7 +471,9 @@ class TestForeign:
def test_webp(self):
def webp_valid(im):
a = im(10, 10)
assert_almost_equal_objects(a, [70, 165, 235])
# different webp versions use different rounding systems leading
# to small variations
assert_almost_equal_objects(a, [71, 166, 236], threshold=2)
assert im.width == 550
assert im.height == 368
assert im.bands == 3