Skip to content

Commit 303513e

Browse files
committed
small comment polish
1 parent 0b74acf commit 303513e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- fix build with more modern librsvg [lovell]
99
- fix a possible segv with very wide images [f1ac]
1010
- revise premultiply, again [jjonesrs]
11+
- revise profile handling in vipsthumbnail
1112

1213
18/12/20 started 8.10.5
1314
- fix potential /0 in animated webp load [lovell]

libvips/resample/thumbnail.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -694,12 +694,12 @@ vips_thumbnail_build( VipsObject *object )
694694

695695
/* In linear mode, we need to transform to a linear space before
696696
* vips_resize().
697-
*
698-
* If we are doing colour management (there's an import profile),
699-
* then we use XYZ PCS as the resize space.
700697
*/
701698
have_imported = FALSE;
702699
if( thumbnail->linear ) {
700+
/* If we are doing colour management (there's an import
701+
* profile), then we can use XYZ PCS as the resize space.
702+
*/
703703
if( in->Coding == VIPS_CODING_NONE &&
704704
(in->BandFmt == VIPS_FORMAT_UCHAR ||
705705
in->BandFmt == VIPS_FORMAT_USHORT) &&
@@ -717,7 +717,6 @@ vips_thumbnail_build( VipsObject *object )
717717
"pcs", VIPS_PCS_XYZ,
718718
NULL ) )
719719
return( -1 );
720-
721720
in = t[1];
722721

723722
have_imported = TRUE;
@@ -771,16 +770,16 @@ vips_thumbnail_build( VipsObject *object )
771770
if( vips_image_hasalpha( in ) &&
772771
hshrink != 1.0 &&
773772
vshrink != 1.0 ) {
774-
g_info( "premultiplying alpha" );
775-
if( vips_premultiply( in, &t[3], NULL ) )
776-
return( -1 );
777-
have_premultiplied = TRUE;
778-
779773
/* vips_premultiply() makes a float image. When we
780774
* vips_unpremultiply() below, we need to cast back to the
781775
* pre-premultiplied format.
782776
*/
777+
g_info( "premultiplying alpha" );
778+
have_premultiplied = TRUE;
783779
unpremultiplied_format = in->BandFmt;
780+
781+
if( vips_premultiply( in, &t[3], NULL ) )
782+
return( -1 );
784783
in = t[3];
785784
}
786785

@@ -838,7 +837,7 @@ vips_thumbnail_build( VipsObject *object )
838837
}
839838
}
840839
else if( thumbnail->export_profile ) {
841-
/* Not imported, but we are doing colourmanagement. Transform
840+
/* Not imported, but we are doing colour management. Transform
842841
* to the output space.
843842
*/
844843
g_info( "transforming to %s", thumbnail->export_profile );

0 commit comments

Comments
 (0)