Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/src/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/src/fpdfapi/fpdf_render/render_int.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 621 const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam(); | 621 const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam(); |
| 622 if (decoder == "CCITTFaxDecode") { | 622 if (decoder == "CCITTFaxDecode") { |
| 623 m_pDecoder.reset(FPDFAPI_CreateFaxDecoder(src_data, src_size, m_Width, | 623 m_pDecoder.reset(FPDFAPI_CreateFaxDecoder(src_data, src_size, m_Width, |
| 624 m_Height, pParams)); | 624 m_Height, pParams)); |
| 625 } else if (decoder == "DCTDecode") { | 625 } else if (decoder == "DCTDecode") { |
| 626 m_pDecoder.reset(CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( | 626 m_pDecoder.reset(CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( |
| 627 src_data, src_size, m_Width, m_Height, m_nComponents, | 627 src_data, src_size, m_Width, m_Height, m_nComponents, |
| 628 pParams ? pParams->GetIntegerBy("ColorTransform", 1) : 1)); | 628 pParams ? pParams->GetIntegerBy("ColorTransform", 1) : 1)); |
| 629 if (!m_pDecoder) { | 629 if (!m_pDecoder) { |
| 630 FX_BOOL bTransform = FALSE; | 630 FX_BOOL bTransform = FALSE; |
| 631 int comps, bpc; | 631 int comps, bpc; |
|
Tom Sepez
2016/03/11 00:30:28
also one declaration per line while we're at it.
Wei Li
2016/03/11 04:11:36
Done.
| |
| 632 ICodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModule(); | 632 ICodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModule(); |
| 633 if (pJpegModule->LoadInfo(src_data, src_size, m_Width, m_Height, comps, | 633 if (pJpegModule->LoadInfo(src_data, src_size, m_Width, m_Height, comps, |
| 634 bpc, bTransform)) { | 634 bpc, bTransform)) { |
| 635 if (m_nComponents != comps) { | 635 if (m_nComponents != static_cast<FX_DWORD>(comps)) { |
| 636 FX_Free(m_pCompData); | 636 FX_Free(m_pCompData); |
| 637 m_nComponents = comps; | 637 m_nComponents = static_cast<FX_DWORD>(comps); |
| 638 if (m_Family == PDFCS_LAB && m_nComponents != 3) { | 638 if (m_Family == PDFCS_LAB && m_nComponents != 3) { |
| 639 m_pCompData = nullptr; | 639 m_pCompData = nullptr; |
| 640 return 0; | 640 return 0; |
| 641 } | 641 } |
| 642 m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey); | 642 m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey); |
| 643 if (!m_pCompData) { | 643 if (!m_pCompData) { |
| 644 return 0; | 644 return 0; |
| 645 } | 645 } |
| 646 } | 646 } |
| 647 m_bpc = bpc; | 647 m_bpc = bpc; |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1433 | 1433 |
| 1434 void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, | 1434 void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, |
| 1435 int dest_Bpp, | 1435 int dest_Bpp, |
| 1436 FX_DWORD src_width, | 1436 FX_DWORD src_width, |
| 1437 const uint8_t* pSrcLine, | 1437 const uint8_t* pSrcLine, |
| 1438 uint8_t* dest_scan, | 1438 uint8_t* dest_scan, |
| 1439 int dest_width, | 1439 int dest_width, |
| 1440 FX_BOOL bFlipX, | 1440 FX_BOOL bFlipX, |
| 1441 int clip_left, | 1441 int clip_left, |
| 1442 int clip_width) const { | 1442 int clip_width) const { |
| 1443 int last_src_x = -1; | 1443 FX_DWORD last_src_x = src_width; |
|
Tom Sepez
2016/03/11 00:30:28
Ok, took a moment for me to get this, maybe a comm
Wei Li
2016/03/11 04:11:36
Done.
| |
| 1444 FX_ARGB last_argb = FXARGB_MAKE(0xFF, 0xFF, 0xFF, 0xFF); | 1444 FX_ARGB last_argb = FXARGB_MAKE(0xFF, 0xFF, 0xFF, 0xFF); |
| 1445 FX_FLOAT unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1); | 1445 FX_FLOAT unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1); |
| 1446 for (int i = 0; i < clip_width; i++) { | 1446 for (int i = 0; i < clip_width; i++) { |
| 1447 int dest_x = clip_left + i; | 1447 int dest_x = clip_left + i; |
| 1448 FX_DWORD src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * | 1448 FX_DWORD src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * |
| 1449 (int64_t)src_width / dest_width; | 1449 (int64_t)src_width / dest_width; |
| 1450 src_x %= src_width; | 1450 src_x %= src_width; |
| 1451 | 1451 |
| 1452 uint8_t* pDestPixel = dest_scan + i * dest_Bpp; | 1452 uint8_t* pDestPixel = dest_scan + i * dest_Bpp; |
| 1453 FX_ARGB argb; | 1453 FX_ARGB argb; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1644 IFX_Pause* pPause) { | 1644 IFX_Pause* pPause) { |
| 1645 return LoadHandle->Continue(pPause); | 1645 return LoadHandle->Continue(pPause); |
| 1646 } | 1646 } |
| 1647 | 1647 |
| 1648 CPDF_ImageLoader::~CPDF_ImageLoader() { | 1648 CPDF_ImageLoader::~CPDF_ImageLoader() { |
| 1649 if (!m_bCached) { | 1649 if (!m_bCached) { |
| 1650 delete m_pBitmap; | 1650 delete m_pBitmap; |
| 1651 delete m_pMask; | 1651 delete m_pMask; |
| 1652 } | 1652 } |
| 1653 } | 1653 } |
| OLD | NEW |