OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "Sk4fLinearGradient.h" | 8 #include "Sk4fLinearGradient.h" |
9 #include "Sk4x4f.h" | 9 #include "Sk4x4f.h" |
10 #include "SkXfermode.h" | 10 #include "SkXfermode.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 advX = this->advance_interval(advX); | 315 advX = this->advance_interval(advX); |
316 } | 316 } |
317 SkASSERT(advX < fAdvX); | 317 SkASSERT(advX < fAdvX); |
318 | 318 |
319 fCc = fCc + fDcDx * Sk4f(advX); | 319 fCc = fCc + fDcDx * Sk4f(advX); |
320 fAdvX -= advX; | 320 fAdvX -= advX; |
321 } | 321 } |
322 | 322 |
323 private: | 323 private: |
324 void compute_interval_props(SkScalar t) { | 324 void compute_interval_props(SkScalar t) { |
325 const Sk4f dC = DstTraits<dstType, premul>::load(fInterval->fDc); | 325 fZeroRamp = fIsVertical || fInterval->isZeroRamp(); |
326 fCc = DstTraits<dstType, premul>::load(fInterval->fC0); | 326 fCc = DstTraits<dstType, premul>::load(fInterval->fC0); |
327 fCc = fCc + dC * Sk4f(t); | 327 |
328 fDcDx = dC * fDx; | 328 if (fInterval->isZeroRamp()) { |
329 fZeroRamp = fIsVertical || fInterval->isZeroRamp(); | 329 fDcDx = 0; |
| 330 } else { |
| 331 const Sk4f dC = DstTraits<dstType, premul>::load(fInterval->fDc); |
| 332 fCc = fCc + dC * Sk4f(t); |
| 333 fDcDx = dC * fDx; |
| 334 } |
330 } | 335 } |
331 | 336 |
332 const Interval* next_interval(const Interval* i) const { | 337 const Interval* next_interval(const Interval* i) const { |
333 SkASSERT(i >= fFirstInterval); | 338 SkASSERT(i >= fFirstInterval); |
334 SkASSERT(i <= fLastInterval); | 339 SkASSERT(i <= fLastInterval); |
335 i++; | 340 i++; |
336 | 341 |
337 if (tileMode == kClamp_TileMode) { | 342 if (tileMode == kClamp_TileMode) { |
338 SkASSERT(i <= fLastInterval); | 343 SkASSERT(i <= fLastInterval); |
339 return i; | 344 return i; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 static_cast<const LinearGradient4fContext*>(state->fCtx); | 479 static_cast<const LinearGradient4fContext*>(state->fCtx); |
475 | 480 |
476 if (ctx->fColorsArePremul) { | 481 if (ctx->fColorsArePremul) { |
477 ctx->shadePremulSpan<DstType::F16, ApplyPremul::False>( | 482 ctx->shadePremulSpan<DstType::F16, ApplyPremul::False>( |
478 x, y, dst.writable_addr64(x, y), count); | 483 x, y, dst.writable_addr64(x, y), count); |
479 } else { | 484 } else { |
480 ctx->shadePremulSpan<DstType::F16, ApplyPremul::True>( | 485 ctx->shadePremulSpan<DstType::F16, ApplyPremul::True>( |
481 x, y, dst.writable_addr64(x, y), count); | 486 x, y, dst.writable_addr64(x, y), count); |
482 } | 487 } |
483 } | 488 } |
OLD | NEW |