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 "dib_int.h" | 9 #include "dib_int.h" |
10 const FX_BYTE g_GammaRamp[256] = { | 10 const FX_BYTE g_GammaRamp[256] = { |
(...skipping 4130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4141 pClipMask = pClipRgn->GetMask(); | 4141 pClipMask = pClipRgn->GetMask(); |
4142 clip_box = pClipRgn->GetBox(); | 4142 clip_box = pClipRgn->GetBox(); |
4143 } | 4143 } |
4144 CFX_ScanlineCompositor compositor; | 4144 CFX_ScanlineCompositor compositor; |
4145 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, pSrcBitmap
->GetPalette(), 0, blend_type, | 4145 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, pSrcBitmap
->GetPalette(), 0, blend_type, |
4146 pClipMask != NULL, bRgbByteOrder, 0, pIccTransform)) { | 4146 pClipMask != NULL, bRgbByteOrder, 0, pIccTransform)) { |
4147 return FALSE; | 4147 return FALSE; |
4148 } | 4148 } |
4149 int dest_Bpp = m_bpp / 8; | 4149 int dest_Bpp = m_bpp / 8; |
4150 int src_Bpp = pSrcBitmap->GetBPP() / 8; | 4150 int src_Bpp = pSrcBitmap->GetBPP() / 8; |
4151 FX_BOOL bRgb = FALSE; | 4151 FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); |
4152 FX_BOOL bCmyk = FALSE; | |
4153 if (src_Bpp > 1) { | |
4154 if (pSrcBitmap->IsCmykImage()) { | |
4155 bCmyk = TRUE; | |
4156 } else { | |
4157 bRgb = TRUE; | |
4158 } | |
4159 } | |
4160 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; | 4152 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; |
4161 for (int row = 0; row < height; row ++) { | 4153 for (int row = 0; row < height; row ++) { |
4162 FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left
* dest_Bpp; | 4154 FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left
* dest_Bpp; |
4163 FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left
* src_Bpp; | 4155 FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left
* src_Bpp; |
4164 FX_LPCBYTE src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->GetScan
line(src_top + row) + src_left : NULL; | 4156 FX_LPCBYTE src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->GetScan
line(src_top + row) + src_left : NULL; |
4165 FX_LPBYTE dst_scan_extra_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask-
>GetScanline(dest_top + row) + dest_left : NULL; | 4157 FX_LPBYTE dst_scan_extra_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask-
>GetScanline(dest_top + row) + dest_left : NULL; |
4166 FX_LPCBYTE clip_scan = NULL; | 4158 FX_LPCBYTE clip_scan = NULL; |
4167 if (pClipMask) { | 4159 if (pClipMask) { |
4168 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) *
pClipMask->m_Pitch + (dest_left - clip_box.left); | 4160 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) *
pClipMask->m_Pitch + (dest_left - clip_box.left); |
4169 } | 4161 } |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4592 } | 4584 } |
4593 src_alpha_scan = m_pScanlineAlphaV; | 4585 src_alpha_scan = m_pScanlineAlphaV; |
4594 dest_alpha_scan = dest_alpha_buf; | 4586 dest_alpha_scan = dest_alpha_buf; |
4595 if (dest_alpha_scan) { | 4587 if (dest_alpha_scan) { |
4596 for (i = 0; i < m_DestHeight; i ++) { | 4588 for (i = 0; i < m_DestHeight; i ++) { |
4597 *dest_alpha_scan = *src_alpha_scan++; | 4589 *dest_alpha_scan = *src_alpha_scan++; |
4598 dest_alpha_scan += y_alpha_step; | 4590 dest_alpha_scan += y_alpha_step; |
4599 } | 4591 } |
4600 } | 4592 } |
4601 } | 4593 } |
OLD | NEW |