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 "core/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/fpdfapi/fpdf_render/render_int.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 27 matching lines...) Expand all Loading... |
38 void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, | 38 void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, |
39 int left, | 39 int left, |
40 int top, | 40 int top, |
41 FX_ARGB mask_argb, | 41 FX_ARGB mask_argb, |
42 int bitmap_alpha, | 42 int bitmap_alpha, |
43 int blend_mode, | 43 int blend_mode, |
44 int Transparency) { | 44 int Transparency) { |
45 if (!pDIBitmap) { | 45 if (!pDIBitmap) { |
46 return; | 46 return; |
47 } | 47 } |
48 FX_BOOL bIsolated = Transparency & PDFTRANS_ISOLATED; | |
49 FX_BOOL bGroup = Transparency & PDFTRANS_GROUP; | |
50 if (blend_mode == FXDIB_BLEND_NORMAL) { | 48 if (blend_mode == FXDIB_BLEND_NORMAL) { |
51 if (!pDIBitmap->IsAlphaMask()) { | 49 if (!pDIBitmap->IsAlphaMask()) { |
52 if (bitmap_alpha < 255) { | 50 if (bitmap_alpha < 255) { |
53 pDIBitmap->MultiplyAlpha(bitmap_alpha); | 51 pDIBitmap->MultiplyAlpha(bitmap_alpha); |
54 } | 52 } |
55 if (m_pDevice->SetDIBits(pDIBitmap, left, top)) { | 53 if (m_pDevice->SetDIBits(pDIBitmap, left, top)) { |
56 return; | 54 return; |
57 } | 55 } |
58 } else { | 56 } else { |
59 uint32_t fill_argb = m_Options.TranslateColor(mask_argb); | 57 uint32_t fill_argb = m_Options.TranslateColor(mask_argb); |
60 if (bitmap_alpha < 255) { | 58 if (bitmap_alpha < 255) { |
61 ((uint8_t*)&fill_argb)[3] = | 59 ((uint8_t*)&fill_argb)[3] = |
62 ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255; | 60 ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255; |
63 } | 61 } |
64 if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) { | 62 if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) { |
65 return; | 63 return; |
66 } | 64 } |
67 } | 65 } |
68 } | 66 } |
69 FX_BOOL bBackAlphaRequired = blend_mode && bIsolated && !m_bDropObjects; | 67 bool bIsolated = !!(Transparency & PDFTRANS_ISOLATED); |
70 FX_BOOL bGetBackGround = | 68 bool bGroup = !!(Transparency & PDFTRANS_GROUP); |
| 69 bool bBackAlphaRequired = blend_mode && bIsolated && !m_bDropObjects; |
| 70 bool bGetBackGround = |
71 ((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) || | 71 ((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) || |
72 (!(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT) && | 72 (!(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT) && |
73 (m_pDevice->GetRenderCaps() & FXRC_GET_BITS) && !bBackAlphaRequired); | 73 (m_pDevice->GetRenderCaps() & FXRC_GET_BITS) && !bBackAlphaRequired); |
74 if (bGetBackGround) { | 74 if (bGetBackGround) { |
75 if (bIsolated || !bGroup) { | 75 if (bIsolated || !bGroup) { |
76 if (pDIBitmap->IsAlphaMask()) { | 76 if (pDIBitmap->IsAlphaMask()) { |
77 return; | 77 return; |
78 } | 78 } |
79 m_pDevice->SetDIBits(pDIBitmap, left, top, blend_mode); | 79 m_pDevice->SetDIBits(pDIBitmap, left, top, blend_mode); |
80 } else { | 80 } else { |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 } else if (pFunc) { | 996 } else if (pFunc) { |
997 int size = dest_pitch * height; | 997 int size = dest_pitch * height; |
998 for (int i = 0; i < size; i++) { | 998 for (int i = 0; i < size; i++) { |
999 dest_buf[i] = transfers[src_buf[i]]; | 999 dest_buf[i] = transfers[src_buf[i]]; |
1000 } | 1000 } |
1001 } else { | 1001 } else { |
1002 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); | 1002 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); |
1003 } | 1003 } |
1004 return pMask.release(); | 1004 return pMask.release(); |
1005 } | 1005 } |
OLD | NEW |