Skip to content

Commit 079bd7b

Browse files
committed
Upgrade to libvips v8.12.0-rc1
1 parent 1ff84b2 commit 079bd7b

14 files changed

Lines changed: 111 additions & 77 deletions

File tree

docs/changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## v0.30 - *dresser*
4+
5+
Requires libvips v8.12.0
6+
7+
### v0.30.0 - TBD
8+
9+
* Reduce minimum Linux ARM64v8 glibc requirement to 2.17.
10+
311
## v0.29 - *circle*
412

513
Requires libvips v8.11.3

install/libvips.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const platform = require('../lib/platform');
1818

1919
const minimumGlibcVersionByArch = {
2020
arm: '2.28',
21-
arm64: '2.29',
21+
arm64: '2.17',
2222
x64: '2.17'
2323
};
2424

@@ -120,7 +120,7 @@ try {
120120
}
121121

122122
// Download to per-process temporary file
123-
const tarFilename = ['libvips', minimumLibvipsVersion, platformAndArch].join('-') + '.tar.br';
123+
const tarFilename = ['libvips', minimumLibvipsVersionLabelled, platformAndArch].join('-') + '.tar.br';
124124
const tarPathCache = path.join(libvips.cachePath(), tarFilename);
125125
if (fs.existsSync(tarPathCache)) {
126126
libvips.log(`Using cached ${tarPathCache}`);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
},
151151
"license": "Apache-2.0",
152152
"config": {
153-
"libvips": "8.11.3",
153+
"libvips": "8.12.0-rc1",
154154
"runtime": "napi",
155155
"target": 5
156156
},

src/common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
// Verify platform and compiler compatibility
2626

2727
#if (VIPS_MAJOR_VERSION < 8) || \
28-
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 11) || \
29-
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 11 && VIPS_MICRO_VERSION < 3)
30-
#error "libvips version 8.11.3+ is required - please see https://sharp.pixelplumbing.com/install"
28+
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 12) || \
29+
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 12 && VIPS_MICRO_VERSION < 0)
30+
#error "libvips version 8.12.0+ is required - please see https://sharp.pixelplumbing.com/install"
3131
#endif
3232

3333
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))

src/libvips/cplusplus/VImage.cpp

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ negate( std::vector<double> vector )
9393
{
9494
std::vector<double> new_vector( vector.size() );
9595

96-
for( unsigned int i = 0; i < vector.size(); i++ )
96+
for( std::vector<double>::size_type i = 0; i < vector.size(); i++ )
9797
new_vector[i] = vector[i] * -1;
9898

9999
return( new_vector );
@@ -104,7 +104,7 @@ invert( std::vector<double> vector )
104104
{
105105
std::vector<double> new_vector( vector.size() );
106106

107-
for( unsigned int i = 0; i < vector.size(); i++ )
107+
for( std::vector<double>::size_type i = 0; i < vector.size(); i++ )
108108
new_vector[i] = 1.0 / vector[i];
109109

110110
return( new_vector );
@@ -210,7 +210,6 @@ VOption::set( const char *name, std::vector<int> value )
210210
Pair *pair = new Pair( name );
211211

212212
int *array;
213-
unsigned int i;
214213

215214
pair->input = true;
216215

@@ -219,7 +218,7 @@ VOption::set( const char *name, std::vector<int> value )
219218
static_cast< int >( value.size() ) );
220219
array = vips_value_get_array_int( &pair->value, NULL );
221220

222-
for( i = 0; i < value.size(); i++ )
221+
for( std::vector<double>::size_type i = 0; i < value.size(); i++ )
223222
array[i] = value[i];
224223

225224
options.push_back( pair );
@@ -234,7 +233,6 @@ VOption::set( const char *name, std::vector<double> value )
234233
Pair *pair = new Pair( name );
235234

236235
double *array;
237-
unsigned int i;
238236

239237
pair->input = true;
240238

@@ -243,7 +241,7 @@ VOption::set( const char *name, std::vector<double> value )
243241
static_cast< int >( value.size() ) );
244242
array = vips_value_get_array_double( &pair->value, NULL );
245243

246-
for( i = 0; i < value.size(); i++ )
244+
for( std::vector<double>::size_type i = 0; i < value.size(); i++ )
247245
array[i] = value[i];
248246

249247
options.push_back( pair );
@@ -258,7 +256,6 @@ VOption::set( const char *name, std::vector<VImage> value )
258256
Pair *pair = new Pair( name );
259257

260258
VipsImage **array;
261-
unsigned int i;
262259

263260
pair->input = true;
264261

@@ -267,7 +264,7 @@ VOption::set( const char *name, std::vector<VImage> value )
267264
static_cast< int >( value.size() ) );
268265
array = vips_value_get_array_image( &pair->value, NULL );
269266

270-
for( i = 0; i < value.size(); i++ ) {
267+
for( std::vector<double>::size_type i = 0; i < value.size(); i++ ) {
271268
VipsImage *vips_image = value[i].get_image();
272269

273270
array[i] = vips_image;
@@ -488,10 +485,9 @@ VOption::get_operation( VipsOperation *operation )
488485
double *array =
489486
vips_value_get_array_double( value,
490487
&length );
491-
int j;
492488

493489
((*i)->vvector)->resize( length );
494-
for( j = 0; j < length; j++ )
490+
for( int j = 0; j < length; j++ )
495491
(*((*i)->vvector))[j] = array[j];
496492
}
497493
else if( type == VIPS_TYPE_BLOB ) {
@@ -718,17 +714,38 @@ VImage::write_to_buffer( const char *suffix, void **buf, size_t *size,
718714
const char *operation_name;
719715
VipsBlob *blob;
720716

717+
/* Save with the new target API if we can. Fall back to the older
718+
* mechanism in case the saver we need has not been converted yet.
719+
*
720+
* We need to hide any errors from this first phase.
721+
*/
721722
vips__filename_split8( suffix, filename, option_string );
722-
if( !(operation_name = vips_foreign_find_save_buffer( filename )) ) {
723+
724+
vips_error_freeze();
725+
operation_name = vips_foreign_find_save_target( filename );
726+
vips_error_thaw();
727+
728+
if( operation_name ) {
729+
VTarget target = VTarget::new_to_memory();
730+
731+
call_option_string( operation_name, option_string,
732+
(options ? options : VImage::option())->
733+
set( "in", *this )->
734+
set( "target", target ) );
735+
736+
g_object_get( target.get_target(), "blob", &blob, NULL );
737+
}
738+
else if( (operation_name = vips_foreign_find_save_buffer( filename )) ) {
739+
call_option_string( operation_name, option_string,
740+
(options ? options : VImage::option())->
741+
set( "in", *this )->
742+
set( "buffer", &blob ) );
743+
}
744+
else {
723745
delete options;
724746
throw VError();
725747
}
726748

727-
call_option_string( operation_name, option_string,
728-
(options ? options : VImage::option())->
729-
set( "in", *this )->
730-
set( "buffer", &blob ) );
731-
732749
if( blob ) {
733750
if( buf ) {
734751
*buf = VIPS_AREA( blob )->data;
@@ -767,6 +784,7 @@ std::vector<VImage>
767784
VImage::bandsplit( VOption *options ) const
768785
{
769786
std::vector<VImage> b;
787+
b.reserve(bands());
770788

771789
for( int i = 0; i < bands(); i++ )
772790
b.push_back( extract_band( i ) );

src/libvips/cplusplus/vips-operators.cpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// bodies for vips operations
2-
// Wed May 12 11:30:00 AM CEST 2021
2+
// Mon Nov 1 03:31:09 PM CET 2021
33
// this file is generated automatically, do not edit!
44

55
VImage VImage::CMC2LCh( VOption *options ) const
@@ -1262,6 +1262,34 @@ VImage VImage::gifload_source( VSource source, VOption *options )
12621262
return( out );
12631263
}
12641264

1265+
void VImage::gifsave( const char *filename, VOption *options ) const
1266+
{
1267+
call( "gifsave",
1268+
(options ? options : VImage::option())->
1269+
set( "in", *this )->
1270+
set( "filename", filename ) );
1271+
}
1272+
1273+
VipsBlob *VImage::gifsave_buffer( VOption *options ) const
1274+
{
1275+
VipsBlob *buffer;
1276+
1277+
call( "gifsave_buffer",
1278+
(options ? options : VImage::option())->
1279+
set( "in", *this )->
1280+
set( "buffer", &buffer ) );
1281+
1282+
return( buffer );
1283+
}
1284+
1285+
void VImage::gifsave_target( VTarget target, VOption *options ) const
1286+
{
1287+
call( "gifsave_target",
1288+
(options ? options : VImage::option())->
1289+
set( "in", *this )->
1290+
set( "target", target ) );
1291+
}
1292+
12651293
VImage VImage::globalbalance( VOption *options ) const
12661294
{
12671295
VImage out;

src/metadata.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ class MetadataWorker : public Napi::AsyncWorker {
180180
}
181181
if (baton->pageHeight > 0) {
182182
info.Set("pageHeight", baton->pageHeight);
183+
} else if (baton->pages > 0) {
184+
info.Set("pageHeight", baton->height);
183185
}
184186
if (baton->loop >= 0) {
185187
info.Set("loop", baton->loop);
4.95 KB
Loading
-19.9 KB
Binary file not shown.
-833 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)