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 "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkMaskSwizzler.h" | 10 #include "SkMaskSwizzler.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 /* | 219 /* |
220 * | 220 * |
221 * Create a new mask swizzler | 221 * Create a new mask swizzler |
222 * | 222 * |
223 */ | 223 */ |
224 SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler( | 224 SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler( |
225 const SkImageInfo& info, SkMasks* masks, uint32_t bitsPerPixel) { | 225 const SkImageInfo& info, SkMasks* masks, uint32_t bitsPerPixel) { |
226 | 226 |
227 // Choose the appropriate row procedure | 227 // Choose the appropriate row procedure |
228 RowProc proc = NULL; | 228 RowProc proc = nullptr; |
229 switch (bitsPerPixel) { | 229 switch (bitsPerPixel) { |
230 case 16: | 230 case 16: |
231 switch (info.colorType()) { | 231 switch (info.colorType()) { |
232 case kN32_SkColorType: | 232 case kN32_SkColorType: |
233 switch (info.alphaType()) { | 233 switch (info.alphaType()) { |
234 case kUnpremul_SkAlphaType: | 234 case kUnpremul_SkAlphaType: |
235 proc = &swizzle_mask16_to_n32_unpremul; | 235 proc = &swizzle_mask16_to_n32_unpremul; |
236 break; | 236 break; |
237 case kPremul_SkAlphaType: | 237 case kPremul_SkAlphaType: |
238 proc = &swizzle_mask16_to_n32_premul; | 238 proc = &swizzle_mask16_to_n32_premul; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 default: | 312 default: |
313 break; | 313 break; |
314 } | 314 } |
315 break; | 315 break; |
316 default: | 316 default: |
317 break; | 317 break; |
318 } | 318 } |
319 break; | 319 break; |
320 default: | 320 default: |
321 SkASSERT(false); | 321 SkASSERT(false); |
322 return NULL; | 322 return nullptr; |
323 } | 323 } |
324 return new SkMaskSwizzler(info, masks, proc); | 324 return new SkMaskSwizzler(info, masks, proc); |
325 } | 325 } |
326 | 326 |
327 /* | 327 /* |
328 * | 328 * |
329 * Constructor for mask swizzler | 329 * Constructor for mask swizzler |
330 * | 330 * |
331 */ | 331 */ |
332 SkMaskSwizzler::SkMaskSwizzler(const SkImageInfo& dstInfo, SkMasks* masks, | 332 SkMaskSwizzler::SkMaskSwizzler(const SkImageInfo& dstInfo, SkMasks* masks, |
333 RowProc proc) | 333 RowProc proc) |
334 : fDstInfo(dstInfo) | 334 : fDstInfo(dstInfo) |
335 , fMasks(masks) | 335 , fMasks(masks) |
336 , fRowProc(proc) | 336 , fRowProc(proc) |
337 {} | 337 {} |
338 | 338 |
339 /* | 339 /* |
340 * | 340 * |
341 * Swizzle the specified row | 341 * Swizzle the specified row |
342 * | 342 * |
343 */ | 343 */ |
344 SkSwizzler::ResultAlpha SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RES
TRICT src) { | 344 SkSwizzler::ResultAlpha SkMaskSwizzler::swizzle(void* dst, const uint8_t* SK_RES
TRICT src) { |
345 SkASSERT(NULL != dst && NULL != src); | 345 SkASSERT(nullptr != dst && nullptr != src); |
346 return fRowProc(dst, src, fDstInfo.width(), fMasks); | 346 return fRowProc(dst, src, fDstInfo.width(), fMasks); |
347 } | 347 } |
OLD | NEW |