[devel] Fixed buffer bug (both the strip_16 and scale_16 transforms were

being applied.
diff --git a/pngread.c b/pngread.c
index b11f4db..ba56032 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1286,24 +1286,26 @@
 
    /* -------------- image transformations start here ------------------- */
 
-#ifdef PNG_READ_16_TO_8_SUPPORTED
+#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
    /* Tell libpng to strip 16-bit/color files down to 8 bits per color.
     */
-#  ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
    if (transforms & PNG_TRANSFORM_SCALE_16)
-      png_set_scale_16(png_ptr);
-#    ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
-   else
-
-#    endif
-#  endif
-#  ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
+   {
      /* Added at libpng-1.5.4. "strip_16" produces the same result that it
       * did in earlier versions, while "scale_16" is now more accurate.
       */
+      png_set_scale_16(png_ptr);
+   }
+
+#  ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
+   else
+#  endif
+
+#endif
+
+#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
      if (transforms & PNG_TRANSFORM_STRIP_16)
         png_set_strip_16(png_ptr);
-#  endif
 #endif
 
 #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED