rename 'disc' as 'memory'
the old 'disc' flag to open defaulted TRUE and disabled read via disc if you set it FALSE, which was very confusing replace it with a flag called 'memory' which defaults FALSE and forces read via memory if set TRUE 'disc' is still there and still works, it's just tagged as deprecated see https://github.com/jcupitt/libvips/issues/677
This commit is contained in:
parent
7d98b39843
commit
9a1c3f9405
@ -9,6 +9,7 @@
|
||||
- add vips_thumbnail_image()
|
||||
- better prefix guessing on Windows, thanks tumagonx
|
||||
- savers support a "page_height" option for multipage save
|
||||
- rename 'disc' as 'memory' and default off
|
||||
|
||||
12/6/17 started 8.5.7
|
||||
- transform cmyk->rgb automatically on write if there's an embedded profile
|
||||
|
@ -740,12 +740,18 @@ vips_foreign_load_temp( VipsForeignLoad *load )
|
||||
return( vips_image_new() );
|
||||
}
|
||||
|
||||
/* ->memory used to be called ->disc and default TRUE. If it's been
|
||||
* forced FALSE, set memory TRUE.
|
||||
*/
|
||||
if( !load->disc )
|
||||
load->memory = TRUE;
|
||||
|
||||
/* We open via disc if:
|
||||
* - 'disc' is set
|
||||
* - 'memory' is off
|
||||
* - the uncompressed image will be larger than
|
||||
* vips_get_disc_threshold()
|
||||
*/
|
||||
if( load->disc &&
|
||||
if( !load->memory &&
|
||||
image_size > disc_threshold ) {
|
||||
#ifdef DEBUG
|
||||
printf( "vips_foreign_load_temp: disc temp\n" );
|
||||
@ -997,12 +1003,12 @@ vips_foreign_load_class_init( VipsForeignLoadClass *class )
|
||||
G_STRUCT_OFFSET( VipsForeignLoad, flags ),
|
||||
VIPS_TYPE_FOREIGN_FLAGS, VIPS_FOREIGN_NONE );
|
||||
|
||||
VIPS_ARG_BOOL( class, "disc", 7,
|
||||
_( "Disc" ),
|
||||
_( "Open to disc" ),
|
||||
VIPS_ARG_BOOL( class, "memory", 7,
|
||||
_( "Memory" ),
|
||||
_( "Force open via memory" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsForeignLoad, disc ),
|
||||
TRUE );
|
||||
G_STRUCT_OFFSET( VipsForeignLoad, memory ),
|
||||
FALSE );
|
||||
|
||||
VIPS_ARG_ENUM( class, "access", 8,
|
||||
_( "Access" ),
|
||||
@ -1025,6 +1031,13 @@ vips_foreign_load_class_init( VipsForeignLoadClass *class )
|
||||
G_STRUCT_OFFSET( VipsForeignLoad, fail ),
|
||||
FALSE );
|
||||
|
||||
VIPS_ARG_BOOL( class, "disc", 12,
|
||||
_( "Disc" ),
|
||||
_( "Open to disc" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT | VIPS_ARGUMENT_DEPRECATED,
|
||||
G_STRUCT_OFFSET( VipsForeignLoad, disc ),
|
||||
TRUE );
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -119,9 +119,9 @@ typedef struct _VipsForeignLoad {
|
||||
VipsForeign parent_object;
|
||||
/*< private >*/
|
||||
|
||||
/* Open to disc (default is to open to memory).
|
||||
/* Set TRUE to force open via memory.
|
||||
*/
|
||||
gboolean disc;
|
||||
gboolean memory;
|
||||
|
||||
/* Type of access upstream wants and the loader must supply.
|
||||
*/
|
||||
@ -153,6 +153,11 @@ typedef struct _VipsForeignLoad {
|
||||
/* Set this to tag the operation as nocache.
|
||||
*/
|
||||
gboolean nocache;
|
||||
|
||||
/* Deprecated: the memory option used to be called disc and default
|
||||
* TRUE.
|
||||
*/
|
||||
gboolean disc;
|
||||
} VipsForeignLoad;
|
||||
|
||||
typedef struct _VipsForeignLoadClass {
|
||||
|
@ -1831,7 +1831,7 @@ vips_filename_get_options( const char *vips_filename )
|
||||
* Optional arguments:
|
||||
*
|
||||
* * @access: hint #VipsAccess mode to loader
|
||||
* * @disc: load via a temporary disc file
|
||||
* * @memory: force load via memory
|
||||
*
|
||||
* vips_image_new_from_file() opens @name for reading. It can load files
|
||||
* in many image formats, including VIPS, TIFF, PNG, JPEG, FITS, Matlab,
|
||||
@ -1856,12 +1856,15 @@ vips_filename_get_options( const char *vips_filename )
|
||||
*
|
||||
* In #VIPS_ACCESS_RANDOM mode, small images are decompressed to memory and
|
||||
* then processed from there. Large images are decompressed to temporary
|
||||
* random-access files on disc and then processed from there. Set @disc to
|
||||
* %TRUE to force loading via disc. See vips_image_new_temp_file() for an
|
||||
* random-access files on disc and then processed from there.
|
||||
*
|
||||
* Set @memory to %TRUE to force loading via memory. The default is to load
|
||||
* large random access images via temporary disc files. See
|
||||
* vips_image_new_temp_file() for an
|
||||
* explanation of how VIPS selects a location for the temporary file.
|
||||
*
|
||||
* The disc threshold can be set with the "--vips-disc-threshold"
|
||||
* command-line argument, or the VIPS_DISC_THRESHOLD environment variable.
|
||||
* command-line argument, or the `VIPS_DISC_THRESHOLD` environment variable.
|
||||
* The value is a simple integer, but can take a unit postfix of "k",
|
||||
* "m" or "g" to indicate kilobytes, megabytes or gigabytes.
|
||||
* The default threshold is 100 MB.
|
||||
|
Loading…
Reference in New Issue
Block a user