diff options
author | Lei Zhang <thestig@chromium.org> | 2016-02-05 01:23:35 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2016-02-05 01:23:35 -0800 |
commit | b1dde8b188a20b5b7de53908bc434d2c82c22217 (patch) | |
tree | e843b08b22160275a2a461e300d2d1bb7b5107b3 | |
parent | d2941a736bfe37b792a7144cfc561e043c2bc1f0 (diff) | |
download | pdfium-b1dde8b188a20b5b7de53908bc434d2c82c22217.tar.xz |
Support 16-bit images in downsampler.chromium/2642
The downsampler was not sampling correctly from 16-bit images, resulting
in using the RRG bytes (of the RRGGBB 16-bit pixel) for RGB in the 8-bit
output.
Original code review: https://codereview.chromium.org/1663983002/
Original author: ballbach@google.com
BUG=583804
R=ballbach@google.com
Review URL: https://codereview.chromium.org/1671833002 .
-rw-r--r-- | DEPS | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
@@ -8,7 +8,7 @@ deps = { "https://chromium.googlesource.com/chromium/buildtools.git@c2f259809d5ede3275df5ea0842f0431990c4f98", "testing/corpus": - "https://pdfium.googlesource.com/pdfium_tests@cc132ff8921c76ea69888cae4bb00e01dd1ce0b3", + "https://pdfium.googlesource.com/pdfium_tests@bafb069353f96d441c6a37786d18cd9f5407937f", "testing/gmock": "https://chromium.googlesource.com/external/googlemock.git@29763965ab52f24565299976b936d1265cb6a271", diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index 1f4ba62b0a..e62290fdbb 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -1473,6 +1473,11 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, src_bit_pos += m_bpc; } pSrcPixel = extracted_components; + } else if (m_bpc == 16) { + for (FX_DWORD j = 0; j < m_nComponents; ++j) { + extracted_components[j] = pSrcPixel[j * 2]; + } + pSrcPixel = extracted_components; } if (m_pColorSpace) { |