diff options
author | Lei Zhang <thestig@chromium.org> | 2017-05-18 00:50:14 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-18 08:06:10 +0000 |
commit | cfd56852b6375d2b4eea473399231caf7dcdbf36 (patch) | |
tree | 46618475f362e55d6a28c480b09017d764221fa7 /core/fpdfapi | |
parent | 46abb66cb57d4bc6b9326efd7a0c0e776e594db2 (diff) | |
download | pdfium-cfd56852b6375d2b4eea473399231caf7dcdbf36.tar.xz |
Fix a situation where images are not properly rendered.
This regressed in commit e21fe98. When the image's bpc is a multiple of
8, there exists a colorspace, and there is a Decode parameter, the image
data source was incorrectly pointing to a data structure that only
contained black pixels.
BUG=chromium:718762
Change-Id: I5d3fa739e41726b4ed1ebc16465e17f83fff9f8d
Reviewed-on: https://pdfium-review.googlesource.com/5333
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/render/cpdf_dibsource.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp index f6009674c5..f1c58038e8 100644 --- a/core/fpdfapi/render/cpdf_dibsource.cpp +++ b/core/fpdfapi/render/cpdf_dibsource.cpp @@ -1361,7 +1361,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, if (src_x == last_src_x) { argb = last_argb; } else { - CFX_FixedBufGrow<uint8_t, 128> extracted_components(m_nComponents); + CFX_FixedBufGrow<uint8_t, 16> extracted_components(m_nComponents); const uint8_t* pSrcPixel = nullptr; if (m_bpc % 8 != 0) { // No need to check for 32-bit overflow, as |src_x| is bounded by @@ -1388,12 +1388,9 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, if (m_pColorSpace) { uint8_t color[4]; const bool bTransMask = TransMask(); - if (m_bDefaultDecode) { - m_pColorSpace->TranslateImageLine(color, pSrcPixel, 1, 0, 0, - bTransMask); - } else { + if (!m_bDefaultDecode) { for (uint32_t j = 0; j < m_nComponents; ++j) { - float component_value = static_cast<float>(extracted_components[j]); + float component_value = static_cast<float>(pSrcPixel[j]); int color_value = static_cast<int>( (m_pCompData[j].m_DecodeMin + m_pCompData[j].m_DecodeStep * component_value) * @@ -1401,9 +1398,10 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, 0.5f); extracted_components[j] = pdfium::clamp(color_value, 0, 255); } - m_pColorSpace->TranslateImageLine(color, extracted_components, 1, 0, - 0, bTransMask); } + const uint8_t* pSrc = + m_bDefaultDecode ? pSrcPixel : extracted_components; + m_pColorSpace->TranslateImageLine(color, pSrc, 1, 0, 0, bTransMask); argb = FXARGB_MAKE(0xFF, color[2], color[1], color[0]); } else { argb = FXARGB_MAKE(0xFF, pSrcPixel[2], pSrcPixel[1], pSrcPixel[0]); |