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 _color_sqrt[256] = { | 10 const uint8_t _color_sqrt[256] = { |
(...skipping 3920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3931 } | 3931 } |
3932 } | 3932 } |
3933 } | 3933 } |
3934 void CFX_ScanlineCompositor::CompositePalBitmapLine(uint8_t* dest_scan, const ui
nt8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, | 3934 void CFX_ScanlineCompositor::CompositePalBitmapLine(uint8_t* dest_scan, const ui
nt8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, |
3935 const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) | 3935 const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) |
3936 { | 3936 { |
3937 if (m_bRgbByteOrder) { | 3937 if (m_bRgbByteOrder) { |
3938 if (m_SrcFormat == FXDIB_1bppRgb) { | 3938 if (m_SrcFormat == FXDIB_1bppRgb) { |
3939 if (m_DestFormat == FXDIB_8bppRgb) { | 3939 if (m_DestFormat == FXDIB_8bppRgb) { |
3940 return; | 3940 return; |
3941 } else if(m_DestFormat == FXDIB_Argb) { | 3941 } |
| 3942 if(m_DestFormat == FXDIB_Argb) { |
3942 _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, src_left, width, m_pSrcPalette, clip_scan); | 3943 _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, src_left, width, m_pSrcPalette, clip_scan); |
3943 } else { | 3944 } else { |
3944 _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, src_left, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); | 3945 _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, src_left, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); |
3945 } | 3946 } |
3946 } else { | 3947 } else { |
3947 if (m_DestFormat == FXDIB_8bppRgb) { | 3948 if (m_DestFormat == FXDIB_8bppRgb) { |
3948 return; | 3949 return; |
3949 } else if (m_DestFormat == FXDIB_Argb) { | 3950 } |
| 3951 if (m_DestFormat == FXDIB_Argb) { |
3950 _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, width, m_pSrcPalette, clip_scan); | 3952 _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, width, m_pSrcPalette, clip_scan); |
3951 } else { | 3953 } else { |
3952 _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); | 3954 _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); |
3953 } | 3955 } |
3954 } | 3956 } |
3955 return; | 3957 return; |
3956 } | 3958 } |
3957 if (m_DestFormat == FXDIB_8bppMask) { | 3959 if (m_DestFormat == FXDIB_8bppMask) { |
3958 _CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan); | 3960 _CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan); |
3959 return; | 3961 return; |
3960 } else if ((m_DestFormat & 0xff) == 8) { | 3962 } |
| 3963 if ((m_DestFormat & 0xff) == 8) { |
3961 if (m_Transparency & 8) { | 3964 if (m_Transparency & 8) { |
3962 if (m_DestFormat & 0x0200) { | 3965 if (m_DestFormat & 0x0200) { |
3963 _CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, (cons
t uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha); | 3966 _CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, (cons
t uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha); |
3964 } else { | 3967 } else { |
3965 _CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, (const
uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan); | 3968 _CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, (const
uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan); |
3966 } | 3969 } |
3967 } else { | 3970 } else { |
3968 if (m_DestFormat & 0x0200) | 3971 if (m_DestFormat & 0x0200) |
3969 _CompositeRow_8bppPal2Graya(dest_scan, src_scan, (const uint8_t*
)m_pSrcPalette, width, m_BlendType, clip_scan, | 3972 _CompositeRow_8bppPal2Graya(dest_scan, src_scan, (const uint8_t*
)m_pSrcPalette, width, m_BlendType, clip_scan, |
3970 dst_extra_alpha, src_extra_alpha); | 3973 dst_extra_alpha, src_extra_alpha); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4201 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; | 4204 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; |
4202 if (src_alpha == 255) { | 4205 if (src_alpha == 255) { |
4203 FXSYS_memset(dest_scan, gray, width); | 4206 FXSYS_memset(dest_scan, gray, width); |
4204 } else | 4207 } else |
4205 for (int col = 0; col < width; col ++) { | 4208 for (int col = 0; col < width; col ++) { |
4206 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 4209 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
4207 dest_scan ++; | 4210 dest_scan ++; |
4208 } | 4211 } |
4209 } | 4212 } |
4210 return TRUE; | 4213 return TRUE; |
4211 } else if (m_bpp == 1) { | 4214 } |
| 4215 if (m_bpp == 1) { |
4212 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); | 4216 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); |
4213 int left_shift = rect.left % 8; | 4217 int left_shift = rect.left % 8; |
4214 int right_shift = rect.right % 8; | 4218 int right_shift = rect.right % 8; |
4215 int width = rect.right / 8 - rect.left / 8; | 4219 int width = rect.right / 8 - rect.left / 8; |
4216 int index = 0; | 4220 int index = 0; |
4217 if (m_pPalette == NULL) { | 4221 if (m_pPalette == NULL) { |
4218 index = ((uint8_t)color == 0xff) ? 1 : 0; | 4222 index = ((uint8_t)color == 0xff) ? 1 : 0; |
4219 } else { | 4223 } else { |
4220 for (int i = 0; i < 2; i ++) | 4224 for (int i = 0; i < 2; i ++) |
4221 if (m_pPalette[i] == color) { | 4225 if (m_pPalette[i] == color) { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4511 } | 4515 } |
4512 src_alpha_scan = m_pScanlineAlphaV; | 4516 src_alpha_scan = m_pScanlineAlphaV; |
4513 dest_alpha_scan = dest_alpha_buf; | 4517 dest_alpha_scan = dest_alpha_buf; |
4514 if (dest_alpha_scan) { | 4518 if (dest_alpha_scan) { |
4515 for (i = 0; i < m_DestHeight; i ++) { | 4519 for (i = 0; i < m_DestHeight; i ++) { |
4516 *dest_alpha_scan = *src_alpha_scan++; | 4520 *dest_alpha_scan = *src_alpha_scan++; |
4517 dest_alpha_scan += y_alpha_step; | 4521 dest_alpha_scan += y_alpha_step; |
4518 } | 4522 } |
4519 } | 4523 } |
4520 } | 4524 } |
OLD | NEW |