Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1369)

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp

Issue 1671833002: Support 16-bit images in downsampler. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "render_int.h" 7 #include "render_int.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 } else { 1466 } else {
1467 CFX_FixedBufGrow<uint8_t, 128> extracted_components(m_nComponents); 1467 CFX_FixedBufGrow<uint8_t, 128> extracted_components(m_nComponents);
1468 if (m_bpc % 8 != 0) { 1468 if (m_bpc % 8 != 0) {
1469 uint64_t src_bit_pos = bit_offset; 1469 uint64_t src_bit_pos = bit_offset;
1470 for (FX_DWORD j = 0; j < m_nComponents; ++j) { 1470 for (FX_DWORD j = 0; j < m_nComponents; ++j) {
1471 extracted_components[j] = static_cast<uint8_t>( 1471 extracted_components[j] = static_cast<uint8_t>(
1472 GetBits8(pSrcPixel, src_bit_pos, m_bpc) * unit_To8Bpc); 1472 GetBits8(pSrcPixel, src_bit_pos, m_bpc) * unit_To8Bpc);
1473 src_bit_pos += m_bpc; 1473 src_bit_pos += m_bpc;
1474 } 1474 }
1475 pSrcPixel = extracted_components; 1475 pSrcPixel = extracted_components;
1476 } else if (m_bpc == 16) {
1477 for (FX_DWORD j = 0; j < m_nComponents; ++j) {
1478 extracted_components[j] = pSrcPixel[j * 2];
1479 }
1480 pSrcPixel = extracted_components;
1476 } 1481 }
1477 1482
1478 if (m_pColorSpace) { 1483 if (m_pColorSpace) {
1479 uint8_t color[4]; 1484 uint8_t color[4];
1480 const FX_BOOL bTransMask = TransMask(); 1485 const FX_BOOL bTransMask = TransMask();
1481 if (m_bDefaultDecode) { 1486 if (m_bDefaultDecode) {
1482 m_pColorSpace->TranslateImageLine(color, pSrcPixel, 1, 0, 0, 1487 m_pColorSpace->TranslateImageLine(color, pSrcPixel, 1, 0, 0,
1483 bTransMask); 1488 bTransMask);
1484 } else { 1489 } else {
1485 for (FX_DWORD j = 0; j < m_nComponents; ++j) { 1490 for (FX_DWORD j = 0; j < m_nComponents; ++j) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 IFX_Pause* pPause) { 1646 IFX_Pause* pPause) {
1642 return LoadHandle->Continue(pPause); 1647 return LoadHandle->Continue(pPause);
1643 } 1648 }
1644 1649
1645 CPDF_ImageLoader::~CPDF_ImageLoader() { 1650 CPDF_ImageLoader::~CPDF_ImageLoader() {
1646 if (!m_bCached) { 1651 if (!m_bCached) {
1647 delete m_pBitmap; 1652 delete m_pBitmap;
1648 delete m_pMask; 1653 delete m_pMask;
1649 } 1654 }
1650 } 1655 }
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698