[devel] Relocate the INVERT_ALPHA function within png_read_png()
and png_write_png().
diff --git a/ANNOUNCE b/ANNOUNCE
index 8c71258..354735a 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -495,6 +495,8 @@
Refer to the libpng license instead of the libpng license in each file.
version 1.4.0beta67 [June 29, 2009]
+ Relocated INVERT_ALPHA within png_read_png() and png_write_png()
+ to match its position in pngrtran.c.
version 1.4.0betaN [future]
Build shared libraries with -lz and sometimes -lm.
diff --git a/CHANGES b/CHANGES
index e459d8d..c82f3e4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2172,7 +2172,7 @@
Refer to the libpng license instead of the libpng license in each file.
version 1.4.0beta67 [June 29, 2009]
- Relocated INVERT_ALPHA withing png_read_png() and png_write_png()
+ Relocated INVERT_ALPHA within png_read_png() and png_write_png()
to match its position in pngrtran.c.
version 1.4.0betaN [future]
diff --git a/pngread.c b/pngread.c
index 575e03d..9ef8fd7 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1195,12 +1195,6 @@
if (png_ptr == NULL)
return;
-#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
- /* Invert the alpha channel from opacity to transparency
- */
- if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
- png_set_invert_alpha(png_ptr);
-#endif
/* png_read_info() gives us all of the information from the
* PNG file before the first IDAT (image data chunk).
@@ -1301,6 +1295,13 @@
png_set_swap(png_ptr);
#endif
+#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
+ /* Invert the alpha channel from opacity to transparency
+ */
+ if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
+ png_set_invert_alpha(png_ptr);
+#endif
+
/* We don't handle adding filler bytes */
/* Optional call to gamma correct and add the background to the palette
diff --git a/pngwrite.c b/pngwrite.c
index cc60d76..27744a7 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1347,11 +1347,6 @@
{
if (png_ptr == NULL || info_ptr == NULL)
return;
-#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
- /* Invert the alpha channel from opacity to transparency */
- if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
- png_set_invert_alpha(png_ptr);
-#endif
/* Write the file header information. */
png_write_info(png_ptr, info_ptr);
@@ -1411,6 +1406,12 @@
png_set_packswap(png_ptr);
#endif
+#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
+ /* Invert the alpha channel from opacity to transparency */
+ if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
+ png_set_invert_alpha(png_ptr);
+#endif
+
/* ----------------------- end of transformations ------------------- */
/* Write the bits */