| 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 "../../../include/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
| 8 #include "../../../include/fxcodec/fx_codec.h" | 8 #include "../../../include/fxcodec/fx_codec.h" |
| 9 #include "../../../include/fpdfapi/fpdf_module.h" | 9 #include "../../../include/fpdfapi/fpdf_module.h" |
| 10 #include "../../../include/fpdfapi/fpdf_render.h" | 10 #include "../../../include/fpdfapi/fpdf_render.h" |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 } | 938 } |
| 939 return bpc; | 939 return bpc; |
| 940 } | 940 } |
| 941 #define NORMALCOLOR_MAX(color, max) (color) > (max) ? (max) : (color) < 0 ? 0 :
(color); | 941 #define NORMALCOLOR_MAX(color, max) (color) > (max) ? (max) : (color) < 0 ? 0 :
(color); |
| 942 void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_
scan) const | 942 void CPDF_DIBSource::TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_
scan) const |
| 943 { | 943 { |
| 944 int max_data = (1 << m_bpc) - 1; | 944 int max_data = (1 << m_bpc) - 1; |
| 945 if (m_bDefaultDecode) { | 945 if (m_bDefaultDecode) { |
| 946 if (m_Family == PDFCS_DEVICERGB || m_Family == PDFCS_CALRGB) { | 946 if (m_Family == PDFCS_DEVICERGB || m_Family == PDFCS_CALRGB) { |
| 947 if (m_bpc == 16) { | 947 if (m_bpc == 16) { |
| 948 FX_LPBYTE dest_pos = dest_scan; | |
| 949 FX_LPCBYTE src_pos = src_scan; | 948 FX_LPCBYTE src_pos = src_scan; |
| 950 for (int col = 0; col < m_Width; col ++) { | 949 for (int col = 0; col < m_Width; col ++) { |
| 951 *dest_scan++ = src_pos[4]; | 950 *dest_scan++ = src_pos[4]; |
| 952 *dest_scan++ = src_pos[2]; | 951 *dest_scan++ = src_pos[2]; |
| 953 *dest_scan++ = *src_pos; | 952 *dest_scan++ = *src_pos; |
| 954 src_pos += 6; | 953 src_pos += 6; |
| 955 } | 954 } |
| 956 } else if (m_bpc == 8) { | 955 } else if (m_bpc == 8) { |
| 957 FX_LPBYTE dest_pos = dest_scan; | |
| 958 FX_LPCBYTE src_pos = src_scan; | 956 FX_LPCBYTE src_pos = src_scan; |
| 959 for (int column = 0; column < m_Width; column ++) { | 957 for (int column = 0; column < m_Width; column ++) { |
| 960 *dest_scan++ = src_pos[2]; | 958 *dest_scan++ = src_pos[2]; |
| 961 *dest_scan++ = src_pos[1]; | 959 *dest_scan++ = src_pos[1]; |
| 962 *dest_scan++ = *src_pos; | 960 *dest_scan++ = *src_pos; |
| 963 src_pos += 3; | 961 src_pos += 3; |
| 964 } | 962 } |
| 965 } else { | 963 } else { |
| 966 int src_bit_pos = 0; | 964 int src_bit_pos = 0; |
| 967 int dest_byte_pos = 0; | 965 int dest_byte_pos = 0; |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1353 int color_value = (int)((m_pCompData[i].m_DecodeMin
+ m_pCompData[i].m_DecodeStep * (FX_FLOAT)pSrcPixel[i]) * 255.0f + 0.5f); | 1351 int color_value = (int)((m_pCompData[i].m_DecodeMin
+ m_pCompData[i].m_DecodeStep * (FX_FLOAT)pSrcPixel[i]) * 255.0f + 0.5f); |
| 1354 temp[i] = color_value > 255 ? 255 : (color_value < 0
? 0 : color_value); | 1352 temp[i] = color_value > 255 ? 255 : (color_value < 0
? 0 : color_value); |
| 1355 } | 1353 } |
| 1356 m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0,
m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICECMYK
); | 1354 m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0,
m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICECMYK
); |
| 1357 } else { | 1355 } else { |
| 1358 if (bpc < 8) { | 1356 if (bpc < 8) { |
| 1359 int src_bit_pos = 0; | 1357 int src_bit_pos = 0; |
| 1360 if (src_x % 2) { | 1358 if (src_x % 2) { |
| 1361 src_bit_pos = 4; | 1359 src_bit_pos = 4; |
| 1362 } | 1360 } |
| 1363 int value = (1 << bpc) - 1; | |
| 1364 for (FX_DWORD i = 0; i < m_nComponents; i ++) { | 1361 for (FX_DWORD i = 0; i < m_nComponents; i ++) { |
| 1365 temp[i] = (FX_BYTE)(_GetBits8(pSrcPixel, src_bit
_pos, bpc) * unit_To8Bpc); | 1362 temp[i] = (FX_BYTE)(_GetBits8(pSrcPixel, src_bit
_pos, bpc) * unit_To8Bpc); |
| 1366 src_bit_pos += bpc; | 1363 src_bit_pos += bpc; |
| 1367 } | 1364 } |
| 1368 m_pColorSpace->TranslateImageLine(color, temp, 1, 0,
0, m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICE
CMYK); | 1365 m_pColorSpace->TranslateImageLine(color, temp, 1, 0,
0, m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICE
CMYK); |
| 1369 } else { | 1366 } else { |
| 1370 m_pColorSpace->TranslateImageLine(color, pSrcPixel,
1, 0, 0, m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_D
EVICECMYK); | 1367 m_pColorSpace->TranslateImageLine(color, pSrcPixel,
1, 0, 0, m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_D
EVICECMYK); |
| 1371 } | 1368 } |
| 1372 } | 1369 } |
| 1373 argb = FXARGB_MAKE(0xff, color[2], color[1], color[0]); | 1370 argb = FXARGB_MAKE(0xff, color[2], color[1], color[0]); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 if (!m_bCached) { | 1505 if (!m_bCached) { |
| 1509 if (m_pBitmap) { | 1506 if (m_pBitmap) { |
| 1510 delete m_pBitmap; | 1507 delete m_pBitmap; |
| 1511 m_pBitmap = NULL; | 1508 m_pBitmap = NULL; |
| 1512 } | 1509 } |
| 1513 if (m_pMask) { | 1510 if (m_pMask) { |
| 1514 delete m_pMask; | 1511 delete m_pMask; |
| 1515 } | 1512 } |
| 1516 } | 1513 } |
| 1517 } | 1514 } |
| OLD | NEW |