summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-02-05 01:23:35 -0800
committerLei Zhang <thestig@chromium.org>2016-02-05 01:23:35 -0800
commitb1dde8b188a20b5b7de53908bc434d2c82c22217 (patch)
treee843b08b22160275a2a461e300d2d1bb7b5107b3 /core/src
parentd2941a736bfe37b792a7144cfc561e043c2bc1f0 (diff)
downloadpdfium-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 .
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp5
1 files changed, 5 insertions, 0 deletions
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) {