summaryrefslogtreecommitdiff
path: root/third_party/libpng16/pngtrans.c
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-04 22:42:56 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-04 22:42:56 +0000
commit424621e3129f7029283f72e953fe0c69f982d257 (patch)
tree47d64c877a652cffd8d6da60982f2f706a07ee22 /third_party/libpng16/pngtrans.c
parentd51c66c57a4fa6033f025d6ddd5d17a7d4e1d001 (diff)
downloadpdfium-424621e3129f7029283f72e953fe0c69f982d257.tar.xz
Revert "Update libpng from 1.6.22 -> 1.6.34"chromium/3543
This reverts commit 6b2e2f0ec7c5f629c5270d14c2339197af7392d8. Reason for revert: Broke Chromium integration. Original change's description: > Update libpng from 1.6.22 -> 1.6.34 > > Updates third_party/libpng16 to Chromium's third_party/libpng @ > e87a02987101e2dbe319a4aba6b52470f7624b4a and applies PDFium specific > patches. > > BUG=chromium:880322 > > Change-Id: I6724f55099c70a79da6d6e4863b9c6c9157ec571 > Reviewed-on: https://pdfium-review.googlesource.com/41910 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Ryan Harrison <rharrison@chromium.org> TBR=thestig@chromium.org,rharrison@chromium.org Change-Id: I2fd1f78e5d07ca983b2430bf078544185292ee1d No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:880322 Reviewed-on: https://pdfium-review.googlesource.com/41970 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'third_party/libpng16/pngtrans.c')
-rw-r--r--third_party/libpng16/pngtrans.c51
1 files changed, 18 insertions, 33 deletions
diff --git a/third_party/libpng16/pngtrans.c b/third_party/libpng16/pngtrans.c
index 6882f0fd7b..7f8cc455d3 100644
--- a/third_party/libpng16/pngtrans.c
+++ b/third_party/libpng16/pngtrans.c
@@ -1,8 +1,8 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
- * Last changed in libpng 1.6.33 [September 28, 2017]
- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.18 [July 23, 2015]
+ * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -172,14 +172,13 @@ png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
* size!
*/
png_app_error(png_ptr,
- "png_set_filler is invalid for"
- " low bit depth gray output");
+ "png_set_filler is invalid for low bit depth gray output");
return;
}
default:
png_app_error(png_ptr,
- "png_set_filler: inappropriate color type");
+ "png_set_filler: inappropriate color type");
return;
}
# else
@@ -514,15 +513,11 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */
++sp;
else /* Skip initial channel and, for sp, the filler */
- {
- sp += 2; ++dp;
- }
+ sp += 2, ++dp;
/* For a 1 pixel wide image there is nothing to do */
while (sp < ep)
- {
- *dp++ = *sp; sp += 2;
- }
+ *dp++ = *sp, sp += 2;
row_info->pixel_depth = 8;
}
@@ -532,14 +527,10 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */
sp += 2;
else /* Skip initial channel and, for sp, the filler */
- {
- sp += 4; dp += 2;
- }
+ sp += 4, dp += 2;
while (sp < ep)
- {
- *dp++ = *sp++; *dp++ = *sp; sp += 3;
- }
+ *dp++ = *sp++, *dp++ = *sp, sp += 3;
row_info->pixel_depth = 16;
}
@@ -562,15 +553,11 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */
++sp;
else /* Skip initial channels and, for sp, the filler */
- {
- sp += 4; dp += 3;
- }
+ sp += 4, dp += 3;
/* Note that the loop adds 3 to dp and 4 to sp each time. */
while (sp < ep)
- {
- *dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp; sp += 2;
- }
+ *dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2;
row_info->pixel_depth = 24;
}
@@ -580,16 +567,14 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */
sp += 2;
else /* Skip initial channels and, for sp, the filler */
- {
- sp += 8; dp += 6;
- }
+ sp += 8, dp += 6;
while (sp < ep)
{
/* Copy 6 bytes, skip 2 */
- *dp++ = *sp++; *dp++ = *sp++;
- *dp++ = *sp++; *dp++ = *sp++;
- *dp++ = *sp++; *dp++ = *sp; sp += 3;
+ *dp++ = *sp++, *dp++ = *sp++;
+ *dp++ = *sp++, *dp++ = *sp++;
+ *dp++ = *sp++, *dp++ = *sp, sp += 3;
}
row_info->pixel_depth = 48;
@@ -609,7 +594,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
return; /* The filler channel has gone already */
/* Fix the rowbytes value. */
- row_info->rowbytes = (png_size_t)(dp-row);
+ row_info->rowbytes = dp-row;
}
#endif
@@ -707,8 +692,8 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
* and this calculation is used because it avoids warnings that other
* forms produced on either GCC or MSVC.
*/
- int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
- png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1;
+ int padding = (-row_info->pixel_depth * row_info->width) & 7;
+ png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
switch (row_info->bit_depth)
{
@@ -812,7 +797,7 @@ png_set_user_transform_info(png_structrp png_ptr, png_voidp
(png_ptr->flags & PNG_FLAG_ROW_INIT) != 0)
{
png_app_error(png_ptr,
- "info change after png_start_read_image or png_read_update_info");
+ "info change after png_start_read_image or png_read_update_info");
return;
}
#endif