OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkBlitMask.h" | 8 #include "SkBlitMask.h" |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 static void D32_LCD16_Proc(void* SK_RESTRICT dst, size_t dstRB, | 26 static void D32_LCD16_Proc(void* SK_RESTRICT dst, size_t dstRB, |
27 const void* SK_RESTRICT mask, size_t maskRB, | 27 const void* SK_RESTRICT mask, size_t maskRB, |
28 SkColor color, int width, int height) { | 28 SkColor color, int width, int height) { |
29 | 29 |
30 SkPMColor* dstRow = (SkPMColor*)dst; | 30 SkPMColor* dstRow = (SkPMColor*)dst; |
31 const uint16_t* srcRow = (const uint16_t*)mask; | 31 const uint16_t* srcRow = (const uint16_t*)mask; |
32 SkPMColor opaqueDst; | 32 SkPMColor opaqueDst; |
33 | 33 |
34 SkBlitMask::BlitLCD16RowProc proc = NULL; | 34 SkBlitMask::BlitLCD16RowProc proc = nullptr; |
35 bool isOpaque = (0xFF == SkColorGetA(color)); | 35 bool isOpaque = (0xFF == SkColorGetA(color)); |
36 proc = SkBlitMask::BlitLCD16RowFactory(isOpaque); | 36 proc = SkBlitMask::BlitLCD16RowFactory(isOpaque); |
37 SkASSERT(proc != NULL); | 37 SkASSERT(proc != nullptr); |
38 | 38 |
39 if (isOpaque) { | 39 if (isOpaque) { |
40 opaqueDst = SkPreMultiplyColor(color); | 40 opaqueDst = SkPreMultiplyColor(color); |
41 } else { | 41 } else { |
42 opaqueDst = 0; // ignored | 42 opaqueDst = 0; // ignored |
43 } | 43 } |
44 | 44 |
45 do { | 45 do { |
46 proc(dstRow, srcRow, color, width, opaqueDst); | 46 proc(dstRow, srcRow, color, width, opaqueDst); |
47 dstRow = (SkPMColor*)((char*)dstRow + dstRB); | 47 dstRow = (SkPMColor*)((char*)dstRow + dstRB); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 SkMask::Format format, | 276 SkMask::Format format, |
277 RowFlags flags) { | 277 RowFlags flags) { |
278 // make this opt-in until chrome can rebaseline | 278 // make this opt-in until chrome can rebaseline |
279 RowProc proc = PlatformRowProcs(ct, format, flags); | 279 RowProc proc = PlatformRowProcs(ct, format, flags); |
280 if (proc) { | 280 if (proc) { |
281 return proc; | 281 return proc; |
282 } | 282 } |
283 | 283 |
284 static const RowProc gProcs[] = { | 284 static const RowProc gProcs[] = { |
285 // need X coordinate to handle BW | 285 // need X coordinate to handle BW |
286 false ? (RowProc)BW_RowProc_Blend : NULL, // suppress unused warning | 286 false ? (RowProc)BW_RowProc_Blend : nullptr, // suppress unused warning |
287 false ? (RowProc)BW_RowProc_Opaque : NULL, // suppress unused warning | 287 false ? (RowProc)BW_RowProc_Opaque : nullptr, // suppress unused warning |
288 (RowProc)A8_RowProc_Blend, (RowProc)A8_RowProc_Opaque, | 288 (RowProc)A8_RowProc_Blend, (RowProc)A8_RowProc_Opaque, |
289 (RowProc)LCD16_RowProc_Blend, (RowProc)LCD16_RowProc_Opaque, | 289 (RowProc)LCD16_RowProc_Blend, (RowProc)LCD16_RowProc_Opaque, |
290 }; | 290 }; |
291 | 291 |
292 int index; | 292 int index; |
293 switch (ct) { | 293 switch (ct) { |
294 case kN32_SkColorType: | 294 case kN32_SkColorType: |
295 switch (format) { | 295 switch (format) { |
296 case SkMask::kBW_Format: index = 0; break; | 296 case SkMask::kBW_Format: index = 0; break; |
297 case SkMask::kA8_Format: index = 2; break; | 297 case SkMask::kA8_Format: index = 2; break; |
298 case SkMask::kLCD16_Format: index = 4; break; | 298 case SkMask::kLCD16_Format: index = 4; break; |
299 default: | 299 default: |
300 return NULL; | 300 return nullptr; |
301 } | 301 } |
302 if (flags & kSrcIsOpaque_RowFlag) { | 302 if (flags & kSrcIsOpaque_RowFlag) { |
303 index |= 1; | 303 index |= 1; |
304 } | 304 } |
305 SkASSERT((size_t)index < SK_ARRAY_COUNT(gProcs)); | 305 SkASSERT((size_t)index < SK_ARRAY_COUNT(gProcs)); |
306 return gProcs[index]; | 306 return gProcs[index]; |
307 default: | 307 default: |
308 break; | 308 break; |
309 } | 309 } |
310 return NULL; | 310 return nullptr; |
311 } | 311 } |
OLD | NEW |