Merge branch '8.8'
This commit is contained in:
commit
cdee0feb93
@ -17,6 +17,7 @@
|
|||||||
- better support for PNGs with long comment names
|
- better support for PNGs with long comment names
|
||||||
- fix build with GM
|
- fix build with GM
|
||||||
- add locks for pdfium load
|
- add locks for pdfium load
|
||||||
|
- fix build with MSVC
|
||||||
|
|
||||||
24/5/19 started 8.8.1
|
24/5/19 started 8.8.1
|
||||||
- improve realpath() use on older libc
|
- improve realpath() use on older libc
|
||||||
|
@ -58,58 +58,19 @@ typedef VipsOperationClass VipsProfileLoadClass;
|
|||||||
|
|
||||||
G_DEFINE_TYPE( VipsProfileLoad, vips_profile_load, VIPS_TYPE_OPERATION );
|
G_DEFINE_TYPE( VipsProfileLoad, vips_profile_load, VIPS_TYPE_OPERATION );
|
||||||
|
|
||||||
/* Created on first use from a base64 string in profiles.c.
|
static const void *
|
||||||
*/
|
vips_profile_fallback_get( const char *name, size_t *length )
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
VipsProfileFallback *fallback;
|
||||||
|
|
||||||
for( i = 0; vips__coded_profiles[i].name; i++ ) {
|
for( i = 0; (fallback = vips__profile_fallback_table[i]); 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;
|
|
||||||
|
|
||||||
if( g_ascii_strcasecmp( fallback->name, name ) == 0 ) {
|
if( g_ascii_strcasecmp( fallback->name, name ) == 0 ) {
|
||||||
*length = fallback->data_length;
|
if( length )
|
||||||
|
*length = fallback->length;
|
||||||
|
|
||||||
return( fallback->data );
|
return( fallback->data );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
@ -131,7 +92,7 @@ vips_profile_load_build( VipsObject *object )
|
|||||||
if( g_ascii_strcasecmp( load->name, "none" ) == 0 ) {
|
if( g_ascii_strcasecmp( load->name, "none" ) == 0 ) {
|
||||||
profile = NULL;
|
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 );
|
profile = vips_blob_new( NULL, data, length );
|
||||||
}
|
}
|
||||||
else if( (data = vips__file_read_name( load->name,
|
else if( (data = vips__file_read_name( load->name,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,13 @@
|
|||||||
/* The fallback profiles, coded as a set of base64 strings, see
|
/* The fallback profiles, coded as a set of uchar arrays, see wrap-profiles.sh
|
||||||
* wrap-profiles.sh
|
|
||||||
*/
|
*/
|
||||||
typedef struct _VipsCodedProfile {
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
typedef struct _VipsProfileFallback {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *data;
|
size_t length;
|
||||||
} VipsCodedProfile;
|
const unsigned char data[];
|
||||||
|
} VipsProfileFallback;
|
||||||
|
|
||||||
extern VipsCodedProfile vips__coded_profiles[];
|
extern VipsProfileFallback *vips__profile_fallback_table[];
|
||||||
|
|
||||||
|
@ -1,22 +1,38 @@
|
|||||||
#!/bin/bash
|
#!/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
|
# in $2
|
||||||
|
|
||||||
|
# we have to use arrays for the strings, since MSVC won't allow string
|
||||||
|
# literals larger than 64kb
|
||||||
|
|
||||||
in=$1
|
in=$1
|
||||||
out=$2
|
out=$2
|
||||||
|
|
||||||
echo "/* coded files, generated automatically */" > $out
|
echo "/* this file generated automatically, do not edit */" > $out
|
||||||
echo "" >> $out
|
echo "" >> $out
|
||||||
echo "#include \"profiles.h\"" >> $out
|
echo "#include \"profiles.h\"" >> $out
|
||||||
echo "" >> $out
|
echo "" >> $out
|
||||||
echo "VipsCodedProfile vips__coded_profiles[] = {" >> $out
|
|
||||||
|
profile_names=
|
||||||
for file in $in/*; do
|
for file in $in/*; do
|
||||||
root=${file%.icm}
|
root=${file%.icm}
|
||||||
base=${root##*/}
|
base=${root##*/}
|
||||||
echo " { \"$base\"," >> $out
|
profile_name=vips__profile_fallback_$base
|
||||||
base64 $file | sed 's/\(.*\)/"\1"/g' >> $out
|
profile_names="$profile_names $profile_name"
|
||||||
echo " }," >> $out
|
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
|
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
|
echo "};" >> $out
|
||||||
|
@ -471,7 +471,9 @@ class TestForeign:
|
|||||||
def test_webp(self):
|
def test_webp(self):
|
||||||
def webp_valid(im):
|
def webp_valid(im):
|
||||||
a = im(10, 10)
|
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.width == 550
|
||||||
assert im.height == 368
|
assert im.height == 368
|
||||||
assert im.bands == 3
|
assert im.bands == 3
|
||||||
|
Loading…
Reference in New Issue
Block a user