OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkArithmeticMode.h" | 8 #include "SkArithmeticMode.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 void SkArithmeticMode_scalar::xfer32(SkPMColor dst[], const SkPMColor src[], | 100 void SkArithmeticMode_scalar::xfer32(SkPMColor dst[], const SkPMColor src[], |
101 int count, const SkAlpha aaCoverage[]) const { | 101 int count, const SkAlpha aaCoverage[]) const { |
102 SkScalar k1 = fK[0] / 255; | 102 SkScalar k1 = fK[0] / 255; |
103 SkScalar k2 = fK[1]; | 103 SkScalar k2 = fK[1]; |
104 SkScalar k3 = fK[2]; | 104 SkScalar k3 = fK[2]; |
105 SkScalar k4 = fK[3] * 255; | 105 SkScalar k4 = fK[3] * 255; |
106 | 106 |
107 for (int i = 0; i < count; ++i) { | 107 for (int i = 0; i < count; ++i) { |
108 if ((NULL == aaCoverage) || aaCoverage[i]) { | 108 if ((nullptr == aaCoverage) || aaCoverage[i]) { |
109 SkPMColor sc = src[i]; | 109 SkPMColor sc = src[i]; |
110 SkPMColor dc = dst[i]; | 110 SkPMColor dc = dst[i]; |
111 | 111 |
112 int a, r, g, b; | 112 int a, r, g, b; |
113 | 113 |
114 if (gUseUnpremul) { | 114 if (gUseUnpremul) { |
115 int sa = SkGetPackedA32(sc); | 115 int sa = SkGetPackedA32(sc); |
116 int da = SkGetPackedA32(dc); | 116 int da = SkGetPackedA32(dc); |
117 | 117 |
118 int srcNeedsUnpremul = needsUnpremul(sa); | 118 int srcNeedsUnpremul = needsUnpremul(sa); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 fEnforcePMColor); | 259 fEnforcePMColor); |
260 } | 260 } |
261 return true; | 261 return true; |
262 } | 262 } |
263 | 263 |
264 #endif | 264 #endif |
265 | 265 |
266 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) | 266 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) |
267 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) | 267 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) |
268 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 268 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |