OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkLinearGradient.h" | 8 #include "SkLinearGradient.h" |
9 | 9 |
10 static const float kInv255Float = 1.0f / 255; | 10 static const float kInv255Float = 1.0f / 255; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } while (--count != 0); | 275 } while (--count != 0); |
276 } | 276 } |
277 | 277 |
278 } | 278 } |
279 | 279 |
280 void SkLinearGradient::LinearGradientContext::shadeSpan(int x, int y, SkPMColor*
SK_RESTRICT dstC, | 280 void SkLinearGradient::LinearGradientContext::shadeSpan(int x, int y, SkPMColor*
SK_RESTRICT dstC, |
281 int count) { | 281 int count) { |
282 SkASSERT(count > 0); | 282 SkASSERT(count > 0); |
283 const SkLinearGradient& linearGradient = static_cast<const SkLinearGradient&
>(fShader); | 283 const SkLinearGradient& linearGradient = static_cast<const SkLinearGradient&
>(fShader); |
284 | 284 |
285 #ifndef SK_SUPPORT_LEGACY_LINEAR_GRADIENT_TABLE | 285 // Only use the Sk4f impl when known to be fast. |
| 286 #if defined(SKNX_IS_FAST) |
286 if (SkShader::kClamp_TileMode == linearGradient.fTileMode && | 287 if (SkShader::kClamp_TileMode == linearGradient.fTileMode && |
287 kLinear_MatrixClass == fDstToIndexClass) | 288 kLinear_MatrixClass == fDstToIndexClass) |
288 { | 289 { |
289 this->shade4_clamp(x, y, dstC, count); | 290 this->shade4_clamp(x, y, dstC, count); |
290 return; | 291 return; |
291 } | 292 } |
292 #endif | 293 #endif |
293 | 294 |
294 SkPoint srcPt; | 295 SkPoint srcPt; |
295 SkMatrix::MapXYProc dstProc = fDstToIndexProc; | 296 SkMatrix::MapXYProc dstProc = fDstToIndexProc; |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 } | 916 } |
916 } else { | 917 } else { |
917 if (fApplyAlphaAfterInterp) { | 918 if (fApplyAlphaAfterInterp) { |
918 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); | 919 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); |
919 } else { | 920 } else { |
920 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); | 921 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); |
921 } | 922 } |
922 } | 923 } |
923 } | 924 } |
924 | 925 |
OLD | NEW |