OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
9 #include "SkSwizzler.h" | 9 #include "SkSwizzler.h" |
10 #include "SkTemplates.h" | 10 #include "SkTemplates.h" |
11 | 11 |
12 // index | 12 #define UPDATE_ALPHA(alpha, zeroAlpha, maxAlpha) \ |
13 zeroAlpha |= (alpha); \ | |
14 maxAlpha &= (alpha); | |
13 | 15 |
14 #define A32_MASK_IN_PLACE (SkPMColor)(SK_A32_MASK << SK_A32_SHIFT) | 16 static inline size_t compute_row_bytes(int width, int pixelsPerByte) { |
scroggo
2015/03/12 19:58:40
It seems like this is part of the if case of the o
msarett
2015/03/12 21:59:41
Done.
| |
17 return (width + pixelsPerByte - 1) / pixelsPerByte; | |
18 } | |
15 | 19 |
16 static bool swizzle_index_to_n32(void* SK_RESTRICT dstRow, | 20 inline SkSwizzler::ResultAlpha SkSwizzler::GetResult(uint8_t zeroAlpha, |
17 const uint8_t* SK_RESTRICT src, | 21 uint8_t maxAlpha) { |
18 int width, int deltaSrc, int, const SkPMColor c table[]) { | 22 // In the transparent case, this returns 0x0000 |
23 // In the opaque case, this returns 0xFFFF | |
24 // If the row is neither transparent nor opaque, returns something else | |
25 return (((uint16_t) maxAlpha) << 8) | zeroAlpha; | |
26 } | |
27 | |
28 // kIndex1, kIndex2, kIndex4 | |
29 | |
30 static SkSwizzler::ResultAlpha swizzle_small_index_to_n32( | |
31 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, | |
32 int bitsPerPixel, int y, const SkPMColor ctable[]) { | |
33 | |
34 SkPMColor* SK_RESTRICT dst = (SkPMColor*) dstRow; | |
35 uint8_t maxAlpha = SkSwizzler::kMaxAlphaInit; | |
36 uint8_t zeroAlpha = SkSwizzler::kZeroAlphaInit; | |
37 const uint32_t pixelsPerByte = 8 / bitsPerPixel; | |
38 const size_t rowBytes = compute_row_bytes(width, pixelsPerByte); | |
39 const uint8_t mask = (1 << bitsPerPixel) - 1; | |
40 int x = 0; | |
41 for (uint32_t byte = 0; byte < rowBytes; byte++) { | |
42 uint8_t pixelData = src[byte]; | |
43 for (uint32_t p = 0; p < pixelsPerByte && x < width; p++) { | |
44 uint8_t index = (pixelData >> (8 - bitsPerPixel)) & mask; | |
45 SkPMColor c = ctable[index]; | |
46 UPDATE_ALPHA(c >> SK_A32_SHIFT, zeroAlpha, maxAlpha); | |
47 dst[x] = c; | |
48 pixelData <<= bitsPerPixel; | |
49 x++; | |
50 } | |
51 } | |
52 return SkSwizzler::GetResult(zeroAlpha, maxAlpha); | |
53 } | |
54 | |
55 // kIndex | |
56 | |
57 static SkSwizzler::ResultAlpha swizzle_index_to_n32( | |
58 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, | |
59 int bytesPerPixel, int y, const SkPMColor ctable[]) { | |
19 | 60 |
20 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | 61 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
21 SkPMColor cc = A32_MASK_IN_PLACE; | 62 uint8_t maxAlpha = SkSwizzler::kMaxAlphaInit; |
63 uint8_t zeroAlpha = SkSwizzler::kZeroAlphaInit; | |
22 for (int x = 0; x < width; x++) { | 64 for (int x = 0; x < width; x++) { |
23 SkPMColor c = ctable[*src]; | 65 SkPMColor c = ctable[*src]; |
24 cc &= c; | 66 UPDATE_ALPHA(c >> SK_A32_SHIFT, zeroAlpha, maxAlpha); |
25 dst[x] = c; | 67 dst[x] = c; |
26 src += deltaSrc; | 68 src++; |
27 } | 69 } |
28 return cc != A32_MASK_IN_PLACE; | 70 return SkSwizzler::GetResult(zeroAlpha, maxAlpha); |
29 } | 71 } |
30 | 72 |
31 static bool swizzle_index_to_n32_skipZ(void* SK_RESTRICT dstRow, | 73 static SkSwizzler::ResultAlpha swizzle_index_to_n32_skipZ( |
32 const uint8_t* SK_RESTRICT src, | 74 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, |
33 int width, int deltaSrc, int, | 75 int bytesPerPixel, int y, const SkPMColor ctable[]) { |
34 const SkPMColor ctable[]) { | |
35 | 76 |
36 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | 77 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
37 SkPMColor cc = A32_MASK_IN_PLACE; | 78 uint8_t maxAlpha = SkSwizzler::kMaxAlphaInit; |
79 uint8_t zeroAlpha = SkSwizzler::kZeroAlphaInit; | |
38 for (int x = 0; x < width; x++) { | 80 for (int x = 0; x < width; x++) { |
39 SkPMColor c = ctable[*src]; | 81 SkPMColor c = ctable[*src]; |
40 cc &= c; | 82 UPDATE_ALPHA(c >> SK_A32_SHIFT, zeroAlpha, maxAlpha); |
41 if (c != 0) { | 83 if (c != 0) { |
42 dst[x] = c; | 84 dst[x] = c; |
43 } | 85 } |
44 src += deltaSrc; | 86 src++; |
45 } | 87 } |
46 return cc != A32_MASK_IN_PLACE; | 88 return SkSwizzler::GetResult(zeroAlpha, maxAlpha); |
47 } | 89 } |
48 | 90 |
49 #undef A32_MASK_IN_PLACE | 91 #undef A32_MASK_IN_PLACE |
50 | 92 |
93 static SkSwizzler::ResultAlpha swizzle_bgrx_to_n32( | |
94 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, | |
95 int bytesPerPixel, int y, const SkPMColor ctable[]) { | |
96 | |
97 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | |
98 for (int x = 0; x < width; x++) { | |
99 dst[x] = SkPackARGB32NoCheck(0xFF, src[2], src[1], src[0]); | |
100 src += bytesPerPixel; | |
101 } | |
102 return SkSwizzler::kOpaque_ResultAlpha; | |
103 } | |
104 | |
105 // kBGRA | |
106 | |
107 static SkSwizzler::ResultAlpha swizzle_bgra_to_n32( | |
108 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, | |
109 int bytesPerPixel, int y, const SkPMColor ctable[]) { | |
110 | |
111 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | |
112 uint8_t maxAlpha = SkSwizzler::kMaxAlphaInit; | |
113 uint8_t zeroAlpha = SkSwizzler::kZeroAlphaInit; | |
114 for (int x = 0; x < width; x++) { | |
115 uint8_t alpha = src[3]; | |
116 UPDATE_ALPHA(alpha, zeroAlpha, maxAlpha); | |
117 dst[x] = SkPackARGB32NoCheck(alpha, src[2], src[1], src[0]); | |
118 src += bytesPerPixel; | |
119 } | |
120 return SkSwizzler::GetResult(zeroAlpha, maxAlpha); | |
121 } | |
122 | |
51 // n32 | 123 // n32 |
52 static bool swizzle_rgbx_to_n32(void* SK_RESTRICT dstRow, | 124 static SkSwizzler::ResultAlpha swizzle_rgbx_to_n32( |
53 const uint8_t* SK_RESTRICT src, | 125 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, |
54 int width, int deltaSrc, int, const SkPMColor[]) { | 126 int bytesPerPixel, int y, const SkPMColor ctable[]) { |
127 | |
55 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | 128 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
56 for (int x = 0; x < width; x++) { | 129 for (int x = 0; x < width; x++) { |
57 dst[x] = SkPackARGB32(0xFF, src[0], src[1], src[2]); | 130 dst[x] = SkPackARGB32(0xFF, src[0], src[1], src[2]); |
58 src += deltaSrc; | 131 src += bytesPerPixel; |
59 } | 132 } |
60 return false; | 133 return SkSwizzler::kOpaque_ResultAlpha; |
61 } | 134 } |
62 | 135 |
63 static bool swizzle_rgba_to_n32_premul(void* SK_RESTRICT dstRow, | 136 static SkSwizzler::ResultAlpha swizzle_rgba_to_n32_premul( |
64 const uint8_t* SK_RESTRICT src, | 137 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, |
65 int width, int deltaSrc, int, const SkPMC olor[]) { | 138 int bytesPerPixel, int y, const SkPMColor ctable[]) { |
139 | |
66 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | 140 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
67 unsigned alphaMask = 0xFF; | 141 uint8_t maxAlpha = SkSwizzler::kMaxAlphaInit; |
142 uint8_t zeroAlpha = SkSwizzler::kZeroAlphaInit; | |
68 for (int x = 0; x < width; x++) { | 143 for (int x = 0; x < width; x++) { |
69 unsigned alpha = src[3]; | 144 unsigned alpha = src[3]; |
145 UPDATE_ALPHA(alpha, zeroAlpha, maxAlpha); | |
70 dst[x] = SkPreMultiplyARGB(alpha, src[0], src[1], src[2]); | 146 dst[x] = SkPreMultiplyARGB(alpha, src[0], src[1], src[2]); |
71 src += deltaSrc; | 147 src += bytesPerPixel; |
72 alphaMask &= alpha; | |
73 } | 148 } |
74 return alphaMask != 0xFF; | 149 return SkSwizzler::GetResult(zeroAlpha, maxAlpha); |
75 } | 150 } |
76 | 151 |
77 static bool swizzle_rgba_to_n32_unpremul(void* SK_RESTRICT dstRow, | 152 static SkSwizzler::ResultAlpha swizzle_rgba_to_n32_unpremul( |
78 const uint8_t* SK_RESTRICT src, | 153 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, |
79 int width, int deltaSrc, int, | 154 int bytesPerPixel, int y, const SkPMColor ctable[]) { |
80 const SkPMColor[]) { | 155 |
81 uint32_t* SK_RESTRICT dst = reinterpret_cast<uint32_t*>(dstRow); | 156 uint32_t* SK_RESTRICT dst = reinterpret_cast<uint32_t*>(dstRow); |
82 unsigned alphaMask = 0xFF; | 157 uint8_t maxAlpha = SkSwizzler::kMaxAlphaInit; |
158 uint8_t zeroAlpha = SkSwizzler::kZeroAlphaInit; | |
83 for (int x = 0; x < width; x++) { | 159 for (int x = 0; x < width; x++) { |
84 unsigned alpha = src[3]; | 160 unsigned alpha = src[3]; |
161 UPDATE_ALPHA(alpha, zeroAlpha, maxAlpha); | |
85 dst[x] = SkPackARGB32NoCheck(alpha, src[0], src[1], src[2]); | 162 dst[x] = SkPackARGB32NoCheck(alpha, src[0], src[1], src[2]); |
86 src += deltaSrc; | 163 src += bytesPerPixel; |
87 alphaMask &= alpha; | |
88 } | 164 } |
89 return alphaMask != 0xFF; | 165 return SkSwizzler::GetResult(zeroAlpha, maxAlpha); |
90 } | 166 } |
91 | 167 |
92 static bool swizzle_rgba_to_n32_premul_skipZ(void* SK_RESTRICT dstRow, | 168 static SkSwizzler::ResultAlpha swizzle_rgba_to_n32_premul_skipZ( |
93 const uint8_t* SK_RESTRICT src, | 169 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, |
94 int width, int deltaSrc, int, | 170 int bytesPerPixel, int y, const SkPMColor ctable[]) { |
95 const SkPMColor[]) { | 171 |
96 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | 172 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
97 unsigned alphaMask = 0xFF; | 173 uint8_t maxAlpha = SkSwizzler::kMaxAlphaInit; |
174 uint8_t zeroAlpha = SkSwizzler::kZeroAlphaInit; | |
98 for (int x = 0; x < width; x++) { | 175 for (int x = 0; x < width; x++) { |
99 unsigned alpha = src[3]; | 176 unsigned alpha = src[3]; |
177 UPDATE_ALPHA(alpha, zeroAlpha, maxAlpha); | |
100 if (0 != alpha) { | 178 if (0 != alpha) { |
101 dst[x] = SkPreMultiplyARGB(alpha, src[0], src[1], src[2]); | 179 dst[x] = SkPreMultiplyARGB(alpha, src[0], src[1], src[2]); |
102 } | 180 } |
103 src += deltaSrc; | 181 src += bytesPerPixel; |
104 alphaMask &= alpha; | |
105 } | 182 } |
106 return alphaMask != 0xFF; | 183 return SkSwizzler::GetResult(zeroAlpha, maxAlpha); |
107 } | 184 } |
108 | 185 |
186 #undef UPDATE_ALPHA | |
187 | |
109 /** | 188 /** |
110 FIXME: This was my idea to cheat in order to continue taking advantage of sk ipping zeroes. | 189 FIXME: This was my idea to cheat in order to continue taking advantage of sk ipping zeroes. |
111 This would be fine for drawing normally, but not for drawing with transfer m odes. Being | 190 This would be fine for drawing normally, but not for drawing with transfer m odes. Being |
112 honest means we can draw correctly with transfer modes, with the cost of not being able | 191 honest means we can draw correctly with transfer modes, with the cost of not being able |
113 to take advantage of Android's free unwritten pages. Something to keep in mi nd when we | 192 to take advantage of Android's free unwritten pages. Something to keep in mi nd when we |
114 decide whether to switch to unpremul default. | 193 decide whether to switch to unpremul default. |
115 static bool swizzle_rgba_to_n32_unpremul_skipZ(void* SK_RESTRICT dstRow, | 194 static bool swizzle_rgba_to_n32_unpremul_skipZ(void* SK_RESTRICT dstRow, |
116 const uint8_t* SK_RESTRICT src, | 195 const uint8_t* SK_RESTRICT src, |
117 int width, int deltaSrc, int, | 196 int width, int bitsPerPixel, |
118 const SkPMColor[]) { | 197 const SkPMColor[]) { |
119 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | 198 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
120 unsigned alphaMask = 0xFF; | 199 unsigned alphaMask = 0xFF; |
121 for (int x = 0; x < width; x++) { | 200 for (int x = 0; x < width; x++) { |
122 unsigned alpha = src[3]; | 201 unsigned alpha = src[3]; |
123 // NOTE: We cheat here. The caller requested unpremul and skip zeroes. I t's possible | 202 // NOTE: We cheat here. The caller requested unpremul and skip zeroes. I t's possible |
124 // the color components are not zero, but we skip them anyway, meaning t hey'll remain | 203 // the color components are not zero, but we skip them anyway, meaning t hey'll remain |
125 // zero (implied by the request to skip zeroes). | 204 // zero (implied by the request to skip zeroes). |
126 if (0 != alpha) { | 205 if (0 != alpha) { |
127 dst[x] = SkPackARGB32NoCheck(alpha, src[0], src[1], src[2]); | 206 dst[x] = SkPackARGB32NoCheck(alpha, src[0], src[1], src[2]); |
128 } | 207 } |
129 src += deltaSrc; | 208 src += deltaSrc; |
130 alphaMask &= alpha; | 209 alphaMask &= alpha; |
131 } | 210 } |
132 return alphaMask != 0xFF; | 211 return alphaMask != 0xFF; |
133 } | 212 } |
134 */ | 213 */ |
135 | 214 |
136 SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc, const SkPMColor * ctable, | 215 SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc, |
216 const SkPMColor* ctable, | |
137 const SkImageInfo& info, void* dst, | 217 const SkImageInfo& info, void* dst, |
138 size_t dstRowBytes, bool skipZeroes) { | 218 size_t dstRowBytes, bool skipZeroes) { |
139 if (info.colorType() == kUnknown_SkColorType) { | 219 if (kUnknown_SkColorType == info.colorType()) { |
140 return NULL; | 220 return NULL; |
141 } | 221 } |
142 if (info.minRowBytes() > dstRowBytes) { | 222 if (info.minRowBytes() > dstRowBytes) { |
143 return NULL; | 223 return NULL; |
144 } | 224 } |
145 if (kIndex == sc && NULL == ctable) { | 225 if ((kIndex == sc || kIndex4 == sc || kIndex2 == sc || kIndex1 == sc) |
226 && NULL == ctable) { | |
146 return NULL; | 227 return NULL; |
147 } | 228 } |
148 RowProc proc = NULL; | 229 RowProc proc = NULL; |
149 switch (sc) { | 230 switch (sc) { |
231 case kIndex1: | |
232 case kIndex2: | |
233 case kIndex4: | |
234 switch (info.colorType()) { | |
235 case kN32_SkColorType: | |
236 proc = &swizzle_small_index_to_n32; | |
237 break; | |
238 default: | |
239 break; | |
240 } | |
241 break; | |
150 case kIndex: | 242 case kIndex: |
151 switch (info.colorType()) { | 243 switch (info.colorType()) { |
152 case kN32_SkColorType: | 244 case kN32_SkColorType: |
153 // We assume the color premultiplied ctable (or not) as desi red. | |
154 if (skipZeroes) { | 245 if (skipZeroes) { |
155 proc = &swizzle_index_to_n32_skipZ; | 246 proc = &swizzle_index_to_n32_skipZ; |
156 } else { | 247 } else { |
157 proc = &swizzle_index_to_n32; | 248 proc = &swizzle_index_to_n32; |
158 } | 249 } |
159 break; | 250 break; |
160 | |
161 default: | 251 default: |
162 break; | 252 break; |
163 } | 253 } |
254 break; | |
255 case kBGR: | |
256 case kBGRX: | |
257 switch (info.colorType()) { | |
258 case kN32_SkColorType: | |
259 proc = &swizzle_bgrx_to_n32; | |
260 break; | |
261 default: | |
262 break; | |
263 } | |
264 break; | |
265 case kBGRA: | |
266 switch (info.colorType()) { | |
267 case kN32_SkColorType: | |
268 proc = &swizzle_bgra_to_n32; | |
269 break; | |
270 default: | |
271 break; | |
272 } | |
164 break; | 273 break; |
165 case kRGBX: | 274 case kRGBX: |
166 // TODO: Support other swizzles. | 275 // TODO: Support other swizzles. |
167 switch (info.colorType()) { | 276 switch (info.colorType()) { |
168 case kN32_SkColorType: | 277 case kN32_SkColorType: |
169 proc = &swizzle_rgbx_to_n32; | 278 proc = &swizzle_rgbx_to_n32; |
170 break; | 279 break; |
171 default: | 280 default: |
172 break; | 281 break; |
173 } | 282 } |
174 break; | 283 break; |
175 case kRGBA: | 284 case kRGBA: |
176 switch (info.colorType()) { | 285 switch (info.colorType()) { |
177 case kN32_SkColorType: | 286 case kN32_SkColorType: |
178 if (info.alphaType() == kUnpremul_SkAlphaType) { | 287 if (info.alphaType() == kUnpremul_SkAlphaType) { |
179 // Respect skipZeroes? | 288 // Respect skipZeroes? |
180 proc = &swizzle_rgba_to_n32_unpremul; | 289 proc = &swizzle_rgba_to_n32_unpremul; |
181 } else { | 290 } else { |
182 if (skipZeroes) { | 291 if (skipZeroes) { |
183 proc = &swizzle_rgba_to_n32_premul_skipZ; | 292 proc = &swizzle_rgba_to_n32_premul_skipZ; |
184 } else { | 293 } else { |
185 proc = &swizzle_rgba_to_n32_premul; | 294 proc = &swizzle_rgba_to_n32_premul; |
186 } | 295 } |
187 } | 296 } |
188 break; | 297 break; |
189 default: | 298 default: |
190 break; | 299 break; |
191 } | 300 } |
192 break; | 301 break; |
302 case kRGB: | |
303 switch (info.colorType()) { | |
304 case kN32_SkColorType: | |
305 proc = &swizzle_rgbx_to_n32; | |
306 break; | |
307 default: | |
308 break; | |
309 } | |
310 break; | |
193 default: | 311 default: |
194 break; | 312 break; |
195 } | 313 } |
196 if (NULL == proc) { | 314 if (NULL == proc) { |
197 return NULL; | 315 return NULL; |
198 } | 316 } |
199 return SkNEW_ARGS(SkSwizzler, (proc, ctable, BytesPerPixel(sc), info, dst, d stRowBytes)); | 317 return SkNEW_ARGS(SkSwizzler, (proc, ctable, DeltaSrc(sc), info, dst, |
318 dstRowBytes)); | |
200 } | 319 } |
201 | 320 |
202 SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcBpp, | 321 SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable, |
203 const SkImageInfo& info, void* dst, size_t rowBytes) | 322 int deltaSrc, const SkImageInfo& info, void* dst, |
323 size_t rowBytes) | |
204 : fRowProc(proc) | 324 : fRowProc(proc) |
205 , fColorTable(ctable) | 325 , fColorTable(ctable) |
206 , fSrcPixelSize(srcBpp) | 326 , fDeltaSrc(deltaSrc) |
207 , fDstInfo(info) | 327 , fDstInfo(info) |
208 , fDstRow(dst) | 328 , fDstRow(dst) |
209 , fDstRowBytes(rowBytes) | 329 , fDstRowBytes(rowBytes) |
210 , fCurrY(0) | 330 , fCurrY(0) |
211 { | 331 { |
332 SkDEBUGCODE(fNextMode = kUninitialized_NextMode); | |
212 } | 333 } |
213 | 334 |
214 bool SkSwizzler::next(const uint8_t* SK_RESTRICT src) { | 335 SkSwizzler::ResultAlpha SkSwizzler::next(const uint8_t* SK_RESTRICT src) { |
215 SkASSERT(fCurrY < fDstInfo.height()); | 336 SkASSERT(0 <= fCurrY && fCurrY < fDstInfo.height()); |
216 const bool hadAlpha = fRowProc(fDstRow, src, fDstInfo.width(), fSrcPixelSize , | 337 SkASSERT(kDesignateRow_NextMode != fNextMode); |
217 fCurrY, fColorTable); | 338 SkDEBUGCODE(fNextMode = kConsecutive_NextMode); |
218 fCurrY++; | 339 |
340 // Decode a row | |
341 const ResultAlpha result = fRowProc(fDstRow, src, fDstInfo.width(), | |
342 fDeltaSrc, fCurrY, fColorTable); | |
343 | |
344 // Move to the next row and return the result | |
219 fDstRow = SkTAddOffset<void>(fDstRow, fDstRowBytes); | 345 fDstRow = SkTAddOffset<void>(fDstRow, fDstRowBytes); |
220 return hadAlpha; | 346 return result; |
221 } | 347 } |
348 | |
349 SkSwizzler::ResultAlpha SkSwizzler::next(const uint8_t* SK_RESTRICT src, | |
350 int y) { | |
351 SkASSERT(0 <= y && y < fDstInfo.height()); | |
352 SkASSERT(kConsecutive_NextMode != fNextMode); | |
353 SkDEBUGCODE(fNextMode = kDesignateRow_NextMode); | |
354 | |
355 // Choose the row | |
356 void* row = SkTAddOffset<void>(fDstRow, y*fDstRowBytes); | |
357 | |
358 // Decode the row | |
359 return fRowProc(row, src, fDstInfo.width(), fDeltaSrc, fCurrY, | |
360 fColorTable); | |
361 } | |
OLD | NEW |