From 1702529be03e0c02c37f4187ad76241139851535 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 29 Aug 2018 09:50:35 +0100 Subject: [PATCH] add a compat stub for vips_region_shrink() to keep ABI compat with 8.6 --- libvips/foreign/dzsave.c | 3 ++- libvips/foreign/vips2tiff.c | 3 +-- libvips/include/vips/region.h | 7 ++++--- libvips/iofuncs/region.c | 32 +++++++++++++++++++++++++++----- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index ba1327d3..c668b8d9 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -1407,7 +1407,8 @@ strip_shrink( Layer *layer ) if( vips_rect_isempty( &target ) ) break; - (void) vips_region_shrink( from, to, &target, region_shrink ); + (void) vips_region_shrink_method( from, to, + &target, region_shrink ); below->write_y += target.height; diff --git a/libvips/foreign/vips2tiff.c b/libvips/foreign/vips2tiff.c index 0a6357e5..e26447e5 100644 --- a/libvips/foreign/vips2tiff.c +++ b/libvips/foreign/vips2tiff.c @@ -1399,8 +1399,7 @@ layer_strip_shrink( Layer *layer ) if( vips_rect_isempty( &target ) ) break; - (void) vips_region_shrink( from, to, &target, - VIPS_REGION_SHRINK_MEAN ); + (void) vips_region_shrink( from, to, &target ); below->write_y += target.height; diff --git a/libvips/include/vips/region.h b/libvips/include/vips/region.h index bf0c877d..f9013139 100644 --- a/libvips/include/vips/region.h +++ b/libvips/include/vips/region.h @@ -132,9 +132,10 @@ void vips_region_paint_pel( VipsRegion *reg, void vips_region_black( VipsRegion *reg ); void vips_region_copy( VipsRegion *reg, VipsRegion *dest, const VipsRect *r, int x, int y ); -int vips_region_shrink( VipsRegion *from, - VipsRegion *to, const VipsRect *target, - VipsRegionShrink method ); +int vips_region_shrink_method( VipsRegion *from, VipsRegion *to, + const VipsRect *target, VipsRegionShrink method ); +int vips_region_shrink( VipsRegion *from, VipsRegion *to, + const VipsRect *target ); int vips_region_prepare( VipsRegion *reg, const VipsRect *r ); int vips_region_prepare_to( VipsRegion *reg, diff --git a/libvips/iofuncs/region.c b/libvips/iofuncs/region.c index 1da02542..bce6d775 100644 --- a/libvips/iofuncs/region.c +++ b/libvips/iofuncs/region.c @@ -1510,7 +1510,7 @@ vips_region_shrink_alpha( VipsRegion *from, } /** - * vips_region_shrink: + * vips_region_shrink_method: * @from: source region * @to: (inout): destination region * @target: #VipsRect of pixels you need to copy @@ -1525,16 +1525,17 @@ vips_region_shrink_alpha( VipsRegion *from, * See also: vips_region_copy(). */ int -vips_region_shrink( VipsRegion *from, VipsRegion *to, const VipsRect *target, - VipsRegionShrink method ) +vips_region_shrink_method( VipsRegion *from, VipsRegion *to, + const VipsRect *target, VipsRegionShrink method ) { VipsImage *image = from->im; - if( vips_check_coding_noneorlabq( "vips_region_shrink", image ) ) + if( vips_check_coding_noneorlabq( "vips_region_shrink_method", image ) ) return( -1 ); if( from->im->Coding == VIPS_CODING_NONE ) { - if( vips_check_noncomplex( "vips_region_shrink", image ) ) + if( vips_check_noncomplex( "vips_region_shrink_method", + image ) ) return( -1 ); if( vips_image_hasalpha( image ) ) @@ -1548,6 +1549,27 @@ vips_region_shrink( VipsRegion *from, VipsRegion *to, const VipsRect *target, return( 0 ); } +/** + * vips_region_shrink: (skip) + * @from: source region + * @to: (inout): destination region + * @target: #VipsRect of pixels you need to copy + * + * Write the pixels @target in @to from the x2 larger area in @from. + * Non-complex uncoded images and LABQ only. Images with alpha (see + * vips_image_hasalpha()) shrink with pixels scaled by alpha to avoid fringing. + * + * This is a compatibility stub that just calls vips_region_shrink_method(). + * + * See also: vips_region_shrink_method(). + */ +int +vips_region_shrink( VipsRegion *from, VipsRegion *to, const VipsRect *target ) +{ + return( vips_region_shrink_method( from, to, target, + VIPS_REGION_SHRINK_MEAN ) ); +} + /* Generate into a region. */ static int