From b1dde8b188a20b5b7de53908bc434d2c82c22217 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 5 Feb 2016 01:23:35 -0800 Subject: Support 16-bit images in downsampler. 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 . --- core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core/src/fpdfapi/fpdf_render') 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) { -- cgit v1.2.3