| 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 uint8_t g_GammaRamp[256] = { | 10 const uint8_t g_GammaRamp[256] = { |
| (...skipping 3956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3967 } | 3967 } |
| 3968 } | 3968 } |
| 3969 } | 3969 } |
| 3970 void CFX_ScanlineCompositor::CompositePalBitmapLine(uint8_t* dest_scan, const ui
nt8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, | 3970 void CFX_ScanlineCompositor::CompositePalBitmapLine(uint8_t* dest_scan, const ui
nt8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, |
| 3971 const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) | 3971 const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) |
| 3972 { | 3972 { |
| 3973 if (m_bRgbByteOrder) { | 3973 if (m_bRgbByteOrder) { |
| 3974 if (m_SrcFormat == FXDIB_1bppRgb) { | 3974 if (m_SrcFormat == FXDIB_1bppRgb) { |
| 3975 if (m_DestFormat == FXDIB_8bppRgb) { | 3975 if (m_DestFormat == FXDIB_8bppRgb) { |
| 3976 return; | 3976 return; |
| 3977 } else if(m_DestFormat == FXDIB_Argb) { | 3977 } |
| 3978 if(m_DestFormat == FXDIB_Argb) { |
| 3978 _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, src_left, width, m_pSrcPalette, clip_scan); | 3979 _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, src_left, width, m_pSrcPalette, clip_scan); |
| 3979 } else { | 3980 } else { |
| 3980 _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, src_left, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); | 3981 _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, src_left, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); |
| 3981 } | 3982 } |
| 3982 } else { | 3983 } else { |
| 3983 if (m_DestFormat == FXDIB_8bppRgb) { | 3984 if (m_DestFormat == FXDIB_8bppRgb) { |
| 3984 return; | 3985 return; |
| 3985 } else if (m_DestFormat == FXDIB_Argb) { | 3986 } |
| 3987 if (m_DestFormat == FXDIB_Argb) { |
| 3986 _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, width, m_pSrcPalette, clip_scan); | 3988 _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, width, m_pSrcPalette, clip_scan); |
| 3987 } else { | 3989 } else { |
| 3988 _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); | 3990 _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); |
| 3989 } | 3991 } |
| 3990 } | 3992 } |
| 3991 return; | 3993 return; |
| 3992 } | 3994 } |
| 3993 if (m_DestFormat == FXDIB_8bppMask) { | 3995 if (m_DestFormat == FXDIB_8bppMask) { |
| 3994 _CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan); | 3996 _CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan); |
| 3995 return; | 3997 return; |
| 3996 } else if ((m_DestFormat & 0xff) == 8) { | 3998 } |
| 3999 if ((m_DestFormat & 0xff) == 8) { |
| 3997 if (m_Transparency & 8) { | 4000 if (m_Transparency & 8) { |
| 3998 if (m_DestFormat & 0x0200) { | 4001 if (m_DestFormat & 0x0200) { |
| 3999 _CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, (cons
t uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha); | 4002 _CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, (cons
t uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha); |
| 4000 } else { | 4003 } else { |
| 4001 _CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, (const
uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan); | 4004 _CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, (const
uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan); |
| 4002 } | 4005 } |
| 4003 } else { | 4006 } else { |
| 4004 if (m_DestFormat & 0x0200) | 4007 if (m_DestFormat & 0x0200) |
| 4005 _CompositeRow_8bppPal2Graya(dest_scan, src_scan, (const uint8_t*
)m_pSrcPalette, width, m_BlendType, clip_scan, | 4008 _CompositeRow_8bppPal2Graya(dest_scan, src_scan, (const uint8_t*
)m_pSrcPalette, width, m_BlendType, clip_scan, |
| 4006 dst_extra_alpha, src_extra_alpha); | 4009 dst_extra_alpha, src_extra_alpha); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4237 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; | 4240 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; |
| 4238 if (src_alpha == 255) { | 4241 if (src_alpha == 255) { |
| 4239 FXSYS_memset(dest_scan, gray, width); | 4242 FXSYS_memset(dest_scan, gray, width); |
| 4240 } else | 4243 } else |
| 4241 for (int col = 0; col < width; col ++) { | 4244 for (int col = 0; col < width; col ++) { |
| 4242 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 4245 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
| 4243 dest_scan ++; | 4246 dest_scan ++; |
| 4244 } | 4247 } |
| 4245 } | 4248 } |
| 4246 return TRUE; | 4249 return TRUE; |
| 4247 } else if (m_bpp == 1) { | 4250 } |
| 4251 if (m_bpp == 1) { |
| 4248 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); | 4252 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); |
| 4249 int left_shift = rect.left % 8; | 4253 int left_shift = rect.left % 8; |
| 4250 int right_shift = rect.right % 8; | 4254 int right_shift = rect.right % 8; |
| 4251 int width = rect.right / 8 - rect.left / 8; | 4255 int width = rect.right / 8 - rect.left / 8; |
| 4252 int index = 0; | 4256 int index = 0; |
| 4253 if (m_pPalette == NULL) { | 4257 if (m_pPalette == NULL) { |
| 4254 index = ((uint8_t)color == 0xff) ? 1 : 0; | 4258 index = ((uint8_t)color == 0xff) ? 1 : 0; |
| 4255 } else { | 4259 } else { |
| 4256 for (int i = 0; i < 2; i ++) | 4260 for (int i = 0; i < 2; i ++) |
| 4257 if (m_pPalette[i] == color) { | 4261 if (m_pPalette[i] == color) { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4547 } | 4551 } |
| 4548 src_alpha_scan = m_pScanlineAlphaV; | 4552 src_alpha_scan = m_pScanlineAlphaV; |
| 4549 dest_alpha_scan = dest_alpha_buf; | 4553 dest_alpha_scan = dest_alpha_buf; |
| 4550 if (dest_alpha_scan) { | 4554 if (dest_alpha_scan) { |
| 4551 for (i = 0; i < m_DestHeight; i ++) { | 4555 for (i = 0; i < m_DestHeight; i ++) { |
| 4552 *dest_alpha_scan = *src_alpha_scan++; | 4556 *dest_alpha_scan = *src_alpha_scan++; |
| 4553 dest_alpha_scan += y_alpha_step; | 4557 dest_alpha_scan += y_alpha_step; |
| 4554 } | 4558 } |
| 4555 } | 4559 } |
| 4556 } | 4560 } |
| OLD | NEW |