Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(838)

Side by Side Diff: core/src/fxge/skia/fx_skia_blitter_new.cpp

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/ge/fx_ge_text.cpp ('k') | core/src/fxge/win32/fx_win32_device.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "../../../include/fxge/fx_ge.h" 5 #include "../../../include/fxge/fx_ge.h"
6 //#define _SKIA_SUPPORT_ 6 //#define _SKIA_SUPPORT_
7 #if defined(_SKIA_SUPPORT_) 7 #if defined(_SKIA_SUPPORT_)
8 #include "../../../include/fxcodec/fx_codec.h" 8 #include "../../../include/fxcodec/fx_codec.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "fx_skia_blitter_new.h" 10 #include "fx_skia_blitter_new.h"
11 » // We use our own renderer here to make it simple 11 // We use our own renderer here to make it simple
12 » void CFX_SkiaRenderer::blitAntiH(int x, int y, const SkAlpha antialias[] , const int16_t runs[]) 12 void CFX_SkiaRenderer::blitAntiH(int x, int y, const SkAlpha antialias[], co nst int16_t runs[])
13 » { 13 {
14 » » FXSYS_assert(m_Alpha); 14 FXSYS_assert(m_Alpha);
15 » » if (m_pOriDevice == NULL && composite_span == NULL) return; 15 if (m_pOriDevice == NULL && composite_span == NULL) return;
16 » » if (y < m_ClipBox.top || y >= m_ClipBox.bottom) return; 16 if (y < m_ClipBox.top || y >= m_ClipBox.bottom) return;
17 » » while (1) 17 while (1)
18 » » { 18 {
19 » » » int width = runs[0]; 19 int width = runs[0];
20 » » » SkASSERT(width >= 0); 20 SkASSERT(width >= 0);
21 » » » if (width <= 0) 21 if (width <= 0)
22 » » » » return; 22 return;
23 » » » unsigned aa = antialias[0]; 23 unsigned aa = antialias[0];
24 » » » if (aa) 24 if (aa)
25 » » » » (*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, aa, m_ClipBox.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pD estExtraAlphaScan); 25 (*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, aa, m _ClipBox.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pDestExtraAlphaSca n);
26 » » » runs += width; 26 runs += width;
27 » » » antialias += width; 27 antialias += width;
28 » » » x += width; 28 x += width;
29 » » } 29 }
30 » } 30 }
31 31
32 » void CFX_SkiaRenderer::blitH(int x, int y, int width) 32 void CFX_SkiaRenderer::blitH(int x, int y, int width)
33 » { 33 {
34 » » FXSYS_assert(m_Alpha && width); 34 FXSYS_assert(m_Alpha && width);
35 » » if (y < m_ClipBox.top || y >= m_ClipBox.bottom) return; 35 if (y < m_ClipBox.top || y >= m_ClipBox.bottom) return;
36 » » (*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, 255, m_ClipBox.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pDestExtraAlphaSc an); 36 (*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, 255, m_ClipBo x.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pDestExtraAlphaScan);
37 » } 37 }
38 38
39 » void CFX_SkiaRenderer::blitV(int x, int y, int height, SkAlpha alpha) 39 void CFX_SkiaRenderer::blitV(int x, int y, int height, SkAlpha alpha)
40 » { 40 {
41 » » FXSYS_assert(m_Alpha && alpha); 41 FXSYS_assert(m_Alpha && alpha);
42 » » if (alpha == 255) { 42 if (alpha == 255) {
43 » » » blitRect(x, y, 1, height); 43 blitRect(x, y, 1, height);
44 » » } else { 44 } else {
45 » » » int16_t runs[2]; 45 int16_t runs[2];
46 » » » runs[0] = 1; 46 runs[0] = 1;
47 » » » runs[1] = 0; 47 runs[1] = 0;
48 » » » while (--height >= 0) { 48 while (--height >= 0) {
49 » » » » if (y >= m_ClipBox.bottom) 49 if (y >= m_ClipBox.bottom)
50 » » » » » return; 50 return;
51 » » » » blitAntiH(x, y ++, &alpha, runs); 51 blitAntiH(x, y ++, &alpha, runs);
52 » » » } 52 }
53 » » } 53 }
54 » } 54 }
55 » void CFX_SkiaRenderer::blitRect(int x, int y, int width, int height) 55 void CFX_SkiaRenderer::blitRect(int x, int y, int width, int height)
56 » { 56 {
57 » » FXSYS_assert(m_Alpha && width); 57 FXSYS_assert(m_Alpha && width);
58 » » while (--height >= 0){ 58 while (--height >= 0){
59 » » » if (y >= m_ClipBox.bottom) 59 if (y >= m_ClipBox.bottom)
60 » » » » return; 60 return;
61 » » » blitH(x, y ++, width); 61 blitH(x, y ++, width);
62 » » } 62 }
63 » } 63 }
64 64
65 » void CFX_SkiaRenderer::blitAntiRect(int x, int y, int width, int height, 65 void CFX_SkiaRenderer::blitAntiRect(int x, int y, int width, int height,
66 SkAlpha leftAlpha, SkAlpha rightAlpha) 66 SkAlpha leftAlpha, SkAlpha rightAlpha)
67 { 67 {
68 blitV(x++, y, height, leftAlpha); 68 blitV(x++, y, height, leftAlpha);
69 if (width > 0) { 69 if (width > 0) {
70 blitRect(x, y, width, height); 70 blitRect(x, y, width, height);
71 x += width; 71 x += width;
72 } 72 }
73 blitV(x, y, height, rightAlpha); 73 blitV(x, y, height, rightAlpha);
74 } 74 }
75 /*---------------------------------------------------------------------- -----------------------------*/ 75 /*-------------------------------------------------------------------------- -------------------------*/
76 void CFX_SkiaRenderer::CompositeSpan1bpp_0(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 76 void CFX_SkiaRenderer::CompositeSpan1bpp_0(uint8_t* dest_scan, uint8_t* ori_ scan,int Bpp,
77 int span_left, int span_len, int span_top, uint8_t cover _scan, 77 int span_left, int span_len, int span_top, uint8_t cover_scan,
78 int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 78 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
79 uint8_t* dest_extra_alpha_scan) 79 uint8_t* dest_extra_alpha_scan)
80 { 80 {
81 ASSERT(!m_bRgbByteOrder); 81 ASSERT(!m_bRgbByteOrder);
82 ASSERT(!m_pDevice->IsCmykImage()); 82 ASSERT(!m_pDevice->IsCmykImage());
83 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft/8; 83 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left/8;
84 int col_start = span_left < clip_left ? clip_left - span_left : 0; 84 int col_start = span_left < clip_left ? clip_left - span_left : 0;
85 int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 85 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
86 if (col_end < col_start) return; // do nothing. 86 if (col_end < col_start) return; // do nothing.
87 dest_scan += col_start/8; 87 dest_scan += col_start/8;
88 88
89 int index = 0; 89 int index = 0;
90 if (m_pDevice->GetPalette() == NULL) 90 if (m_pDevice->GetPalette() == NULL)
91 index = ((uint8_t)m_Color == 0xff) ? 1 : 0; 91 index = ((uint8_t)m_Color == 0xff) ? 1 : 0;
92 else { 92 else {
93 for (int i = 0; i < 2; i ++) 93 for (int i = 0; i < 2; i ++)
94 if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) 94 if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color)
95 index = i; 95 index = i;
96 } 96 }
97 uint8_t* dest_scan1 = dest_scan; 97 uint8_t* dest_scan1 = dest_scan;
98 int src_alpha = m_Alpha * cover_scan / 255; 98 int src_alpha = m_Alpha * cover_scan / 255;
99 for (int col = col_start; col < col_end; col ++) { 99 for (int col = col_start; col < col_end; col ++) {
100 if (src_alpha) { 100 if (src_alpha) {
101 if (!index) 101 if (!index)
102 *dest_scan1 &= ~(1 << (7 - (col+span_lef t)%8)); 102 *dest_scan1 &= ~(1 << (7 - (col+span_left)%8));
103 else 103 else
104 *dest_scan1|= 1 << (7 - (col+span_left)% 8); 104 *dest_scan1|= 1 << (7 - (col+span_left)%8);
105 } 105 }
106 dest_scan1 = dest_scan+(span_left%8+col-col_start+1)/8; 106 dest_scan1 = dest_scan+(span_left%8+col-col_start+1)/8;
107 } 107 }
108 } 108 }
109 void CFX_SkiaRenderer::CompositeSpan1bpp_4(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 109 void CFX_SkiaRenderer::CompositeSpan1bpp_4(uint8_t* dest_scan, uint8_t* ori_ scan,int Bpp,
110 int span_left, int span_len, int span_top, uint8_t cover _scan, 110 int span_left, int span_len, int span_top, uint8_t cover_scan,
111 int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 111 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
112 uint8_t* dest_extra_alpha_scan) 112 uint8_t* dest_extra_alpha_scan)
113 { 113 {
114 ASSERT(!m_bRgbByteOrder); 114 ASSERT(!m_bRgbByteOrder);
115 ASSERT(!m_pDevice->IsCmykImage()); 115 ASSERT(!m_pDevice->IsCmykImage());
116 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft/8; 116 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left/8;
117 clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top ) - clip_left + span_left; 117 clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip _left + span_left;
118 int col_start = span_left < clip_left ? clip_left - span_left : 0; 118 int col_start = span_left < clip_left ? clip_left - span_left : 0;
119 int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 119 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
120 if (col_end < col_start) return; // do nothing. 120 if (col_end < col_start) return; // do nothing.
121 dest_scan += col_start/8; 121 dest_scan += col_start/8;
122 122
123 int index = 0; 123 int index = 0;
124 if (m_pDevice->GetPalette() == NULL) 124 if (m_pDevice->GetPalette() == NULL)
125 index = ((uint8_t)m_Color == 0xff) ? 1 : 0; 125 index = ((uint8_t)m_Color == 0xff) ? 1 : 0;
126 else { 126 else {
127 for (int i = 0; i < 2; i ++) 127 for (int i = 0; i < 2; i ++)
128 if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) 128 if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color)
129 index = i; 129 index = i;
130 } 130 }
131 uint8_t* dest_scan1 = dest_scan; 131 uint8_t* dest_scan1 = dest_scan;
132 int src_alpha = m_Alpha * cover_scan / 255; 132 int src_alpha = m_Alpha * cover_scan / 255;
133 for (int col = col_start; col < col_end; col ++) { 133 for (int col = col_start; col < col_end; col ++) {
134 int src_alpha1 = src_alpha * clip_scan[col] / 255; 134 int src_alpha1 = src_alpha * clip_scan[col] / 255;
135 if (src_alpha1) { 135 if (src_alpha1) {
136 if (!index) 136 if (!index)
137 *dest_scan1 &= ~(1 << (7 - (col+span_lef t)%8)); 137 *dest_scan1 &= ~(1 << (7 - (col+span_left)%8));
138 else 138 else
139 *dest_scan1|= 1 << (7 - (col+span_left)% 8); 139 *dest_scan1|= 1 << (7 - (col+span_left)%8);
140 } 140 }
141 dest_scan1 = dest_scan+(span_left%8+col-col_start+1)/8; 141 dest_scan1 = dest_scan+(span_left%8+col-col_start+1)/8;
142 } 142 }
143 } 143 }
144 /*---------------------------------------------------------------------- -------------------------------*/ 144 /*-------------------------------------------------------------------------- ---------------------------*/
145 void CFX_SkiaRenderer::CompositeSpanGray_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 145 void CFX_SkiaRenderer::CompositeSpanGray_2(uint8_t* dest_scan, uint8_t* ori_ scan,int Bpp,
146 int span_left, int span_len, int span_top, uint8_t cover _scan, 146 int span_left, int span_len, int span_top, uint8_t cover_scan,
147 int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 147 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
148 uint8_t* dest_extra_alpha_scan) 148 uint8_t* dest_extra_alpha_scan)
149 { 149 {
150 ASSERT(!m_pDevice->IsCmykImage()); 150 ASSERT(!m_pDevice->IsCmykImage());
151 ASSERT(!m_bRgbByteOrder); 151 ASSERT(!m_bRgbByteOrder);
152 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft; 152 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
153 int col_start = span_left < clip_left ? clip_left - span_left : 0; 153 int col_start = span_left < clip_left ? clip_left - span_left : 0;
154 int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 154 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
155 if (col_end < col_start) return; // do nothing. 155 if (col_end < col_start) return; // do nothing.
156 dest_scan += col_start; 156 dest_scan += col_start;
157 if (cover_scan == 255 && m_Alpha == 255) { 157 if (cover_scan == 255 && m_Alpha == 255) {
158 FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gray, m_Gray, m_Gr ay, m_Gray), col_end - col_start); 158 FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gray, m_Gray, m_Gray, m_Gray), col_end - col_start);
159 return; 159 return;
160 } 160 }
161 int src_alpha = m_Alpha * cover_scan / 255; 161 int src_alpha = m_Alpha * cover_scan / 255;
162 for (int col = col_start; col < col_end; col ++) { 162 for (int col = col_start; col < col_end; col ++) {
163 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_a lpha); 163 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha);
164 dest_scan++; 164 dest_scan++;
165 } 165 }
166 } 166 }
167 void CFX_SkiaRenderer::CompositeSpanGray_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 167 void CFX_SkiaRenderer::CompositeSpanGray_3(uint8_t* dest_scan, uint8_t* ori_ scan,int Bpp,
168 int span_left, int span_len, int span_top, uint8_t cover _scan, 168 int span_left, int span_len, int span_top, uint8_t cover_scan,
169 int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 169 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
170 uint8_t* dest_extra_alpha_scan) 170 uint8_t* dest_extra_alpha_scan)
171 { 171 {
172 ASSERT(!m_pDevice->IsCmykImage()); 172 ASSERT(!m_pDevice->IsCmykImage());
173 ASSERT(!m_bRgbByteOrder); 173 ASSERT(!m_bRgbByteOrder);
174 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft; 174 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
175 ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span _left; 175 ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left;
176 int col_start = span_left < clip_left ? clip_left - span_left : 0; 176 int col_start = span_left < clip_left ? clip_left - span_left : 0;
177 int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 177 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
178 if (col_end < col_start) return; // do nothing. 178 if (col_end < col_start) return; // do nothing.
179 dest_scan += col_start; 179 dest_scan += col_start;
180 ori_scan += col_start; 180 ori_scan += col_start;
181 if (m_Alpha == 255 && cover_scan == 255) { 181 if (m_Alpha == 255 && cover_scan == 255) {
182 FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gray, m_Gray, m_Gr ay, m_Gray), col_end - col_start); 182 FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gray, m_Gray, m_Gray, m_Gray), col_end - col_start);
183 } else { 183 } else {
184 int src_alpha = m_Alpha; 184 int src_alpha = m_Alpha;
185 #if 1 185 #if 1
186 » » » for (int col = col_start; col < col_end; col ++) { 186 for (int col = col_start; col < col_end; col ++) {
187 » » » » int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray , src_alpha); 187 int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
188 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan); 188 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan);
189 » » » » dest_scan ++; 189 dest_scan ++;
190 » » » } 190 }
191 #else 191 #else
192 » » » if (m_bFullCover) { 192 if (m_bFullCover) {
193 » » » » if (src_alpha == 255) { 193 if (src_alpha == 255) {
194 » » » » » FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gr ay, m_Gray, m_Gray, m_Gray), col_end - col_start); 194 FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gray, m_Gray, m_Gray, m_Gray), col_end - col_start);
195 » » » » » return; 195 return;
196 » » » » } 196 }
197 » » » » for (int col = col_start; col < col_end; col ++) 197 for (int col = col_start; col < col_end; col ++)
198 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan ++, m_Gray, src_alpha); 198 *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alph a);
199 » » » } else { 199 } else {
200 » » » » for (int col = col_start; col < col_end; col ++) { 200 for (int col = col_start; col < col_end; col ++) {
201 » » » » » int gray = FXDIB_ALPHA_MERGE(*ori_scan++ , m_Gray, src_alpha); 201 int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha) ;
202 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, gray, cover_scan); 202 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan) ;
203 » » » » » dest_scan++; 203 dest_scan++;
204 » » » » } 204 }
205 » » » } 205 }
206 #endif 206 #endif
207 » » } 207 }
208 » } 208 }
209 209
210 » void CFX_SkiaRenderer::CompositeSpanGray_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 210 void CFX_SkiaRenderer::CompositeSpanGray_6(uint8_t* dest_scan, uint8_t* ori_ scan,int Bpp,
211 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 211 int span_left, int span_len, int span_top, uint8_t cover_scan,
212 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 212 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
213 » » » uint8_t* dest_extra_alpha_scan) 213 uint8_t* dest_extra_alpha_scan)
214 » { 214 {
215 » » ASSERT(!m_bRgbByteOrder); 215 ASSERT(!m_bRgbByteOrder);
216 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft; 216 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
217 » » clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top ) - clip_left + span_left; 217 clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip _left + span_left;
218 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 218 int col_start = span_left < clip_left ? clip_left - span_left : 0;
219 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 219 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
220 » » if (col_end < col_start) return; // do nothing. 220 if (col_end < col_start) return; // do nothing.
221 » » dest_scan += col_start; 221 dest_scan += col_start;
222 » » int src_alpha = m_Alpha * cover_scan / 255; 222 int src_alpha = m_Alpha * cover_scan / 255;
223 » » for (int col = col_start; col < col_end; col ++) { 223 for (int col = col_start; col < col_end; col ++) {
224 » » » int src_alpha1 = src_alpha * clip_scan[col] / 255; 224 int src_alpha1 = src_alpha * clip_scan[col] / 255;
225 » » » if (!src_alpha1) { 225 if (!src_alpha1) {
226 » » » » dest_scan ++; 226 dest_scan ++;
227 » » » » continue; 227 continue;
228 » » » } 228 }
229 » » » if (src_alpha1 == 255) 229 if (src_alpha1 == 255)
230 » » » » *dest_scan++ = m_Gray; 230 *dest_scan++ = m_Gray;
231 » » » else { 231 else {
232 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gra y, src_alpha1); 232 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha1);
233 » » » » dest_scan ++; 233 dest_scan ++;
234 » » » } 234 }
235 » » } 235 }
236 » } 236 }
237 237
238 » void CFX_SkiaRenderer::CompositeSpanGray_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 238 void CFX_SkiaRenderer::CompositeSpanGray_7(uint8_t* dest_scan, uint8_t* ori_ scan,int Bpp,
239 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 239 int span_left, int span_len, int span_top, uint8_t cover_scan,
240 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 240 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
241 » » » uint8_t* dest_extra_alpha_scan) 241 uint8_t* dest_extra_alpha_scan)
242 » { 242 {
243 » » ASSERT(!m_pDevice->IsCmykImage()); 243 ASSERT(!m_pDevice->IsCmykImage());
244 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft; 244 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
245 » » ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span _left; 245 ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left;
246 » » clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top ) - clip_left + span_left; 246 clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip _left + span_left;
247 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 247 int col_start = span_left < clip_left ? clip_left - span_left : 0;
248 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 248 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
249 » » if (col_end < col_start) return; // do nothing. 249 if (col_end < col_start) return; // do nothing.
250 » » dest_scan += col_start; 250 dest_scan += col_start;
251 » » ori_scan += col_start; 251 ori_scan += col_start;
252 #if 1 252 #if 1
253 » » for (int col = col_start; col < col_end; col ++) { 253 for (int col = col_start; col < col_end; col ++) {
254 » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 254 int src_alpha = m_Alpha * clip_scan[col] / 255;
255 » » » if (src_alpha == 255 && cover_scan == 255) { 255 if (src_alpha == 255 && cover_scan == 255) {
256 » » » » *dest_scan++ = m_Gray; 256 *dest_scan++ = m_Gray;
257 » » » » ori_scan++; 257 ori_scan++;
258 » » » » continue; 258 continue;
259 » » » } 259 }
260 » » » int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_al pha); 260 int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
261 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_s can); 261 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan);
262 » » » dest_scan++; 262 dest_scan++;
263 » » } 263 }
264 264
265 #else 265 #else
266 » » if (m_bFullCover) { 266 if (m_bFullCover) {
267 » » » for (int col = col_start; col < col_end; col ++) { 267 for (int col = col_start; col < col_end; col ++) {
268 » » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 268 int src_alpha = m_Alpha * clip_scan[col] / 255;
269 » » » » if (!src_alpha) { 269 if (!src_alpha) {
270 » » » » » dest_scan++; 270 dest_scan++;
271 » » » » » ori_scan++; 271 ori_scan++;
272 » » » » » continue; 272 continue;
273 » » » » } 273 }
274 » » » » if (src_alpha == 255){ 274 if (src_alpha == 255){
275 » » » » » *dest_scan++ = m_Gray; 275 *dest_scan++ = m_Gray;
276 » » » » » ori_scan++; 276 ori_scan++;
277 » » » » » continue; 277 continue;
278 » » » » } 278 }
279 » » » » *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_ Gray, src_alpha); 279 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha) ;
280 » » » } 280 }
281 » » } else { 281 } else {
282 » » » for (int col = col_start; col < col_end; col ++) { 282 for (int col = col_start; col < col_end; col ++) {
283 » » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 283 int src_alpha = m_Alpha * clip_scan[col] / 255;
284 » » » » if (src_alpha == 255 && cover_scan == 255) { 284 if (src_alpha == 255 && cover_scan == 255) {
285 » » » » » *dest_scan++ = m_Gray; 285 *dest_scan++ = m_Gray;
286 » » » » » ori_scan++; 286 ori_scan++;
287 » » » » » continue; 287 continue;
288 » » » » } 288 }
289 » » » » int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray , src_alpha); 289 int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
290 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan); 290 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan);
291 » » » » dest_scan++; 291 dest_scan++;
292 » » » } 292 }
293 » » } 293 }
294 #endif 294 #endif
295 » } 295 }
296 » /*---------------------------------------------------------------------- ----------------------------*/ 296 /*-------------------------------------------------------------------------- ------------------------*/
297 297
298 » void CFX_SkiaRenderer::CompositeSpanARGB_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 298 void CFX_SkiaRenderer::CompositeSpanARGB_2(uint8_t* dest_scan, uint8_t* ori_ scan,int Bpp,
299 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 299 int span_left, int span_len, int span_top, uint8_t cover_scan,
300 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 300 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
301 » » » uint8_t* dest_extra_alpha_scan) 301 uint8_t* dest_extra_alpha_scan)
302 » { 302 {
303 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_l eft<<2); 303 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
304 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 304 int col_start = span_left < clip_left ? clip_left - span_left : 0;
305 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 305 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
306 » » if (col_end < col_start) return; // do nothing. 306 if (col_end < col_start) return; // do nothing.
307 » » dest_scan += col_start<<2; 307 dest_scan += col_start<<2;
308 » » if (m_Alpha == 255 && cover_scan == 255) { 308 if (m_Alpha == 255 && cover_scan == 255) {
309 » » » FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<< 2); 309 FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
310 » » » return; 310 return;
311 » » } 311 }
312 » » int src_alpha; 312 int src_alpha;
313 #if 0 313 #if 0
314 » » if (m_bFullCover) { 314 if (m_bFullCover) {
315 » » » if (m_Alpha == 255) { 315 if (m_Alpha == 255) {
316 » » » » FXSYS_memset(dest_scan, m_Color, (col_end - col_ start)<<2); 316 FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
317 » » » » return; 317 return;
318 » » » } 318 }
319 » » } 319 }
320 » » else 320 else
321 #endif 321 #endif
322 » » » src_alpha = m_Alpha * cover_scan / 255; 322 src_alpha = m_Alpha * cover_scan / 255;
323 » » for (int col = col_start; col < col_end; col ++) { 323 for (int col = col_start; col < col_end; col ++) {
324 » » » // Dest format: Argb 324 // Dest format: Argb
325 » » » // calculate destination alpha (it's union of source and dest alpha) 325 // calculate destination alpha (it's union of source and dest alpha)
326 » » » if (dest_scan[3] == 0) { 326 if (dest_scan[3] == 0) {
327 » » » » dest_scan[3] = src_alpha; 327 dest_scan[3] = src_alpha;
328 » » » » *dest_scan++ = m_Blue; 328 *dest_scan++ = m_Blue;
329 » » » » *dest_scan++ = m_Green; 329 *dest_scan++ = m_Green;
330 » » » » *dest_scan = m_Red; 330 *dest_scan = m_Red;
331 » » » » dest_scan += 2; 331 dest_scan += 2;
332 » » » » continue; 332 continue;
333 » » » } 333 }
334 » » » uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_sca n[3] * src_alpha / 255; 334 uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_a lpha / 255;
335 » » » dest_scan[3] = dest_alpha; 335 dest_scan[3] = dest_alpha;
336 » » » int alpha_ratio = src_alpha*255/dest_alpha; 336 int alpha_ratio = src_alpha*255/dest_alpha;
337 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha _ratio); 337 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
338 » » » dest_scan ++; 338 dest_scan ++;
339 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alph a_ratio); 339 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
340 » » » dest_scan ++; 340 dest_scan ++;
341 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ ratio); 341 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
342 » » » dest_scan += 2; 342 dest_scan += 2;
343 » » } 343 }
344 » } 344 }
345 345
346 » void CFX_SkiaRenderer::CompositeSpanARGB_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 346 void CFX_SkiaRenderer::CompositeSpanARGB_3(uint8_t* dest_scan, uint8_t* ori_ scan,int Bpp,
347 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 347 int span_left, int span_len, int span_top, uint8_t cover_scan,
348 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 348 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
349 » » » uint8_t* dest_extra_alpha_scan) 349 uint8_t* dest_extra_alpha_scan)
350 » { 350 {
351 » » ASSERT(!m_pDevice->IsCmykImage()); 351 ASSERT(!m_pDevice->IsCmykImage());
352 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_l eft<<2); 352 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
353 » » //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (s pan_left<<2); 353 //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left <<2);
354 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 354 int col_start = span_left < clip_left ? clip_left - span_left : 0;
355 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 355 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
356 » » if (col_end < col_start) return; // do nothing. 356 if (col_end < col_start) return; // do nothing.
357 » » dest_scan += col_start << 2; 357 dest_scan += col_start << 2;
358 » » //ori_scan += col_start << 2; 358 //ori_scan += col_start << 2;
359 359
360 » » if (m_Alpha == 255 && cover_scan == 255){ 360 if (m_Alpha == 255 && cover_scan == 255){
361 » » » FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<< 2); 361 FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
362 » » » return; 362 return;
363 » » } 363 }
364 » » if (cover_scan == 255) { 364 if (cover_scan == 255) {
365 » » » int dst_color = (0x00ffffff&m_Color)|(m_Alpha<<24); 365 int dst_color = (0x00ffffff&m_Color)|(m_Alpha<<24);
366 » » » FXSYS_memset(dest_scan, dst_color, (col_end - col_start) <<2); 366 FXSYS_memset(dest_scan, dst_color, (col_end - col_start)<<2);
367 » » » return; 367 return;
368 » » } 368 }
369 » » // Do not need origin bitmap, because of merge in pure transpare nt background 369 // Do not need origin bitmap, because of merge in pure transparent backg round
370 » » int src_alpha_covered = m_Alpha * cover_scan / 255; 370 int src_alpha_covered = m_Alpha * cover_scan / 255;
371 » » for (int col = col_start; col < col_end; col ++) 371 for (int col = col_start; col < col_end; col ++)
372 » » { 372 {
373 » » » // shortcut 373 // shortcut
374 » » » if (dest_scan[3] == 0) { 374 if (dest_scan[3] == 0) {
375 » » » » dest_scan[3] = src_alpha_covered; 375 dest_scan[3] = src_alpha_covered;
376 » » » » *dest_scan ++ = m_Blue; 376 *dest_scan ++ = m_Blue;
377 » » » » *dest_scan ++ = m_Green; 377 *dest_scan ++ = m_Green;
378 » » » » *dest_scan = m_Red; 378 *dest_scan = m_Red;
379 » » » » dest_scan += 2; 379 dest_scan += 2;
380 » » » » continue; 380 continue;
381 » » » } 381 }
382 » » » // We should do alpha transition and color transition 382 // We should do alpha transition and color transition
383 » » » // alpha fg color fg 383 // alpha fg color fg
384 » » » // alpha bg color bg 384 // alpha bg color bg
385 » » » // alpha cover color cover 385 // alpha cover color cover
386 » » » dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], m_Alpha, cover_scan); 386 dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], m_Alpha, cover_scan);
387 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover _scan); 387 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover_scan);
388 » » » dest_scan ++; 388 dest_scan ++;
389 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, cove r_scan); 389 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, cover_scan);
390 » » » dest_scan ++; 390 dest_scan ++;
391 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, cover_ scan); 391 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, cover_scan);
392 » » » dest_scan += 2; 392 dest_scan += 2;
393 » » } 393 }
394 » } 394 }
395 » void CFX_SkiaRenderer::CompositeSpanARGB_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 395 void CFX_SkiaRenderer::CompositeSpanARGB_6(uint8_t* dest_scan, uint8_t* ori_ scan,int Bpp,
396 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 396 int span_left, int span_len, int span_top, uint8_t cover_scan,
397 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 397 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
398 » » » uint8_t* dest_extra_alpha_scan) 398 uint8_t* dest_extra_alpha_scan)
399 » { 399 {
400 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_l eft<<2); 400 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
401 » » clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top ) - clip_left + span_left; 401 clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip _left + span_left;
402 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 402 int col_start = span_left < clip_left ? clip_left - span_left : 0;
403 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 403 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
404 » » if (col_end < col_start) return; // do nothing. 404 if (col_end < col_start) return; // do nothing.
405 » » dest_scan += col_start << 2; 405 dest_scan += col_start << 2;
406 #if 1 406 #if 1
407 » » int src_alpha = m_Alpha * cover_scan / 255; 407 int src_alpha = m_Alpha * cover_scan / 255;
408 » » for (int col = col_start; col < col_end; col ++) { 408 for (int col = col_start; col < col_end; col ++) {
409 » » » int src_alpha1 = src_alpha* clip_scan[col] / 255; 409 int src_alpha1 = src_alpha* clip_scan[col] / 255;
410 » » » if (!src_alpha1) { 410 if (!src_alpha1) {
411 » » » » dest_scan += 4; 411 dest_scan += 4;
412 » » » » continue; 412 continue;
413 » » » } 413 }
414 » » » if (src_alpha1 == 255) { 414 if (src_alpha1 == 255) {
415 » » » » *(FX_DWORD*)dest_scan = m_Color; 415 *(FX_DWORD*)dest_scan = m_Color;
416 » » » » dest_scan += 4; 416 dest_scan += 4;
417 » » » } else { 417 } else {
418 » » » » // Dest format: Argb 418 // Dest format: Argb
419 » » » » // calculate destination alpha (it's union of so urce and dest alpha) 419 // calculate destination alpha (it's union of source and dest al pha)
420 » » » » if (dest_scan[3] == 0) { 420 if (dest_scan[3] == 0) {
421 » » » » » dest_scan[3] = src_alpha1; 421 dest_scan[3] = src_alpha1;
422 » » » » » *dest_scan++ = m_Blue; 422 *dest_scan++ = m_Blue;
423 » » » » » *dest_scan++ = m_Green; 423 *dest_scan++ = m_Green;
424 » » » » » *dest_scan = m_Red; 424 *dest_scan = m_Red;
425 » » » » » dest_scan += 2; 425 dest_scan += 2;
426 » » » » » continue; 426 continue;
427 » » » » } 427 }
428 » » » » uint8_t dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255; 428 uint8_t dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255;
429 » » » » dest_scan[3] = dest_alpha; 429 dest_scan[3] = dest_alpha;
430 » » » » int alpha_ratio = src_alpha1*255/dest_alpha; 430 int alpha_ratio = src_alpha1*255/dest_alpha;
431 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blu e, alpha_ratio); 431 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
432 » » » » dest_scan ++; 432 dest_scan ++;
433 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gre en, alpha_ratio); 433 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio) ;
434 » » » » dest_scan ++; 434 dest_scan ++;
435 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red , alpha_ratio); 435 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
436 » » » » dest_scan += 2; 436 dest_scan += 2;
437 » » » } 437 }
438 » » } 438 }
439 #else 439 #else
440 » » if (m_bFullCover) { 440 if (m_bFullCover) {
441 » » » for (int col = col_start; col < col_end; col ++) { 441 for (int col = col_start; col < col_end; col ++) {
442 » » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 442 int src_alpha = m_Alpha * clip_scan[col] / 255;
443 » » » » if (!src_alpha) { 443 if (!src_alpha) {
444 » » » » » dest_scan += 4; 444 dest_scan += 4;
445 » » » » » continue; 445 continue;
446 » » » » } 446 }
447 » » » » if (src_alpha == 255){ 447 if (src_alpha == 255){
448 » » » » » *(FX_DWORD*)dest_scan = m_Color; 448 *(FX_DWORD*)dest_scan = m_Color;
449 » » » » » dest_scan += 4; 449 dest_scan += 4;
450 » » » » » continue; 450 continue;
451 » » » » } else { 451 } else {
452 » » » » » // Dest format: Argb 452 // Dest format: Argb
453 » » » » » // calculate destination alpha (it's uni on of source and dest alpha) 453 // calculate destination alpha (it's union of source and des t alpha)
454 » » » » » if (dest_scan[3] == 0) { 454 if (dest_scan[3] == 0) {
455 » » » » » » dest_scan[3] = src_alpha; 455 dest_scan[3] = src_alpha;
456 » » » » » » *dest_scan++ = m_Blue; 456 *dest_scan++ = m_Blue;
457 » » » » » » *dest_scan++ = m_Green; 457 *dest_scan++ = m_Green;
458 » » » » » » *dest_scan = m_Red; 458 *dest_scan = m_Red;
459 » » » » » » dest_scan += 2; 459 dest_scan += 2;
460 » » » » » » continue; 460 continue;
461 » » » » » } 461 }
462 » » » » » uint8_t dest_alpha = dest_scan[3] + src_ alpha - dest_scan[3] * src_alpha / 255; 462 uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255;
463 » » » » » dest_scan[3] = dest_alpha; 463 dest_scan[3] = dest_alpha;
464 » » » » » int alpha_ratio = src_alpha*255/dest_alp ha; 464 int alpha_ratio = src_alpha*255/dest_alpha;
465 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Blue, alpha_ratio); 465 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_rat io);
466 » » » » » dest_scan ++; 466 dest_scan ++;
467 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Green, alpha_ratio); 467 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ra tio);
468 » » » » » dest_scan ++; 468 dest_scan ++;
469 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Red, alpha_ratio); 469 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_rati o);
470 » » » » » dest_scan += 2; 470 dest_scan += 2;
471 » » » » } 471 }
472 » » » } 472 }
473 » » } else { 473 } else {
474 » » » int src_alpha = m_Alpha * cover_scan / 255; 474 int src_alpha = m_Alpha * cover_scan / 255;
475 » » » for (int col = col_start; col < col_end; col ++) { 475 for (int col = col_start; col < col_end; col ++) {
476 » » » » int src_alpha1 = src_alpha* clip_scan[col] / 255 ; 476 int src_alpha1 = src_alpha* clip_scan[col] / 255;
477 » » » » if (!src_alpha1) { 477 if (!src_alpha1) {
478 » » » » » dest_scan += 4; 478 dest_scan += 4;
479 » » » » » continue; 479 continue;
480 » » » » } 480 }
481 » » » » if (src_alpha1 == 255) { 481 if (src_alpha1 == 255) {
482 » » » » » *(FX_DWORD*)dest_scan = m_Color; 482 *(FX_DWORD*)dest_scan = m_Color;
483 » » » » » dest_scan += 4; 483 dest_scan += 4;
484 » » » » } else { 484 } else {
485 » » » » » // Dest format: Argb 485 // Dest format: Argb
486 » » » » » // calculate destination alpha (it's uni on of source and dest alpha) 486 // calculate destination alpha (it's union of source and des t alpha)
487 » » » » » if (dest_scan[3] == 0) { 487 if (dest_scan[3] == 0) {
488 » » » » » » dest_scan[3] = src_alpha1; 488 dest_scan[3] = src_alpha1;
489 » » » » » » *dest_scan++ = m_Blue; 489 *dest_scan++ = m_Blue;
490 » » » » » » *dest_scan++ = m_Green; 490 *dest_scan++ = m_Green;
491 » » » » » » *dest_scan = m_Red; 491 *dest_scan = m_Red;
492 » » » » » » dest_scan += 2; 492 dest_scan += 2;
493 » » » » » » continue; 493 continue;
494 » » » » » } 494 }
495 » » » » » uint8_t dest_alpha = dest_scan[3] + src_ alpha1 - dest_scan[3] * src_alpha1 / 255; 495 uint8_t dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3 ] * src_alpha1 / 255;
496 » » » » » dest_scan[3] = dest_alpha; 496 dest_scan[3] = dest_alpha;
497 » » » » » int alpha_ratio = src_alpha1*255/dest_al pha; 497 int alpha_ratio = src_alpha1*255/dest_alpha;
498 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Blue, alpha_ratio); 498 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_rat io);
499 » » » » » dest_scan ++; 499 dest_scan ++;
500 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Green, alpha_ratio); 500 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ra tio);
501 » » » » » dest_scan ++; 501 dest_scan ++;
502 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Red, alpha_ratio); 502 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_rati o);
503 » » » » » dest_scan += 2; 503 dest_scan += 2;
504 » » » » } 504 }
505 » » » } 505 }
506 » » } 506 }
507 #endif 507 #endif
508 » } 508 }
509 509
510 » void CFX_SkiaRenderer::CompositeSpanARGB_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 510 void CFX_SkiaRenderer::CompositeSpanARGB_7(uint8_t* dest_scan, uint8_t* ori_ scan,int Bpp,
511 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 511 int span_left, int span_len, int span_top, uint8_t cover_scan,
512 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 512 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
513 » » » uint8_t* dest_extra_alpha_scan) 513 uint8_t* dest_extra_alpha_scan)
514 » { 514 {
515 » » ASSERT(!m_pDevice->IsCmykImage()); 515 ASSERT(!m_pDevice->IsCmykImage());
516 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_l eft<<2); 516 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
517 » » //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (s pan_left<<2); 517 //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left <<2);
518 » » clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top ) - clip_left + span_left; 518 clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip _left + span_left;
519 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 519 int col_start = span_left < clip_left ? clip_left - span_left : 0;
520 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 520 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
521 » » if (col_end < col_start) return; // do nothing. 521 if (col_end < col_start) return; // do nothing.
522 » » dest_scan += col_start << 2; 522 dest_scan += col_start << 2;
523 » » //ori_scan += col_start << 2; 523 //ori_scan += col_start << 2;
524 » » // Do not need origin bitmap, because of merge in pure transpare nt background 524 // Do not need origin bitmap, because of merge in pure transparent backg round
525 » » for (int col = col_start; col < col_end; col ++) 525 for (int col = col_start; col < col_end; col ++)
526 » » { 526 {
527 » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 527 int src_alpha = m_Alpha * clip_scan[col] / 255;
528 » » » int src_alpha_covered = src_alpha * cover_scan / 255; 528 int src_alpha_covered = src_alpha * cover_scan / 255;
529 » » » // shortcut 529 // shortcut
530 » » » if (src_alpha_covered == 0){ 530 if (src_alpha_covered == 0){
531 » » » » dest_scan += 4; 531 dest_scan += 4;
532 » » » » continue; 532 continue;
533 » » » } 533 }
534 » » » // shortcut 534 // shortcut
535 » » » if (cover_scan == 255 || dest_scan[3] == 0) 535 if (cover_scan == 255 || dest_scan[3] == 0)
536 » » » { 536 {
537 » » » » // origin alpha always zero, just get src alpha 537 // origin alpha always zero, just get src alpha
538 » » » » dest_scan[3] = src_alpha_covered; 538 dest_scan[3] = src_alpha_covered;
539 » » » » *dest_scan ++ = m_Blue; 539 *dest_scan ++ = m_Blue;
540 » » » » *dest_scan ++ = m_Green; 540 *dest_scan ++ = m_Green;
541 » » » » *dest_scan = m_Red; 541 *dest_scan = m_Red;
542 » » » » dest_scan += 2; 542 dest_scan += 2;
543 » » » » continue; 543 continue;
544 » » » } 544 }
545 » » » // We should do alpha transition and color transition 545 // We should do alpha transition and color transition
546 » » » // alpha fg color fg 546 // alpha fg color fg
547 » » » // alpha bg color bg 547 // alpha bg color bg
548 » » » // alpha cover color cover 548 // alpha cover color cover
549 » » » dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], src_alpha , cover_scan); 549 dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], src_alpha, cover_scan );
550 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover _scan); 550 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover_scan);
551 » » » dest_scan ++; 551 dest_scan ++;
552 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, cove r_scan); 552 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, cover_scan);
553 » » » dest_scan ++; 553 dest_scan ++;
554 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, cover_ scan); 554 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, cover_scan);
555 » » » dest_scan += 2; 555 dest_scan += 2;
556 » » } 556 }
557 » } 557 }
558 558
559 » /*---------------------------------------------------------------------- -------------------------------------*/ 559 /*-------------------------------------------------------------------------- ---------------------------------*/
560 » void CFX_SkiaRenderer::CompositeSpanRGB32_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 560 void CFX_SkiaRenderer::CompositeSpanRGB32_2(uint8_t* dest_scan, uint8_t* ori _scan,int Bpp,
561 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 561 int span_left, int span_len, int span_top, uint8_t cover_scan,
562 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 562 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
563 » » » uint8_t* dest_extra_alpha_scan) 563 uint8_t* dest_extra_alpha_scan)
564 » { 564 {
565 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_l eft<<2); 565 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
566 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 566 int col_start = span_left < clip_left ? clip_left - span_left : 0;
567 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 567 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
568 » » if (col_end < col_start) return; // do nothing. 568 if (col_end < col_start) return; // do nothing.
569 » » dest_scan += (col_start << 2); 569 dest_scan += (col_start << 2);
570 » » if (m_Alpha == 255 && cover_scan == 255) { 570 if (m_Alpha == 255 && cover_scan == 255) {
571 » » » FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<< 2); 571 FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
572 » » » return; 572 return;
573 » » } 573 }
574 » » int src_alpha; 574 int src_alpha;
575 #if 0 575 #if 0
576 » » if (m_bFullCover) 576 if (m_bFullCover)
577 » » » src_alpha = m_Alpha; 577 src_alpha = m_Alpha;
578 » » else 578 else
579 #endif 579 #endif
580 » » » src_alpha = m_Alpha * cover_scan / 255; 580 src_alpha = m_Alpha * cover_scan / 255;
581 » » for (int col = col_start; col < col_end; col ++) { 581 for (int col = col_start; col < col_end; col ++) {
582 » » » // Dest format: Rgb32 582 // Dest format: Rgb32
583 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_a lpha); 583 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
584 » » » dest_scan ++; 584 dest_scan ++;
585 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_ alpha); 585 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
586 » » » dest_scan ++; 586 dest_scan ++;
587 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_al pha); 587 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
588 » » » dest_scan += 2; 588 dest_scan += 2;
589 » » } 589 }
590 » } 590 }
591 » void CFX_SkiaRenderer::CompositeSpanRGB32_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 591 void CFX_SkiaRenderer::CompositeSpanRGB32_3(uint8_t* dest_scan, uint8_t* ori _scan,int Bpp,
592 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 592 int span_left, int span_len, int span_top, uint8_t cover_scan,
593 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 593 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
594 » » » uint8_t* dest_extra_alpha_scan) 594 uint8_t* dest_extra_alpha_scan)
595 » { 595 {
596 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_l eft<<2); 596 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
597 » » ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (spa n_left<<2); 597 ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<< 2);
598 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 598 int col_start = span_left < clip_left ? clip_left - span_left : 0;
599 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 599 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
600 » » if (col_end < col_start) return; // do nothing. 600 if (col_end < col_start) return; // do nothing.
601 » » dest_scan += col_start << 2; 601 dest_scan += col_start << 2;
602 » » ori_scan += col_start << 2; 602 ori_scan += col_start << 2;
603 » » if (m_Alpha == 255 && cover_scan == 255) { 603 if (m_Alpha == 255 && cover_scan == 255) {
604 » » » FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<< 2); 604 FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
605 » » » return; 605 return;
606 » » } 606 }
607 » » int src_alpha = m_Alpha; 607 int src_alpha = m_Alpha;
608 » » for (int col = col_start; col < col_end; col ++) { 608 for (int col = col_start; col < col_end; col ++) {
609 #if 0 609 #if 0
610 » » » if (m_bFullCover) { 610 if (m_bFullCover) {
611 » » » » *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_ Blue, src_alpha); 611 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha) ;
612 » » » » *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_ Green, src_alpha); 612 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha );
613 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha); 613 *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
614 » » » » dest_scan += 2; ori_scan += 2; 614 dest_scan += 2; ori_scan += 2;
615 » » » » continue; 615 continue;
616 » » » } 616 }
617 #endif 617 #endif
618 » » » int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha ); 618 int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
619 » » » int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alph a); 619 int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
620 » » » int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha); 620 int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
621 » » » ori_scan += 2; 621 ori_scan += 2;
622 » » » *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_sca n); 622 *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
623 » » » dest_scan ++; 623 dest_scan ++;
624 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan ); 624 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
625 » » » dest_scan ++; 625 dest_scan ++;
626 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan ); 626 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
627 » » » dest_scan += 2; 627 dest_scan += 2;
628 » » } 628 }
629 » } 629 }
630 » void CFX_SkiaRenderer::CompositeSpanRGB32_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 630 void CFX_SkiaRenderer::CompositeSpanRGB32_6(uint8_t* dest_scan, uint8_t* ori _scan,int Bpp,
631 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 631 int span_left, int span_len, int span_top, uint8_t cover_scan,
632 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 632 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
633 » » » uint8_t* dest_extra_alpha_scan) 633 uint8_t* dest_extra_alpha_scan)
634 » { 634 {
635 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_l eft<<2); 635 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
636 » » clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top ) - clip_left + span_left; 636 clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip _left + span_left;
637 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 637 int col_start = span_left < clip_left ? clip_left - span_left : 0;
638 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 638 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
639 » » if (col_end < col_start) return; // do nothing. 639 if (col_end < col_start) return; // do nothing.
640 » » dest_scan += col_start << 2; 640 dest_scan += col_start << 2;
641 #if 1 641 #if 1
642 » » int src_alpha = m_Alpha * cover_scan / 255; 642 int src_alpha = m_Alpha * cover_scan / 255;
643 » » for (int col = col_start; col < col_end; col ++) { 643 for (int col = col_start; col < col_end; col ++) {
644 » » » int src_alpha1 = src_alpha * clip_scan[col] / 255; 644 int src_alpha1 = src_alpha * clip_scan[col] / 255;
645 » » » if (!src_alpha1) { 645 if (!src_alpha1) {
646 » » » » dest_scan += 4; 646 dest_scan += 4;
647 » » » » continue; 647 continue;
648 » » » } 648 }
649 » » » if (src_alpha1 == 255) { 649 if (src_alpha1 == 255) {
650 » » » » *(FX_DWORD*)dest_scan = m_Color; 650 *(FX_DWORD*)dest_scan = m_Color;
651 » » » » dest_scan += 4; 651 dest_scan += 4;
652 » » » } else { 652 } else {
653 » » » » // Dest format: Rgb or Rgb32 653 // Dest format: Rgb or Rgb32
654 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blu e, src_alpha1); 654 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha1);
655 » » » » dest_scan ++; 655 dest_scan ++;
656 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gre en, src_alpha1); 656 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha1);
657 » » » » dest_scan ++; 657 dest_scan ++;
658 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red , src_alpha1); 658 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1);
659 » » » » dest_scan += 2; 659 dest_scan += 2;
660 » » » } 660 }
661 » » } 661 }
662 #else 662 #else
663 » » if (m_bFullCover) { 663 if (m_bFullCover) {
664 » » » for (int col = col_start; col < col_end; col ++) { 664 for (int col = col_start; col < col_end; col ++) {
665 » » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 665 int src_alpha = m_Alpha * clip_scan[col] / 255;
666 » » » » if (!src_alpha) { 666 if (!src_alpha) {
667 » » » » » dest_scan += 4; 667 dest_scan += 4;
668 » » » » » continue; 668 continue;
669 » » » » } 669 }
670 » » » » if (src_alpha == 255) { 670 if (src_alpha == 255) {
671 » » » » » *(FX_DWORD*)dest_scan = m_Color; 671 *(FX_DWORD*)dest_scan = m_Color;
672 » » » » » dest_scan += 4; 672 dest_scan += 4;
673 » » » » } else { 673 } else {
674 » » » » » // Dest format: Rgb or Rgb32 674 // Dest format: Rgb or Rgb32
675 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Blue, src_alpha); 675 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha );
676 » » » » » dest_scan ++; 676 dest_scan ++;
677 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Green, src_alpha); 677 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alph a);
678 » » » » » dest_scan ++; 678 dest_scan ++;
679 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Red, src_alpha); 679 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha) ;
680 » » » » » dest_scan += 2; 680 dest_scan += 2;
681 » » » » } 681 }
682 » » » } 682 }
683 » » } else { 683 } else {
684 » » » // Rgb32 684 // Rgb32
685 » » » int src_alpha = m_Alpha * cover_scan / 255; 685 int src_alpha = m_Alpha * cover_scan / 255;
686 » » » for (int col = col_start; col < col_end; col ++) { 686 for (int col = col_start; col < col_end; col ++) {
687 » » » » int src_alpha1 = src_alpha * clip_scan[col] / 25 5; 687 int src_alpha1 = src_alpha * clip_scan[col] / 255;
688 » » » » if (!src_alpha1) { 688 if (!src_alpha1) {
689 » » » » » dest_scan += 4; 689 dest_scan += 4;
690 » » » » » continue; 690 continue;
691 » » » » } 691 }
692 » » » » if (src_alpha1 == 255) { 692 if (src_alpha1 == 255) {
693 » » » » » *(FX_DWORD*)dest_scan = m_Color; 693 *(FX_DWORD*)dest_scan = m_Color;
694 » » » » » dest_scan += 4; 694 dest_scan += 4;
695 » » » » } else { 695 } else {
696 » » » » » // Dest format: Rgb or Rgb32 696 // Dest format: Rgb or Rgb32
697 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Blue, src_alpha1); 697 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha 1);
698 » » » » » dest_scan ++; 698 dest_scan ++;
699 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Green, src_alpha1); 699 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alph a1);
700 » » » » » dest_scan ++; 700 dest_scan ++;
701 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Red, src_alpha1); 701 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1 );
702 » » » » » dest_scan += 2; 702 dest_scan += 2;
703 » » » » } 703 }
704 » » » } 704 }
705 » » } 705 }
706 #endif 706 #endif
707 » } 707 }
708 » void CFX_SkiaRenderer::CompositeSpanRGB32_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 708 void CFX_SkiaRenderer::CompositeSpanRGB32_7(uint8_t* dest_scan, uint8_t* ori _scan,int Bpp,
709 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 709 int span_left, int span_len, int span_top, uint8_t cover_scan,
710 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 710 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
711 » » » uint8_t* dest_extra_alpha_scan) 711 uint8_t* dest_extra_alpha_scan)
712 » { 712 {
713 » » ASSERT(!m_pDevice->IsCmykImage()); 713 ASSERT(!m_pDevice->IsCmykImage());
714 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_l eft<<2); 714 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
715 » » ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (spa n_left<<2); 715 ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<< 2);
716 » » clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top ) - clip_left + span_left; 716 clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip _left + span_left;
717 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 717 int col_start = span_left < clip_left ? clip_left - span_left : 0;
718 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 718 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
719 » » if (col_end < col_start) return; // do nothing. 719 if (col_end < col_start) return; // do nothing.
720 » » dest_scan += col_start << 2; 720 dest_scan += col_start << 2;
721 » » ori_scan += col_start << 2; 721 ori_scan += col_start << 2;
722 #if 1 722 #if 1
723 » » for (int col = col_start; col < col_end; col ++) { 723 for (int col = col_start; col < col_end; col ++) {
724 » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 724 int src_alpha = m_Alpha * clip_scan[col] / 255;
725 » » » if (src_alpha == 255 && cover_scan == 255) { 725 if (src_alpha == 255 && cover_scan == 255) {
726 » » » » *(FX_DWORD*)dest_scan = m_Color; 726 *(FX_DWORD*)dest_scan = m_Color;
727 » » » » dest_scan += 4; 727 dest_scan += 4;
728 » » » » ori_scan += 4; 728 ori_scan += 4;
729 » » » » continue; 729 continue;
730 » » » } 730 }
731 » » » int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha ); 731 int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
732 » » » int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alph a); 732 int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
733 » » » int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha); 733 int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
734 » » » ori_scan += 2; 734 ori_scan += 2;
735 » » » *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_sca n); 735 *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
736 » » » dest_scan ++; 736 dest_scan ++;
737 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan ); 737 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
738 » » » dest_scan ++; 738 dest_scan ++;
739 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan ); 739 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
740 » » » dest_scan += 2; 740 dest_scan += 2;
741 » » } 741 }
742 #else 742 #else
743 » » if (m_bFullCover) { 743 if (m_bFullCover) {
744 » » » for (int col = col_start; col < col_end; col ++) { 744 for (int col = col_start; col < col_end; col ++) {
745 » » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 745 int src_alpha = m_Alpha * clip_scan[col] / 255;
746 » » » » if (!src_alpha) { 746 if (!src_alpha) {
747 » » » » » *(FX_DWORD*)dest_scan = *(FX_DWORD*)ori_ scan; 747 *(FX_DWORD*)dest_scan = *(FX_DWORD*)ori_scan;
748 » » » » » dest_scan += 4; 748 dest_scan += 4;
749 » » » » » ori_scan += 4; 749 ori_scan += 4;
750 » » » » » continue; 750 continue;
751 » » » » } 751 }
752 » » » » if (src_alpha == 255) { 752 if (src_alpha == 255) {
753 » » » » » *(FX_DWORD*)dest_scan = m_Color; 753 *(FX_DWORD*)dest_scan = m_Color;
754 » » » » » dest_scan += 4; 754 dest_scan += 4;
755 » » » » » ori_scan += 4; 755 ori_scan += 4;
756 » » » » » continue; 756 continue;
757 » » » » } 757 }
758 » » » » *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_ Blue, src_alpha); 758 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha) ;
759 » » » » *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_ Green, src_alpha); 759 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha );
760 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha); 760 *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
761 » » » » dest_scan += 2; ori_scan += 2; 761 dest_scan += 2; ori_scan += 2;
762 » » » } 762 }
763 » » } else { 763 } else {
764 » » » for (int col = col_start; col < col_end; col ++) { 764 for (int col = col_start; col < col_end; col ++) {
765 » » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 765 int src_alpha = m_Alpha * clip_scan[col] / 255;
766 » » » » if (src_alpha == 255 && cover_scan == 255) { 766 if (src_alpha == 255 && cover_scan == 255) {
767 » » » » » *(FX_DWORD*)dest_scan = m_Color; 767 *(FX_DWORD*)dest_scan = m_Color;
768 » » » » » dest_scan += 4; 768 dest_scan += 4;
769 » » » » » ori_scan += 4; 769 ori_scan += 4;
770 » » » » » continue; 770 continue;
771 » » » » } 771 }
772 » » » » int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, s rc_alpha); 772 int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
773 » » » » int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha); 773 int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
774 » » » » int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_ alpha); 774 int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
775 » » » » ori_scan += 2; 775 ori_scan += 2;
776 » » » » *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, c over_scan); 776 *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
777 » » » » dest_scan ++; 777 dest_scan ++;
778 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, co ver_scan); 778 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
779 » » » » dest_scan ++; 779 dest_scan ++;
780 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, co ver_scan); 780 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
781 » » » » dest_scan += 2; 781 dest_scan += 2;
782 » » » } 782 }
783 » » } 783 }
784 #endif 784 #endif
785 » } 785 }
786 » /*---------------------------------------------------------------------- -------------------------------*/ 786 /*-------------------------------------------------------------------------- ---------------------------*/
787 » void CFX_SkiaRenderer::CompositeSpanRGB24_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 787 void CFX_SkiaRenderer::CompositeSpanRGB24_2(uint8_t* dest_scan, uint8_t* ori _scan,int Bpp,
788 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 788 int span_left, int span_len, int span_top, uint8_t cover_scan,
789 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 789 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
790 » » » uint8_t* dest_extra_alpha_scan) 790 uint8_t* dest_extra_alpha_scan)
791 » { 791 {
792 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft + (span_left<<1); 792 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (sp an_left<<1);
793 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 793 int col_start = span_left < clip_left ? clip_left - span_left : 0;
794 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 794 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
795 » » if (col_end < col_start) return; // do nothing. 795 if (col_end < col_start) return; // do nothing.
796 » » dest_scan += (col_start<<1)+col_start; 796 dest_scan += (col_start<<1)+col_start;
797 » » int src_alpha; 797 int src_alpha;
798 #if 0 798 #if 0
799 » » if (m_bFullCover) 799 if (m_bFullCover)
800 » » » src_alpha = m_Alpha; 800 src_alpha = m_Alpha;
801 » » else 801 else
802 #endif 802 #endif
803 » » » src_alpha = m_Alpha * cover_scan / 255; 803 src_alpha = m_Alpha * cover_scan / 255;
804 » » if (src_alpha == 255) { 804 if (src_alpha == 255) {
805 » » » for (int col = col_start; col < col_end; col ++) { 805 for (int col = col_start; col < col_end; col ++) {
806 » » » » *dest_scan++ = m_Blue; 806 *dest_scan++ = m_Blue;
807 » » » » *dest_scan++ = m_Green; 807 *dest_scan++ = m_Green;
808 » » » » *dest_scan++ = m_Red; 808 *dest_scan++ = m_Red;
809 » » » } 809 }
810 » » » return; 810 return;
811 » » } 811 }
812 » » for (int col = col_start; col < col_end; col ++) { 812 for (int col = col_start; col < col_end; col ++) {
813 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_a lpha); 813 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
814 » » » dest_scan ++; 814 dest_scan ++;
815 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_ alpha); 815 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
816 » » » dest_scan ++; 816 dest_scan ++;
817 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_al pha); 817 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
818 » » » dest_scan ++; 818 dest_scan ++;
819 » » } 819 }
820 » } 820 }
821 » void CFX_SkiaRenderer::CompositeSpanRGB24_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 821 void CFX_SkiaRenderer::CompositeSpanRGB24_3(uint8_t* dest_scan, uint8_t* ori _scan,int Bpp,
822 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 822 int span_left, int span_len, int span_top, uint8_t cover_scan,
823 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 823 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
824 » » » uint8_t* dest_extra_alpha_scan) 824 uint8_t* dest_extra_alpha_scan)
825 » { 825 {
826 » » ASSERT(!m_pDevice->IsCmykImage()); 826 ASSERT(!m_pDevice->IsCmykImage());
827 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft + (span_left<<1); 827 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (sp an_left<<1);
828 » » ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span _left + (span_left<<1); 828 ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left + (span_left<<1);
829 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 829 int col_start = span_left < clip_left ? clip_left - span_left : 0;
830 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 830 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
831 » » if (col_end < col_start) return; // do nothing. 831 if (col_end < col_start) return; // do nothing.
832 » » dest_scan += (col_start<<1) + col_start; 832 dest_scan += (col_start<<1) + col_start;
833 » » ori_scan += (col_start<<1) + col_start; 833 ori_scan += (col_start<<1) + col_start;
834 » » if (m_Alpha == 255&&cover_scan == 255) { 834 if (m_Alpha == 255&&cover_scan == 255) {
835 » » » for (int col = col_start; col < col_end; col ++) { 835 for (int col = col_start; col < col_end; col ++) {
836 » » » » *dest_scan ++ = m_Blue; 836 *dest_scan ++ = m_Blue;
837 » » » » *dest_scan ++ = m_Green; 837 *dest_scan ++ = m_Green;
838 » » » » *dest_scan ++ = m_Red; 838 *dest_scan ++ = m_Red;
839 » » » } 839 }
840 » » » return; 840 return;
841 » » } 841 }
842 » » for (int col = col_start; col < col_end; col ++) { 842 for (int col = col_start; col < col_end; col ++) {
843 #if 0 843 #if 0
844 » » » if (m_bFullCover) { 844 if (m_bFullCover) {
845 » » » » *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_ Blue, m_Alpha); 845 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, m_Alpha);
846 » » » » *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_ Green, m_Alpha); 846 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, m_Alpha);
847 » » » » *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_ Red, m_Alpha); 847 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, m_Alpha);
848 » » » » continue; 848 continue;
849 » » » } 849 }
850 #endif 850 #endif
851 » » » int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, m_Alpha); 851 int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, m_Alpha);
852 » » » int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, m_Alpha) ; 852 int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, m_Alpha);
853 » » » int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, m_Alpha); 853 int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, m_Alpha);
854 » » » *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_sca n); 854 *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
855 » » » dest_scan ++; 855 dest_scan ++;
856 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan ); 856 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
857 » » » dest_scan ++; 857 dest_scan ++;
858 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan ); 858 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
859 » » » dest_scan ++; 859 dest_scan ++;
860 » » } 860 }
861 » } 861 }
862 » void CFX_SkiaRenderer::CompositeSpanRGB24_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 862 void CFX_SkiaRenderer::CompositeSpanRGB24_6(uint8_t* dest_scan, uint8_t* ori _scan,int Bpp,
863 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 863 int span_left, int span_len, int span_top, uint8_t cover_scan,
864 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 864 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
865 » » » uint8_t* dest_extra_alpha_scan) 865 uint8_t* dest_extra_alpha_scan)
866 » { 866 {
867 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft+(span_left<<1); 867 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span _left<<1);
868 » » clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top ) - clip_left + span_left; 868 clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip _left + span_left;
869 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 869 int col_start = span_left < clip_left ? clip_left - span_left : 0;
870 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 870 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
871 » » if (col_end < col_start) return; // do nothing. 871 if (col_end < col_start) return; // do nothing.
872 » » dest_scan += col_start + (col_start << 1); 872 dest_scan += col_start + (col_start << 1);
873 #if 1 873 #if 1
874 » » int src_alpha = m_Alpha * cover_scan /255; 874 int src_alpha = m_Alpha * cover_scan /255;
875 » » for (int col = col_start; col < col_end; col ++) { 875 for (int col = col_start; col < col_end; col ++) {
876 » » » int src_alpha1 = src_alpha * clip_scan[col] / 255; 876 int src_alpha1 = src_alpha * clip_scan[col] / 255;
877 » » » if (!src_alpha1) { 877 if (!src_alpha1) {
878 » » » » dest_scan += 3; 878 dest_scan += 3;
879 » » » » continue; 879 continue;
880 » » » } 880 }
881 » » » if (src_alpha1 == 255) { 881 if (src_alpha1 == 255) {
882 » » » » *dest_scan++ = m_Blue; 882 *dest_scan++ = m_Blue;
883 » » » » *dest_scan++ = m_Green; 883 *dest_scan++ = m_Green;
884 » » » » *dest_scan++ = m_Red; 884 *dest_scan++ = m_Red;
885 » » » } else { 885 } else {
886 » » » » // Dest format: Rgb 886 // Dest format: Rgb
887 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blu e, src_alpha1); 887 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha1);
888 » » » » dest_scan ++; 888 dest_scan ++;
889 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gre en, src_alpha1); 889 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha1);
890 » » » » dest_scan ++; 890 dest_scan ++;
891 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red , src_alpha1); 891 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1);
892 » » » » dest_scan ++; 892 dest_scan ++;
893 » » » } 893 }
894 » » } 894 }
895 #else 895 #else
896 » » if (m_bFullCover) { 896 if (m_bFullCover) {
897 » » » for (int col = col_start; col < col_end; col ++) { 897 for (int col = col_start; col < col_end; col ++) {
898 » » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 898 int src_alpha = m_Alpha * clip_scan[col] / 255;
899 » » » » if (!src_alpha) { 899 if (!src_alpha) {
900 » » » » » dest_scan += 3; 900 dest_scan += 3;
901 » » » » » continue; 901 continue;
902 » » » » } 902 }
903 » » » » if (src_alpha == 255) { 903 if (src_alpha == 255) {
904 » » » » » *dest_scan++ = m_Blue; 904 *dest_scan++ = m_Blue;
905 » » » » » *dest_scan++ = m_Green; 905 *dest_scan++ = m_Green;
906 » » » » » *dest_scan++ = m_Red; 906 *dest_scan++ = m_Red;
907 » » » » } else { 907 } else {
908 » » » » » // Dest format: Rgb 908 // Dest format: Rgb
909 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Blue, src_alpha); 909 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha );
910 » » » » » dest_scan ++; 910 dest_scan ++;
911 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Green, src_alpha); 911 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alph a);
912 » » » » » dest_scan ++; 912 dest_scan ++;
913 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Red, src_alpha); 913 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha) ;
914 » » » » » dest_scan ++; 914 dest_scan ++;
915 » » » » } 915 }
916 » » » } 916 }
917 » » } else { 917 } else {
918 » » » int src_alpha = m_Alpha * cover_scan /255; 918 int src_alpha = m_Alpha * cover_scan /255;
919 » » » for (int col = col_start; col < col_end; col ++) { 919 for (int col = col_start; col < col_end; col ++) {
920 » » » » int src_alpha1 = src_alpha * clip_scan[col] / 25 5; 920 int src_alpha1 = src_alpha * clip_scan[col] / 255;
921 » » » » if (!src_alpha1) { 921 if (!src_alpha1) {
922 » » » » » dest_scan += 3; 922 dest_scan += 3;
923 » » » » » continue; 923 continue;
924 » » » » } 924 }
925 » » » » if (src_alpha1 == 255) { 925 if (src_alpha1 == 255) {
926 » » » » » *dest_scan++ = m_Blue; 926 *dest_scan++ = m_Blue;
927 » » » » » *dest_scan++ = m_Green; 927 *dest_scan++ = m_Green;
928 » » » » » *dest_scan++ = m_Red; 928 *dest_scan++ = m_Red;
929 » » » » } else { 929 } else {
930 » » » » » // Dest format: Rgb 930 // Dest format: Rgb
931 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Blue, src_alpha1); 931 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha 1);
932 » » » » » dest_scan ++; 932 dest_scan ++;
933 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Green, src_alpha1); 933 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alph a1);
934 » » » » » dest_scan ++; 934 dest_scan ++;
935 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Red, src_alpha1); 935 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1 );
936 » » » » » dest_scan ++; 936 dest_scan ++;
937 » » » » } 937 }
938 » » » } 938 }
939 » » } 939 }
940 #endif 940 #endif
941 » } 941 }
942 » void CFX_SkiaRenderer::CompositeSpanRGB24_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp, 942 void CFX_SkiaRenderer::CompositeSpanRGB24_7(uint8_t* dest_scan, uint8_t* ori _scan,int Bpp,
943 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 943 int span_left, int span_len, int span_top, uint8_t cover_scan,
944 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 944 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
945 » » » uint8_t* dest_extra_alpha_scan) 945 uint8_t* dest_extra_alpha_scan)
946 » { 946 {
947 » » ASSERT(!m_pDevice->IsCmykImage()); 947 ASSERT(!m_pDevice->IsCmykImage());
948 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft+(span_left<<1); 948 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span _left<<1);
949 » » ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span _left+(span_left<<1); 949 ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left+(s pan_left<<1);
950 » » clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top ) - clip_left + span_left; 950 clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip _left + span_left;
951 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 951 int col_start = span_left < clip_left ? clip_left - span_left : 0;
952 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 952 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
953 » » if (col_end < col_start) return; // do nothing. 953 if (col_end < col_start) return; // do nothing.
954 » » dest_scan += col_start + (col_start<<1); 954 dest_scan += col_start + (col_start<<1);
955 » » ori_scan += col_start + (col_start<<1); 955 ori_scan += col_start + (col_start<<1);
956 #if 1 956 #if 1
957 » » for (int col = col_start; col < col_end; col ++) { 957 for (int col = col_start; col < col_end; col ++) {
958 » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 958 int src_alpha = m_Alpha * clip_scan[col] / 255;
959 » » » if (src_alpha == 255 && cover_scan == 255) { 959 if (src_alpha == 255 && cover_scan == 255) {
960 » » » » *dest_scan++ = m_Blue; 960 *dest_scan++ = m_Blue;
961 » » » » *dest_scan++ = m_Green; 961 *dest_scan++ = m_Green;
962 » » » » *dest_scan++ = m_Red; 962 *dest_scan++ = m_Red;
963 » » » » ori_scan += 3; 963 ori_scan += 3;
964 » » » » continue; 964 continue;
965 » » » } 965 }
966 » » » int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha ); 966 int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
967 » » » int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alph a); 967 int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
968 » » » int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha) ; 968 int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha);
969 » » » *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_sca n); 969 *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
970 » » » dest_scan ++; 970 dest_scan ++;
971 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan ); 971 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
972 » » » dest_scan ++; 972 dest_scan ++;
973 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan ); 973 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
974 » » » dest_scan ++; 974 dest_scan ++;
975 » » } 975 }
976 #else 976 #else
977 » » if (m_bFullCover) { 977 if (m_bFullCover) {
978 » » » for (int col = col_start; col < col_end; col ++) { 978 for (int col = col_start; col < col_end; col ++) {
979 » » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 979 int src_alpha = m_Alpha * clip_scan[col] / 255;
980 » » » » if (!src_alpha){ 980 if (!src_alpha){
981 » » » » » *dest_scan++ = *ori_scan++; 981 *dest_scan++ = *ori_scan++;
982 » » » » » *dest_scan++ = *ori_scan++; 982 *dest_scan++ = *ori_scan++;
983 » » » » » *dest_scan++ = *ori_scan++; 983 *dest_scan++ = *ori_scan++;
984 » » » » » continue; 984 continue;
985 » » » » } 985 }
986 » » » » if (src_alpha == 255){ 986 if (src_alpha == 255){
987 » » » » » *dest_scan++ = m_Blue; 987 *dest_scan++ = m_Blue;
988 » » » » » *dest_scan++ = m_Green; 988 *dest_scan++ = m_Green;
989 » » » » » *dest_scan++ = m_Red; 989 *dest_scan++ = m_Red;
990 » » » » » ori_scan += 3; 990 ori_scan += 3;
991 » » » » » continue; 991 continue;
992 » » » » } 992 }
993 » » » » *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_ Blue, src_alpha); 993 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha) ;
994 » » » » *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_ Green, src_alpha); 994 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha );
995 » » » » *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_ Red, src_alpha); 995 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha);
996 » » » } 996 }
997 » » } else { 997 } else {
998 » » » for (int col = col_start; col < col_end; col ++) { 998 for (int col = col_start; col < col_end; col ++) {
999 » » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 999 int src_alpha = m_Alpha * clip_scan[col] / 255;
1000 » » » » if (src_alpha == 255 && cover_scan == 255) { 1000 if (src_alpha == 255 && cover_scan == 255) {
1001 » » » » » *dest_scan++ = m_Blue; 1001 *dest_scan++ = m_Blue;
1002 » » » » » *dest_scan++ = m_Green; 1002 *dest_scan++ = m_Green;
1003 » » » » » *dest_scan++ = m_Red; 1003 *dest_scan++ = m_Red;
1004 » » » » » ori_scan += 3; 1004 ori_scan += 3;
1005 » » » » » continue; 1005 continue;
1006 » » » » } 1006 }
1007 » » » » int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, s rc_alpha); 1007 int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
1008 » » » » int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha); 1008 int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
1009 » » » » int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, sr c_alpha); 1009 int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha);
1010 » » » » *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, c over_scan); 1010 *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
1011 » » » » dest_scan ++; 1011 dest_scan ++;
1012 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, co ver_scan); 1012 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
1013 » » » » dest_scan ++; 1013 dest_scan ++;
1014 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, co ver_scan); 1014 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
1015 » » » » dest_scan ++; 1015 dest_scan ++;
1016 » » » } 1016 }
1017 » » } 1017 }
1018 #endif 1018 #endif
1019 » } 1019 }
1020 » void CFX_SkiaRenderer::CompositeSpanRGB24_10(uint8_t* dest_scan, uint8_t * ori_scan,int Bpp, 1020 void CFX_SkiaRenderer::CompositeSpanRGB24_10(uint8_t* dest_scan, uint8_t* or i_scan,int Bpp,
1021 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 1021 int span_left, int span_len, int span_top, uint8_t cover_scan,
1022 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 1022 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
1023 » » » uint8_t* dest_extra_alpha_scan) 1023 uint8_t* dest_extra_alpha_scan)
1024 » { 1024 {
1025 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft+(span_left<<1); 1025 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span _left<<1);
1026 » » dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetS canline(span_top)+span_left; 1026 dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetScanline( span_top)+span_left;
1027 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 1027 int col_start = span_left < clip_left ? clip_left - span_left : 0;
1028 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 1028 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
1029 » » if (col_end < col_start) return; // do nothing. 1029 if (col_end < col_start) return; // do nothing.
1030 » » dest_scan += col_start+(col_start<<1); 1030 dest_scan += col_start+(col_start<<1);
1031 #if 1 1031 #if 1
1032 » » if (m_Alpha == 255 && cover_scan == 255) { 1032 if (m_Alpha == 255 && cover_scan == 255) {
1033 » » » for (int col = col_start; col < col_end; col ++) { 1033 for (int col = col_start; col < col_end; col ++) {
1034 » » » » *dest_scan++ = (uint8_t)m_Blue; 1034 *dest_scan++ = (uint8_t)m_Blue;
1035 » » » » *dest_scan++ = (uint8_t)m_Green; 1035 *dest_scan++ = (uint8_t)m_Green;
1036 » » » » *dest_scan++ = (uint8_t)m_Red; 1036 *dest_scan++ = (uint8_t)m_Red;
1037 » » » » *dest_extra_alpha_scan++ = 255; 1037 *dest_extra_alpha_scan++ = 255;
1038 » » » } 1038 }
1039 » » » return; 1039 return;
1040 » » } 1040 }
1041 » » int src_alpha = m_Alpha * cover_scan / 255; 1041 int src_alpha = m_Alpha * cover_scan / 255;
1042 » » for (int col = col_start; col < col_end; col ++) { 1042 for (int col = col_start; col < col_end; col ++) {
1043 » » » // Dest format: Rgba 1043 // Dest format: Rgba
1044 » » » // calculate destination alpha (it's union of source and dest alpha) 1044 // calculate destination alpha (it's union of source and dest alpha)
1045 » » » uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alph a - 1045 uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
1046 » » » » » » » » (*dest_extra_alp ha_scan) * src_alpha / 255; 1046 (*dest_extra_alpha_scan) * src_alpha / 255;
1047 » » » *dest_extra_alpha_scan++ = dest_alpha; 1047 *dest_extra_alpha_scan++ = dest_alpha;
1048 » » » int alpha_ratio = src_alpha*255/dest_alpha; 1048 int alpha_ratio = src_alpha*255/dest_alpha;
1049 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha _ratio); 1049 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
1050 » » » dest_scan ++; 1050 dest_scan ++;
1051 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alph a_ratio); 1051 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
1052 » » » dest_scan ++; 1052 dest_scan ++;
1053 » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ ratio); 1053 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
1054 » » » dest_scan ++; 1054 dest_scan ++;
1055 » » } 1055 }
1056 #else 1056 #else
1057 » » if (m_bFullCover) { 1057 if (m_bFullCover) {
1058 » » » if (m_Alpha == 255) { 1058 if (m_Alpha == 255) {
1059 » » » » for (int col = col_start; col < col_end; col ++) { 1059 for (int col = col_start; col < col_end; col ++) {
1060 » » » » » *dest_scan++ = (uint8_t)m_Blue; 1060 *dest_scan++ = (uint8_t)m_Blue;
1061 » » » » » *dest_scan++ = (uint8_t)m_Green; 1061 *dest_scan++ = (uint8_t)m_Green;
1062 » » » » » *dest_scan++ = (uint8_t)m_Red; 1062 *dest_scan++ = (uint8_t)m_Red;
1063 » » » » » *dest_extra_alpha_scan++ = 255; 1063 *dest_extra_alpha_scan++ = 255;
1064 » » » » } 1064 }
1065 » » » » return; 1065 return;
1066 » » » } 1066 }
1067 » » » for (int col = col_start; col < col_end; col ++) { 1067 for (int col = col_start; col < col_end; col ++) {
1068 » » » » // Dest format: Rgba 1068 // Dest format: Rgba
1069 » » » » // calculate destination alpha (it's union of so urce and dest alpha) 1069 // calculate destination alpha (it's union of source and dest al pha)
1070 » » » » uint8_t dest_alpha = (*dest_extra_alpha_scan) + m_Alpha - 1070 uint8_t dest_alpha = (*dest_extra_alpha_scan) + m_Alpha -
1071 » » » » » » » » » (*dest_e xtra_alpha_scan) * m_Alpha / 255; 1071 (*dest_extra_alpha_scan) * m_Alpha / 255;
1072 » » » » *dest_extra_alpha_scan++ = dest_alpha; 1072 *dest_extra_alpha_scan++ = dest_alpha;
1073 » » » » int alpha_ratio = m_Alpha*255/dest_alpha; 1073 int alpha_ratio = m_Alpha*255/dest_alpha;
1074 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blu e, alpha_ratio); 1074 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
1075 » » » » dest_scan ++; 1075 dest_scan ++;
1076 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gre en, alpha_ratio); 1076 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio) ;
1077 » » » » dest_scan ++; 1077 dest_scan ++;
1078 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red , alpha_ratio); 1078 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
1079 » » » » dest_scan ++; 1079 dest_scan ++;
1080 » » » } 1080 }
1081 » » } else { 1081 } else {
1082 » » » if (m_Alpha == 255 && cover_scan == 255) { 1082 if (m_Alpha == 255 && cover_scan == 255) {
1083 » » » » for (int col = col_start; col < col_end; col ++) { 1083 for (int col = col_start; col < col_end; col ++) {
1084 » » » » » *dest_scan++ = (uint8_t)m_Blue; 1084 *dest_scan++ = (uint8_t)m_Blue;
1085 » » » » » *dest_scan++ = (uint8_t)m_Green; 1085 *dest_scan++ = (uint8_t)m_Green;
1086 » » » » » *dest_scan++ = (uint8_t)m_Red; 1086 *dest_scan++ = (uint8_t)m_Red;
1087 » » » » » *dest_extra_alpha_scan++ = 255; 1087 *dest_extra_alpha_scan++ = 255;
1088 » » » » } 1088 }
1089 » » » » return; 1089 return;
1090 » » » } 1090 }
1091 » » » int src_alpha = m_Alpha * cover_scan / 255; 1091 int src_alpha = m_Alpha * cover_scan / 255;
1092 » » » for (int col = col_start; col < col_end; col ++) { 1092 for (int col = col_start; col < col_end; col ++) {
1093 » » » » // Dest format: Rgba 1093 // Dest format: Rgba
1094 » » » » // calculate destination alpha (it's union of so urce and dest alpha) 1094 // calculate destination alpha (it's union of source and dest al pha)
1095 » » » » uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha - 1095 uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
1096 » » » » » » » » » (*dest_e xtra_alpha_scan) * src_alpha / 255; 1096 (*dest_extra_alpha_scan) * src_alpha / 255;
1097 » » » » *dest_extra_alpha_scan++ = dest_alpha; 1097 *dest_extra_alpha_scan++ = dest_alpha;
1098 » » » » int alpha_ratio = src_alpha*255/dest_alpha; 1098 int alpha_ratio = src_alpha*255/dest_alpha;
1099 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blu e, alpha_ratio); 1099 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
1100 » » » » dest_scan ++; 1100 dest_scan ++;
1101 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gre en, alpha_ratio); 1101 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio) ;
1102 » » » » dest_scan ++; 1102 dest_scan ++;
1103 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red , alpha_ratio); 1103 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
1104 » » » » dest_scan ++; 1104 dest_scan ++;
1105 » » » } 1105 }
1106 » » } 1106 }
1107 #endif 1107 #endif
1108 » } 1108 }
1109 » void CFX_SkiaRenderer::CompositeSpanRGB24_14(uint8_t* dest_scan, uint8_t * ori_scan,int Bpp, 1109 void CFX_SkiaRenderer::CompositeSpanRGB24_14(uint8_t* dest_scan, uint8_t* or i_scan,int Bpp,
1110 » » » int span_left, int span_len, int span_top, uint8_t cover _scan, 1110 int span_left, int span_len, int span_top, uint8_t cover_scan,
1111 » » » int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 1111 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
1112 » » » uint8_t* dest_extra_alpha_scan) 1112 uint8_t* dest_extra_alpha_scan)
1113 » { 1113 {
1114 » » dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_le ft+(span_left<<1); 1114 dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span _left<<1);
1115 » » dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetS canline(span_top)+span_left; 1115 dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetScanline( span_top)+span_left;
1116 » » clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top ) - clip_left + span_left; 1116 clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip _left + span_left;
1117 » » int col_start = span_left < clip_left ? clip_left - span_left : 0; 1117 int col_start = span_left < clip_left ? clip_left - span_left : 0;
1118 » » int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 1118 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
1119 » » if (col_end < col_start) return; // do nothing. 1119 if (col_end < col_start) return; // do nothing.
1120 » » dest_scan += col_start + (col_start << 1); 1120 dest_scan += col_start + (col_start << 1);
1121 #if 1 1121 #if 1
1122 » » int src_alpha = m_Alpha * cover_scan / 255; 1122 int src_alpha = m_Alpha * cover_scan / 255;
1123 » » for (int col = col_start; col < col_end; col ++) { 1123 for (int col = col_start; col < col_end; col ++) {
1124 » » » int src_alpha1 = src_alpha * clip_scan[col] / 255; 1124 int src_alpha1 = src_alpha * clip_scan[col] / 255;
1125 » » » if (!src_alpha1) { 1125 if (!src_alpha1) {
1126 » » » » dest_extra_alpha_scan++; 1126 dest_extra_alpha_scan++;
1127 » » » » dest_scan += 3; 1127 dest_scan += 3;
1128 » » » » continue; 1128 continue;
1129 » » » } 1129 }
1130 » » » if (src_alpha1 == 255) { 1130 if (src_alpha1 == 255) {
1131 » » » » *dest_scan++ = (uint8_t)m_Blue; 1131 *dest_scan++ = (uint8_t)m_Blue;
1132 » » » » *dest_scan++ = (uint8_t)m_Green; 1132 *dest_scan++ = (uint8_t)m_Green;
1133 » » » » *dest_scan++ = (uint8_t)m_Red; 1133 *dest_scan++ = (uint8_t)m_Red;
1134 » » » » *dest_extra_alpha_scan++ = (uint8_t)m_Alpha; 1134 *dest_extra_alpha_scan++ = (uint8_t)m_Alpha;
1135 » » » } else { 1135 } else {
1136 » » » » // Dest format: Rgba 1136 // Dest format: Rgba
1137 » » » » // calculate destination alpha (it's union of so urce and dest alpha) 1137 // calculate destination alpha (it's union of source and dest al pha)
1138 » » » » uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 - 1138 uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 -
1139 » » » » » » » » » (*dest_e xtra_alpha_scan) * src_alpha1 / 255; 1139 (*dest_extra_alpha_scan) * src_alpha1 / 255;
1140 » » » » *dest_extra_alpha_scan++ = dest_alpha; 1140 *dest_extra_alpha_scan++ = dest_alpha;
1141 » » » » int alpha_ratio = src_alpha1*255/dest_alpha; 1141 int alpha_ratio = src_alpha1*255/dest_alpha;
1142 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blu e, alpha_ratio); 1142 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
1143 » » » » dest_scan ++; 1143 dest_scan ++;
1144 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gre en, alpha_ratio); 1144 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio) ;
1145 » » » » dest_scan ++; 1145 dest_scan ++;
1146 » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red , alpha_ratio); 1146 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
1147 » » » » dest_scan ++; 1147 dest_scan ++;
1148 » » » } 1148 }
1149 » » } 1149 }
1150 #else 1150 #else
1151 » » if (m_bFullCover) { 1151 if (m_bFullCover) {
1152 » » » for (int col = col_start; col < col_end; col ++) { 1152 for (int col = col_start; col < col_end; col ++) {
1153 » » » » int src_alpha = m_Alpha * clip_scan[col] / 255; 1153 int src_alpha = m_Alpha * clip_scan[col] / 255;
1154 » » » » if (!src_alpha) { 1154 if (!src_alpha) {
1155 » » » » » dest_extra_alpha_scan++; 1155 dest_extra_alpha_scan++;
1156 » » » » » dest_scan += 3; 1156 dest_scan += 3;
1157 » » » » » continue; 1157 continue;
1158 » » » » } 1158 }
1159 » » » » if (src_alpha == 255) { 1159 if (src_alpha == 255) {
1160 » » » » » *dest_scan++ = (uint8_t)m_Blue; 1160 *dest_scan++ = (uint8_t)m_Blue;
1161 » » » » » *dest_scan++ = (uint8_t)m_Green; 1161 *dest_scan++ = (uint8_t)m_Green;
1162 » » » » » *dest_scan++ = (uint8_t)m_Red; 1162 *dest_scan++ = (uint8_t)m_Red;
1163 » » » » » *dest_extra_alpha_scan++ = (uint8_t)m_Al pha; 1163 *dest_extra_alpha_scan++ = (uint8_t)m_Alpha;
1164 » » » » } else { 1164 } else {
1165 » » » » » // Dest format: Rgba 1165 // Dest format: Rgba
1166 » » » » » // calculate destination alpha (it's uni on of source and dest alpha) 1166 // calculate destination alpha (it's union of source and des t alpha)
1167 » » » » » uint8_t dest_alpha = (*dest_extra_alpha_ scan) + src_alpha - 1167 uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
1168 » » » » » » » » » » (*dest_extra_alpha_scan) * src_alpha / 255; 1168 (*dest_extra_alpha_scan) * src_alpha / 2 55;
1169 » » » » » *dest_extra_alpha_scan++ = dest_alpha; 1169 *dest_extra_alpha_scan++ = dest_alpha;
1170 » » » » » int alpha_ratio = src_alpha*255/dest_alp ha; 1170 int alpha_ratio = src_alpha*255/dest_alpha;
1171 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Blue, alpha_ratio); 1171 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_rat io);
1172 » » » » » dest_scan ++; 1172 dest_scan ++;
1173 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Green, alpha_ratio); 1173 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ra tio);
1174 » » » » » dest_scan ++; 1174 dest_scan ++;
1175 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Red, alpha_ratio); 1175 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_rati o);
1176 » » » » » dest_scan ++; 1176 dest_scan ++;
1177 » » » » } 1177 }
1178 » » » } 1178 }
1179 » » } else { 1179 } else {
1180 » » » int src_alpha = m_Alpha * cover_scan / 255; 1180 int src_alpha = m_Alpha * cover_scan / 255;
1181 » » » for (int col = col_start; col < col_end; col ++) { 1181 for (int col = col_start; col < col_end; col ++) {
1182 » » » » int src_alpha1 = m_Alpha * cover_scan * clip_sca n[col] / 255; 1182 int src_alpha1 = m_Alpha * cover_scan * clip_scan[col] / 255;
1183 » » » » if (!src_alpha1) { 1183 if (!src_alpha1) {
1184 » » » » » dest_extra_alpha_scan++; 1184 dest_extra_alpha_scan++;
1185 » » » » » dest_scan += 3; 1185 dest_scan += 3;
1186 » » » » » continue; 1186 continue;
1187 » » » » } 1187 }
1188 » » » » if (src_alpha1 == 255) { 1188 if (src_alpha1 == 255) {
1189 » » » » » *dest_scan++ = (uint8_t)m_Blue; 1189 *dest_scan++ = (uint8_t)m_Blue;
1190 » » » » » *dest_scan++ = (uint8_t)m_Green; 1190 *dest_scan++ = (uint8_t)m_Green;
1191 » » » » » *dest_scan++ = (uint8_t)m_Red; 1191 *dest_scan++ = (uint8_t)m_Red;
1192 » » » » » *dest_extra_alpha_scan++ = (uint8_t)m_Al pha; 1192 *dest_extra_alpha_scan++ = (uint8_t)m_Alpha;
1193 » » » » } else { 1193 } else {
1194 » » » » » // Dest format: Rgba 1194 // Dest format: Rgba
1195 » » » » » // calculate destination alpha (it's uni on of source and dest alpha) 1195 // calculate destination alpha (it's union of source and des t alpha)
1196 » » » » » uint8_t dest_alpha = (*dest_extra_alpha_ scan) + src_alpha1 - 1196 uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 -
1197 » » » » » » » » » » (*dest_extra_alpha_scan) * src_alpha1 / 255; 1197 (*dest_extra_alpha_scan) * src_alpha1 / 255;
1198 » » » » » *dest_extra_alpha_scan++ = dest_alpha; 1198 *dest_extra_alpha_scan++ = dest_alpha;
1199 » » » » » int alpha_ratio = src_alpha1*255/dest_al pha; 1199 int alpha_ratio = src_alpha1*255/dest_alpha;
1200 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Blue, alpha_ratio); 1200 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_rat io);
1201 » » » » » dest_scan ++; 1201 dest_scan ++;
1202 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Green, alpha_ratio); 1202 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ra tio);
1203 » » » » » dest_scan ++; 1203 dest_scan ++;
1204 » » » » » *dest_scan = FXDIB_ALPHA_MERGE(*dest_sca n, m_Red, alpha_ratio); 1204 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_rati o);
1205 » » » » » dest_scan ++; 1205 dest_scan ++;
1206 » » » » } 1206 }
1207 » » » } 1207 }
1208 » » } 1208 }
1209 #endif 1209 #endif
1210 } 1210 }
1211 /*---------------------------------------------------------------------- -------------------------------*/ 1211 /*-------------------------------------------------------------------------- ---------------------------*/
1212 1212
1213 // A general alpha merge function (with clipping mask). Cmyka/Cmyk devic e. 1213 // A general alpha merge function (with clipping mask). Cmyka/Cmyk device.
1214 void CFX_SkiaRenderer::CompositeSpanCMYK(uint8_t* dest_scan, uint8_t* or i_scan,int Bpp, 1214 void CFX_SkiaRenderer::CompositeSpanCMYK(uint8_t* dest_scan, uint8_t* ori_sc an,int Bpp,
1215 int span_left, int span_len, int span_top, uint8_t cover _scan, 1215 int span_left, int span_len, int span_top, uint8_t cover_scan,
1216 int clip_top, int clip_left, int clip_right, uint8_t* cl ip_scan, 1216 int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
1217 uint8_t* dest_extra_alpha_scan) 1217 uint8_t* dest_extra_alpha_scan)
1218 { 1218 {
1219 ASSERT(!m_bRgbByteOrder); 1219 ASSERT(!m_bRgbByteOrder);
1220 // Cmyk(a) 1220 // Cmyk(a)
1221 int col_start = span_left < clip_left ? clip_left - span_left : 0; 1221 int col_start = span_left < clip_left ? clip_left - span_left : 0;
1222 int col_end = (span_left + span_len) < clip_right ? span_len : ( clip_right - span_left); 1222 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
1223 if (col_end < col_start) return; // do nothing. 1223 if (col_end < col_start) return; // do nothing.
1224 dest_scan += col_start * 4; 1224 dest_scan += col_start * 4;
1225 Bpp; // for avoid compile warning. 1225 Bpp; // for avoid compile warning.
1226 1226
1227 if (dest_extra_alpha_scan) { 1227 if (dest_extra_alpha_scan) {
1228 // CMYKa 1228 // CMYKa
1229 for (int col = col_start; col < col_end; col ++) { 1229 for (int col = col_start; col < col_end; col ++) {
1230 int src_alpha; 1230 int src_alpha;
1231 if (m_bFullCover) { 1231 if (m_bFullCover) {
1232 if (clip_scan) 1232 if (clip_scan)
1233 src_alpha = m_Alpha * clip_scan[ col] / 255; 1233 src_alpha = m_Alpha * clip_scan[col] / 255;
1234 else 1234 else
1235 src_alpha = m_Alpha; 1235 src_alpha = m_Alpha;
1236 } else { 1236 } else {
1237 if (clip_scan) 1237 if (clip_scan)
1238 src_alpha = m_Alpha * cover_scan * clip_scan[col] / 255 / 255; 1238 src_alpha = m_Alpha * cover_scan * clip_scan[col] / 255 / 255;
1239 else 1239 else
1240 src_alpha = m_Alpha * cover_scan / 255; 1240 src_alpha = m_Alpha * cover_scan / 255;
1241 } 1241 }
1242 1242
1243 if (src_alpha) { 1243 if (src_alpha) {
1244 if (src_alpha == 255) { 1244 if (src_alpha == 255) {
1245 *(FX_CMYK*)dest_scan = m_Color; 1245 *(FX_CMYK*)dest_scan = m_Color;
1246 *dest_extra_alpha_scan = (uint8_ t)m_Alpha; 1246 *dest_extra_alpha_scan = (uint8_t)m_Alpha;
1247 } else { 1247 } else {
1248 // Dest format: Cmyka 1248 // Dest format: Cmyka
1249 // calculate destination alpha ( it's union of source and dest alpha) 1249 // calculate destination alpha (it's union of source and dest alpha)
1250 uint8_t dest_alpha = (*dest_extr a_alpha_scan) + src_alpha - 1250 uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alph a -
1251 (*dest_extra_alpha_scan) * src_alpha / 255; 1251 (*dest_extra_alpha_scan) * src_alpha / 255;
1252 *dest_extra_alpha_scan++ = dest_ alpha; 1252 *dest_extra_alpha_scan++ = dest_alpha;
1253 int alpha_ratio = src_alpha*255/ dest_alpha; 1253 int alpha_ratio = src_alpha*255/dest_alpha;
1254 *dest_scan = FXDIB_ALPHA_MERGE(* dest_scan, m_Red, alpha_ratio); 1254 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ ratio);
1255 dest_scan ++; 1255 dest_scan ++;
1256 *dest_scan = FXDIB_ALPHA_MERGE(* dest_scan, m_Green, alpha_ratio); 1256 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alph a_ratio);
1257 dest_scan ++; 1257 dest_scan ++;
1258 *dest_scan = FXDIB_ALPHA_MERGE(* dest_scan, m_Blue, alpha_ratio); 1258 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha _ratio);
1259 dest_scan ++; 1259 dest_scan ++;
1260 *dest_scan = FXDIB_ALPHA_MERGE(* dest_scan, m_Gray, alpha_ratio); 1260 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, alpha _ratio);
1261 dest_scan ++; 1261 dest_scan ++;
1262 continue; 1262 continue;
1263 } 1263 }
1264 } 1264 }
1265 dest_extra_alpha_scan++; 1265 dest_extra_alpha_scan++;
1266 dest_scan += 4; 1266 dest_scan += 4;
1267 } 1267 }
1268 } else { 1268 } else {
1269 // CMYK 1269 // CMYK
1270 for (int col = col_start; col < col_end; col ++) { 1270 for (int col = col_start; col < col_end; col ++) {
1271 int src_alpha; 1271 int src_alpha;
1272 if (clip_scan) 1272 if (clip_scan)
1273 src_alpha = m_Alpha * cover_scan * clip_ scan[col] / 255 / 255; 1273 src_alpha = m_Alpha * cover_scan * clip_scan[col] / 255 / 25 5;
1274 else 1274 else
1275 src_alpha = m_Alpha * cover_scan / 255; 1275 src_alpha = m_Alpha * cover_scan / 255;
1276 1276
1277 if (src_alpha) { 1277 if (src_alpha) {
1278 if (src_alpha == 255) { 1278 if (src_alpha == 255) {
1279 *(FX_CMYK*)dest_scan = m_Color; 1279 *(FX_CMYK*)dest_scan = m_Color;
1280 } else { 1280 } else {
1281 // Dest format: cmyk 1281 // Dest format: cmyk
1282 *dest_scan = FXDIB_ALPHA_MERGE(* dest_scan, m_Red, src_alpha); 1282 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_al pha);
1283 dest_scan ++; 1283 dest_scan ++;
1284 *dest_scan = FXDIB_ALPHA_MERGE(* dest_scan, m_Green, src_alpha); 1284 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_ alpha);
1285 dest_scan ++; 1285 dest_scan ++;
1286 *dest_scan = FXDIB_ALPHA_MERGE(* dest_scan, m_Blue, src_alpha); 1286 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_a lpha);
1287 dest_scan ++; 1287 dest_scan ++;
1288 *dest_scan = FXDIB_ALPHA_MERGE(* dest_scan, m_Gray, src_alpha); 1288 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_a lpha);
1289 dest_scan ++; 1289 dest_scan ++;
1290 continue; 1290 continue;
1291 } 1291 }
1292 } 1292 }
1293 dest_scan += 4; 1293 dest_scan += 4;
1294 } 1294 }
1295 } 1295 }
1296 } 1296 }
1297 1297
1298 1298
1299 1299
1300 //-------------------------------------------------------------------- 1300 //--------------------------------------------------------------------
1301 FX_BOOL CFX_SkiaRenderer::Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOri Device, const CFX_ClipRgn* pClipRgn, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bRgbByteOrder, 1301 FX_BOOL CFX_SkiaRenderer::Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevi ce, const CFX_ClipRgn* pClipRgn, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bRg bByteOrder,
1302 int alpha_flag, void* pIccTransform) //The alpha flag must be fi ll_flag if exist. 1302 int alpha_flag, void* pIccTransform) //The alpha flag must be fill_flag if exist.
1303 { 1303 {
1304 m_pDevice = pDevice; 1304 m_pDevice = pDevice;
1305 m_pClipRgn = pClipRgn; 1305 m_pClipRgn = pClipRgn;
1306 m_bRgbByteOrder = bRgbByteOrder; 1306 m_bRgbByteOrder = bRgbByteOrder;
1307 m_pOriDevice = pOriDevice; 1307 m_pOriDevice = pOriDevice;
1308 m_pDestScan = NULL; 1308 m_pDestScan = NULL;
1309 m_pDestExtraAlphaScan = NULL; 1309 m_pDestExtraAlphaScan = NULL;
1310 m_pOriScan = NULL; 1310 m_pOriScan = NULL;
1311 m_pClipScan = NULL; 1311 m_pClipScan = NULL;
1312 composite_span = NULL; 1312 composite_span = NULL;
1313 if (m_pClipRgn) 1313 if (m_pClipRgn)
1314 m_ClipBox = m_pClipRgn->GetBox(); 1314 m_ClipBox = m_pClipRgn->GetBox();
1315 else { 1315 else {
1316 m_ClipBox.left = m_ClipBox.top = 0; 1316 m_ClipBox.left = m_ClipBox.top = 0;
1317 m_ClipBox.right = m_pDevice->GetWidth(); 1317 m_ClipBox.right = m_pDevice->GetWidth();
1318 m_ClipBox.bottom = m_pDevice->GetHeight(); 1318 m_ClipBox.bottom = m_pDevice->GetHeight();
1319 } 1319 }
1320 m_pClipMask = NULL; 1320 m_pClipMask = NULL;
1321 if (m_pClipRgn && m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) 1321 if (m_pClipRgn && m_pClipRgn->GetType() == CFX_ClipRgn::MaskF)
1322 { 1322 {
1323 m_pClipMask = m_pClipRgn->GetMask(); 1323 m_pClipMask = m_pClipRgn->GetMask();
1324 m_pClipScan = m_pClipMask->GetBuffer(); 1324 m_pClipScan = m_pClipMask->GetBuffer();
1325 } 1325 }
1326 if (m_pDevice->m_pAlphaMask) 1326 if (m_pDevice->m_pAlphaMask)
1327 m_pDestExtraAlphaScan = m_pDevice->m_pAlphaMask->GetBuff er(); 1327 m_pDestExtraAlphaScan = m_pDevice->m_pAlphaMask->GetBuffer();
1328 if (m_pOriDevice) 1328 if (m_pOriDevice)
1329 m_pOriScan = m_pOriDevice->GetBuffer(); 1329 m_pOriScan = m_pOriDevice->GetBuffer();
1330 m_pDestScan = m_pDevice->GetBuffer(); 1330 m_pDestScan = m_pDevice->GetBuffer();
1331 1331
1332 m_bFullCover = bFullCover; 1332 m_bFullCover = bFullCover;
1333 1333
1334 FX_BOOL bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag); 1334 FX_BOOL bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag);
1335 FX_BOOL bDeviceCMYK = pDevice->IsCmykImage(); 1335 FX_BOOL bDeviceCMYK = pDevice->IsCmykImage();
1336 1336
1337 m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARG B_A(color); 1337 m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(colo r);
1338 1338
1339 ICodec_IccModule* pIccModule = NULL; 1339 ICodec_IccModule* pIccModule = NULL;
1340 // No lcms engine, we skip the transform 1340 // No lcms engine, we skip the transform
1341 if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get ()->GetCodecModule()->GetIccModule()) 1341 if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetC odecModule()->GetIccModule())
1342 pIccTransform = NULL; 1342 pIccTransform = NULL;
1343 else 1343 else
1344 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetI ccModule(); 1344 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
1345 1345
1346 if (m_pDevice->GetBPP() == 8) { // Gray(a) device 1346 if (m_pDevice->GetBPP() == 8) { // Gray(a) device
1347 ASSERT(!m_bRgbByteOrder); 1347 ASSERT(!m_bRgbByteOrder);
1348 if (m_pDevice->IsAlphaMask()) { 1348 if (m_pDevice->IsAlphaMask()) {
1349 //Alpha Mask 1349 //Alpha Mask
1350 m_Gray = 255; 1350 m_Gray = 255;
1351 } else { 1351 } else {
1352 //Gray(a) device 1352 //Gray(a) device
1353 if (pIccTransform) { 1353 if (pIccTransform) {
1354 uint8_t gray; 1354 uint8_t gray;
1355 color = bObjectCMYK ? FXCMYK_TODIB(color ) : FXARGB_TODIB(color); 1355 color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(col or);
1356 pIccModule->TranslateScanline(pIccTransf orm, &gray, (const uint8_t*)&color, 1); 1356 pIccModule->TranslateScanline(pIccTransform, &gray, (const u int8_t*)&color, 1);
1357 m_Gray = gray; 1357 m_Gray = gray;
1358 } else { 1358 } else {
1359 if (bObjectCMYK) { 1359 if (bObjectCMYK) {
1360 uint8_t r, g, b; 1360 uint8_t r, g, b;
1361 AdobeCMYK_to_sRGB1(FXSYS_GetCVal ue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color ), 1361 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMVal ue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color),
1362 r, g, b); 1362 r, g, b);
1363 m_Gray = FXRGB2GRAY(r, g, b); 1363 m_Gray = FXRGB2GRAY(r, g, b);
1364 } else { 1364 } else {
1365 m_Gray = FXRGB2GRAY(FXARGB_R(col or), FXARGB_G(color), FXARGB_B(color)); 1365 m_Gray = FXRGB2GRAY(FXARGB_R(color), FXARGB_G(color), FX ARGB_B(color));
1366 } 1366 }
1367 } 1367 }
1368 } 1368 }
1369 } else { 1369 } else {
1370 if (bDeviceCMYK) { // Cmyk(a) Device 1370 if (bDeviceCMYK) { // Cmyk(a) Device
1371 ASSERT(!m_bRgbByteOrder); 1371 ASSERT(!m_bRgbByteOrder);
1372 //TODO... opt for cmyk 1372 //TODO... opt for cmyk
1373 composite_span = &CFX_SkiaRenderer::CompositeSpa nCMYK; 1373 composite_span = &CFX_SkiaRenderer::CompositeSpanCMYK;
1374 if (bObjectCMYK) { 1374 if (bObjectCMYK) {
1375 m_Color = FXCMYK_TODIB(color); 1375 m_Color = FXCMYK_TODIB(color);
1376 if (pIccTransform) 1376 if (pIccTransform)
1377 pIccModule->TranslateScanline(pI ccTransform, (uint8_t*)&m_Color, (const uint8_t*)&m_Color, 1); 1377 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)& m_Color, (const uint8_t*)&m_Color, 1);
1378 } else { // Object RGB 1378 } else { // Object RGB
1379 if (!pIccTransform) 1379 if (!pIccTransform)
1380 return FALSE; 1380 return FALSE;
1381 color = FXARGB_TODIB(color); 1381 color = FXARGB_TODIB(color);
1382 pIccModule->TranslateScanline(pIccTransf orm, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); 1382 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Co lor, (const uint8_t*)&color, 1);
1383 } 1383 }
1384 m_Red = ((uint8_t*)&m_Color)[0]; 1384 m_Red = ((uint8_t*)&m_Color)[0];
1385 m_Green = ((uint8_t*)&m_Color)[1]; 1385 m_Green = ((uint8_t*)&m_Color)[1];
1386 m_Blue = ((uint8_t*)&m_Color)[2]; 1386 m_Blue = ((uint8_t*)&m_Color)[2];
1387 m_Gray = ((uint8_t*)&m_Color)[3]; 1387 m_Gray = ((uint8_t*)&m_Color)[3];
1388 return TRUE; 1388 return TRUE;
1389 } else { 1389 }
1390 if (pIccTransform) { 1390 if (pIccTransform) {
1391 color = bObjectCMYK ? FXCMYK_TODIB(color ) : FXARGB_TODIB(color); 1391 color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
1392 pIccModule->TranslateScanline(pIccTransf orm, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); 1392 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1);
1393 ((uint8_t*)&m_Color)[3] = m_Alpha; 1393 ((uint8_t*)&m_Color)[3] = m_Alpha;
1394 m_Red = ((uint8_t*)&m_Color)[2]; 1394 m_Red = ((uint8_t*)&m_Color)[2];
1395 m_Green = ((uint8_t*)&m_Color)[1]; 1395 m_Green = ((uint8_t*)&m_Color)[1];
1396 m_Blue = ((uint8_t*)&m_Color)[0]; 1396 m_Blue = ((uint8_t*)&m_Color)[0];
1397 // Need Johnson to improvement it. 1397 // Need Johnson to improvement it.
1398 if (m_bRgbByteOrder) { 1398 if (m_bRgbByteOrder) {
1399 // swap 1399 // swap
1400 m_Red = ((uint8_t*)&m_Color)[0]; 1400 m_Red = ((uint8_t*)&m_Color)[0];
1401 m_Blue = ((uint8_t*)&m_Color)[2] ; 1401 m_Blue = ((uint8_t*)&m_Color)[2];
1402 m_Color = FXARGB_TODIB(m_Color); 1402 m_Color = FXARGB_TODIB(m_Color);
1403 m_Color = FXARGB_TOBGRORDERDIB(m _Color); 1403 m_Color = FXARGB_TOBGRORDERDIB(m_Color);
1404 } 1404 }
1405 } else { 1405 } else {
1406 if (bObjectCMYK) { 1406 if (bObjectCMYK) {
1407 uint8_t r, g, b; 1407 uint8_t r, g, b;
1408 AdobeCMYK_to_sRGB1(FXSYS_GetCVal ue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color ), 1408 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(c olor), FXSYS_GetYValue(color), FXSYS_GetKValue(color),
1409 r, g, b); 1409 r, g, b);
1410 m_Color = FXARGB_MAKE(m_Alpha, r , g, b); 1410 m_Color = FXARGB_MAKE(m_Alpha, r, g, b);
1411 if (m_bRgbByteOrder){ 1411 if (m_bRgbByteOrder){
1412 m_Color = FXARGB_TOBGROR DERDIB(m_Color); 1412 m_Color = FXARGB_TOBGRORDERDIB(m_Color);
1413 m_Red = b; m_Green = g; m_Blue = r;// 1413 m_Red = b; m_Green = g; m_Blue = r;//
1414 }else { 1414 }else {
1415 m_Color = FXARGB_TODIB(m _Color); 1415 m_Color = FXARGB_TODIB(m_Color);
1416 m_Red = r; m_Green = g; m_Blue = b;// 1416 m_Red = r; m_Green = g; m_Blue = b;//
1417 } 1417 }
1418 } else { 1418 } else {
1419 if (m_bRgbByteOrder){ 1419 if (m_bRgbByteOrder){
1420 m_Color = FXARGB_TOBGROR DERDIB(color); 1420 m_Color = FXARGB_TOBGRORDERDIB(color);
1421 ArgbDecode(color, m_Alph a, m_Blue, m_Green, m_Red); // 1421 ArgbDecode(color, m_Alpha, m_Blue, m_Green, m_Red); //
1422 }else { 1422 }else {
1423 m_Color = FXARGB_TODIB(c olor); 1423 m_Color = FXARGB_TODIB(color);
1424 ArgbDecode(color, m_Alph a, m_Red, m_Green, m_Blue); 1424 ArgbDecode(color, m_Alpha, m_Red, m_Green, m_Blue);
1425 } 1425 }
1426 } 1426 }
1427 } 1427 }
1428 } 1428 }
1429 } 1429 // Get palette transparency selector
1430 // Get palette transparency selector 1430 m_ProcessFilter = (m_pOriDevice? 1 : 0) /* has Ori Device flag */
1431 m_ProcessFilter = (m_pOriDevice? 1 : 0) /* has Ori Device flag * / 1431 + (m_pDevice->GetBPP() >= 8 ? 2 : 0) /* bpp flag */
1432 + (m_pDevice->GetBPP() >= 8 ? 2 : 0) /* bpp flag */ 1432 + (m_pClipMask? 4 : 0) /* has clip regi on flag */
1433 + (m_pClipMask? 4 : 0) /* has clip region flag */ 1433 + (m_pDevice->m_pAlphaMask? 8 : 0); /* has Alpha Mas k chanel flag */
1434 + (m_pDevice->m_pAlphaMask? 8 : 0); /* has Alpha Mask chanel flag */ 1434 switch(m_ProcessFilter) {
1435 switch(m_ProcessFilter) { 1435 case 0:
1436 case 0: 1436 composite_span = &CFX_SkiaRenderer::CompositeSpan1bpp_0;
1437 composite_span = &CFX_SkiaRenderer::CompositeSpa n1bpp_0; 1437 break;
1438 break; 1438 case 2:
1439 case 2: 1439 {
1440 { 1440 if (m_pDevice->GetBPP() == 8)
1441 if (m_pDevice->GetBPP() == 8) 1441 composite_span = &CFX_SkiaRenderer::CompositeSpanGray_2;
1442 composite_span = &CFX_SkiaRender er::CompositeSpanGray_2; 1442 else if (m_pDevice->GetBPP() == 24)
1443 else if (m_pDevice->GetBPP() == 24) 1443 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_2 ;
1444 composite_span = &CFX_SkiaRender er::CompositeSpanRGB24_2; 1444 else
1445 else 1445 composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer ::CompositeSpanARGB_2 : &CFX_SkiaRenderer::CompositeSpanRGB32_2;
1446 composite_span = m_pDevice->HasA lpha()?&CFX_SkiaRenderer::CompositeSpanARGB_2 : &CFX_SkiaRenderer::CompositeSpan RGB32_2; 1446 }
1447 } 1447 break;
1448 break; 1448 case 3:
1449 case 3: 1449 {
1450 { 1450 if (m_pDevice->GetBPP() == 8)
1451 if (m_pDevice->GetBPP() == 8) 1451 composite_span = &CFX_SkiaRenderer::CompositeSpanGray_3;
1452 composite_span = &CFX_SkiaRender er::CompositeSpanGray_3; 1452 else if (m_pDevice->GetBPP() == 24)
1453 else if (m_pDevice->GetBPP() == 24) 1453 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_3 ;
1454 composite_span = &CFX_SkiaRender er::CompositeSpanRGB24_3; 1454 else
1455 else 1455 composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer ::CompositeSpanARGB_3 : &CFX_SkiaRenderer::CompositeSpanRGB32_3;
1456 composite_span = m_pDevice->HasA lpha()?&CFX_SkiaRenderer::CompositeSpanARGB_3 : &CFX_SkiaRenderer::CompositeSpan RGB32_3; 1456 }
1457 } 1457 break;
1458 break; 1458 case 4:
1459 case 4: 1459 composite_span = &CFX_SkiaRenderer::CompositeSpan1bpp_4;
1460 composite_span = &CFX_SkiaRenderer::CompositeSpa n1bpp_4; 1460 break;
1461 break; 1461 case 6:
1462 case 6: 1462 {
1463 { 1463 if (m_pDevice->GetBPP() == 8)
1464 if (m_pDevice->GetBPP() == 8) 1464 composite_span = &CFX_SkiaRenderer::CompositeSpanGray_6;
1465 composite_span = &CFX_SkiaRender er::CompositeSpanGray_6; 1465 else if (m_pDevice->GetBPP() == 24)
1466 else if (m_pDevice->GetBPP() == 24) 1466 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_6 ;
1467 composite_span = &CFX_SkiaRender er::CompositeSpanRGB24_6; 1467 else
1468 else 1468 composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer ::CompositeSpanARGB_6 : &CFX_SkiaRenderer::CompositeSpanRGB32_6;
1469 composite_span = m_pDevice->HasA lpha()?&CFX_SkiaRenderer::CompositeSpanARGB_6 : &CFX_SkiaRenderer::CompositeSpan RGB32_6; 1469 }
1470 } 1470 break;
1471 break; 1471 case 7:
1472 case 7: 1472 {
1473 { 1473 if (m_pDevice->GetBPP() == 8)
1474 if (m_pDevice->GetBPP() == 8) 1474 composite_span = &CFX_SkiaRenderer::CompositeSpanGray_7;
1475 composite_span = &CFX_SkiaRender er::CompositeSpanGray_7; 1475 else if (m_pDevice->GetBPP() == 24)
1476 else if (m_pDevice->GetBPP() == 24) 1476 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_7 ;
1477 composite_span = &CFX_SkiaRender er::CompositeSpanRGB24_7; 1477 else
1478 else 1478 composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer ::CompositeSpanARGB_7 : &CFX_SkiaRenderer::CompositeSpanRGB32_7;
1479 composite_span = m_pDevice->HasA lpha()?&CFX_SkiaRenderer::CompositeSpanARGB_7 : &CFX_SkiaRenderer::CompositeSpan RGB32_7; 1479 }
1480 } 1480 break;
1481 break; 1481 case 1:
1482 case 1: 1482 case 5:
1483 case 5: 1483 case 8:
1484 case 8: 1484 case 9:
1485 case 9: 1485 case 11:
1486 case 11: 1486 case 12:
1487 case 12: 1487 case 13:
1488 case 13: 1488 case 15:
1489 case 15: 1489 //TODO...
1490 //TODO... 1490 break;
1491 break; 1491 case 10:
1492 case 10: 1492 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_10;
1493 composite_span = &CFX_SkiaRenderer::CompositeSpa nRGB24_10; 1493 break;
1494 break; 1494 case 14:
1495 case 14: 1495 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_14;
1496 composite_span = &CFX_SkiaRenderer::CompositeSpa nRGB24_14; 1496 break;
1497 break; 1497 }
1498 } 1498 if (composite_span == NULL)
1499 if (composite_span == NULL) 1499 return FALSE;
1500 return FALSE; 1500 return TRUE;
1501 return TRUE; 1501 }
1502 } 1502
1503 1503 /*-------------------------------------------------------------------------- --------------------------*/
1504 /*---------------------------------------------------------------------- ------------------------------*/ 1504 void CFX_SkiaA8Renderer::blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[])
1505 void CFX_SkiaA8Renderer::blitAntiH(int x, int y, const SkAlpha antialias [], const int16_t runs[]) 1505 {
1506 { 1506 FXSYS_assert(m_pDevice);
1507 FXSYS_assert(m_pDevice); 1507 int dst_y = y - m_Top;
1508 int dst_y = y - m_Top; 1508 if (dst_y < 0 || dst_y >= m_pDevice->GetHeight())
1509 if (dst_y < 0 || dst_y >= m_pDevice->GetHeight()) 1509 return;
1510 return; 1510
1511 1511 uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * ds t_y;
1512 uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitc h() * dst_y; 1512 uint8_t* dest_pos = dest_scan;
1513 uint8_t* dest_pos = dest_scan; 1513 while (1)
1514 while (1) 1514 {
1515 { 1515 if (x >= m_dstWidth)
1516 if (x >= m_dstWidth) 1516 return;
1517 return; 1517 int width = runs[0];
1518 int width = runs[0]; 1518 SkASSERT(width >= 0);
1519 SkASSERT(width >= 0); 1519 if (width <= 0)
1520 if (width <= 0) 1520 return;
1521 return; 1521 unsigned aa = antialias[0];
1522 unsigned aa = antialias[0]; 1522 if (aa) {
1523 if (aa) { 1523 int col_start = x < m_Left ? 0 : x - m_Left;
1524 int col_start = x < m_Left ? 0 : x - m_Left; 1524 int col_end = x + width;
1525 int col_end = x + width; 1525 col_end = col_end < m_dstWidth ? col_end - m_Left: m_pDevice->Ge tWidth();
1526 col_end = col_end < m_dstWidth ? col_end - m_Lef t: m_pDevice->GetWidth(); 1526 int result = col_end - col_start;
1527 int result = col_end - col_start; 1527 if (result > 0) {
1528 if (result > 0) { 1528 dest_pos = dest_scan + col_start;
1529 dest_pos = dest_scan + col_start; 1529 if (result >= 4)
1530 if (result >= 4) 1530 FXSYS_memset(dest_pos, FXARGB_MAKE(aa, aa, aa, aa),resul t);
1531 FXSYS_memset(dest_pos, FXARGB_MA KE(aa, aa, aa, aa),result); 1531 else
1532 else 1532 FXSYS_memset(dest_pos,aa,result);
1533 FXSYS_memset(dest_pos,aa,result) ; 1533 }
1534 } 1534 }
1535 } 1535 runs += width;
1536 runs += width; 1536 antialias += width;
1537 antialias += width; 1537 x += width;
1538 x += width; 1538 }
1539 } 1539 }
1540 } 1540 void CFX_SkiaA8Renderer::blitH(int x, int y, int width)
1541 void CFX_SkiaA8Renderer::blitH(int x, int y, int width) 1541 {
1542 { 1542 FXSYS_assert(m_pDevice);
1543 FXSYS_assert(m_pDevice); 1543 int dst_y = y - m_Top;
1544 int dst_y = y - m_Top; 1544 if (dst_y < 0 || dst_y >= m_pDevice->GetHeight())
1545 if (dst_y < 0 || dst_y >= m_pDevice->GetHeight()) 1545 return;
1546 return; 1546 if (x >= m_dstWidth)
1547 if (x >= m_dstWidth) 1547 return;
1548 return; 1548 uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * ds t_y;
1549 uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitc h() * dst_y; 1549 int col_start = x < m_Left ? 0 : x - m_Left;
1550 int col_start = x < m_Left ? 0 : x - m_Left; 1550 int col_end = x + width;
1551 int col_end = x + width; 1551 col_end = col_end < m_dstWidth ? col_end - m_Left: m_pDevice->GetWidth() ;
1552 col_end = col_end < m_dstWidth ? col_end - m_Left: m_pDevice->Ge tWidth(); 1552 int result = col_end - col_start;
1553 int result = col_end - col_start; 1553 if (result > 0) {
1554 if (result > 0) { 1554 uint8_t* dest_pos = dest_scan + col_start;
1555 uint8_t* dest_pos = dest_scan + col_start; 1555 if (result >= 4)
1556 if (result >= 4) 1556 FXSYS_memset(dest_pos, 0xffffffff,result);
1557 FXSYS_memset(dest_pos, 0xffffffff,result); 1557 else
1558 else 1558 FXSYS_memset(dest_pos,255,result);
1559 FXSYS_memset(dest_pos,255,result); 1559 }
1560 } 1560 }
1561 } 1561 void CFX_SkiaA8Renderer::blitV(int x, int y, int height, SkAlpha alpha)
1562 void CFX_SkiaA8Renderer::blitV(int x, int y, int height, SkAlpha alpha) 1562 {
1563 { 1563 FXSYS_assert(alpha);
1564 FXSYS_assert(alpha); 1564 if (alpha == 255) {
1565 if (alpha == 255) { 1565 blitRect(x, y, 1, height);
1566 blitRect(x, y, 1, height); 1566 } else {
1567 } else { 1567 int16_t runs[2];
1568 int16_t runs[2]; 1568 runs[0] = 1;
1569 runs[0] = 1; 1569 runs[1] = 0;
1570 runs[1] = 0; 1570 while (--height >= 0) {
1571 while (--height >= 0) { 1571 if (y >= m_dstHeight)
1572 if (y >= m_dstHeight) 1572 return;
1573 return; 1573 blitAntiH(x, y ++, &alpha, runs);
1574 blitAntiH(x, y ++, &alpha, runs); 1574 }
1575 } 1575 }
1576 } 1576 }
1577 } 1577 void CFX_SkiaA8Renderer::blitRect(int x, int y, int width, int height)
1578 void CFX_SkiaA8Renderer::blitRect(int x, int y, int width, int height) 1578 {
1579 { 1579 FXSYS_assert(m_pDevice);
1580 FXSYS_assert(m_pDevice); 1580 while (--height >= 0) {
1581 while (--height >= 0) { 1581 if (y >= m_dstHeight)
1582 if (y >= m_dstHeight) 1582 return;
1583 return; 1583 blitH(x , y ++, width);
1584 blitH(x , y ++, width); 1584 }
1585 } 1585 }
1586 } 1586
1587 1587 void CFX_SkiaA8Renderer::blitAntiRect(int x, int y, int width, int height,
1588 void CFX_SkiaA8Renderer::blitAntiRect(int x, int y, int width, int heigh t,
1589 SkAlpha leftAlpha, SkAlpha rightAlpha) 1588 SkAlpha leftAlpha, SkAlpha rightAlpha)
1590 » { 1589 {
1591 » » blitV(x++, y, height, leftAlpha); 1590 blitV(x++, y, height, leftAlpha);
1592 » » if (width > 0) { 1591 if (width > 0) {
1593 » » » blitRect(x, y, width, height); 1592 blitRect(x, y, width, height);
1594 » » » x += width; 1593 x += width;
1595 » » } 1594 }
1596 » » blitV(x, y, height, rightAlpha); 1595 blitV(x, y, height, rightAlpha);
1597 » } 1596 }
1598 1597
1599 » FX_BOOL CFX_SkiaA8Renderer::Init(CFX_DIBitmap* pDevice, int Left, int To p) 1598 FX_BOOL CFX_SkiaA8Renderer::Init(CFX_DIBitmap* pDevice, int Left, int Top)
1600 » { 1599 {
1601 » » m_pDevice = pDevice; 1600 m_pDevice = pDevice;
1602 » » m_Left = Left; 1601 m_Left = Left;
1603 » » m_Top = Top; 1602 m_Top = Top;
1604 » » if (pDevice){ 1603 if (pDevice){
1605 » » » m_dstWidth = m_Left + pDevice->GetWidth(); 1604 m_dstWidth = m_Left + pDevice->GetWidth();
1606 » » » m_dstHeight = m_Top + pDevice->GetHeight(); 1605 m_dstHeight = m_Top + pDevice->GetHeight();
1607 » » } 1606 }
1608 » » return TRUE; 1607 return TRUE;
1609 » } 1608 }
1610 #endif 1609 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/ge/fx_ge_text.cpp ('k') | core/src/fxge/win32/fx_win32_device.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698