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 "Sk4fGradientBase.h" | 8 #include "Sk4fGradientBase.h" |
9 #include "Sk4fGradientPriv.h" | 9 #include "Sk4fGradientPriv.h" |
10 | 10 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 static const int kBufSize = 128; | 327 static const int kBufSize = 128; |
328 SkScalar ts[kBufSize]; | 328 SkScalar ts[kBufSize]; |
329 TSampler<DstType, tileMode> sampler(*this); | 329 TSampler<DstType, tileMode> sampler(*this); |
330 | 330 |
331 SkASSERT(count > 0); | 331 SkASSERT(count > 0); |
332 do { | 332 do { |
333 const int n = SkTMin(kBufSize, count); | 333 const int n = SkTMin(kBufSize, count); |
334 this->mapTs(x, y, ts, n); | 334 this->mapTs(x, y, ts, n); |
335 for (int i = 0; i < n; ++i) { | 335 for (int i = 0; i < n; ++i) { |
336 const Sk4f c = sampler.sample(ts[i]); | 336 const Sk4f c = sampler.sample(ts[i]); |
337 store<DstType, do_premul>(c, dst++); | 337 store<DstType, kLinear_SkColorProfileType, do_premul>(c, dst++); |
338 } | 338 } |
339 x += n; | 339 x += n; |
340 count -= n; | 340 count -= n; |
341 } while (count > 0); | 341 } while (count > 0); |
342 } | 342 } |
343 | 343 |
344 template<typename DstType, SkShader::TileMode tileMode> | 344 template<typename DstType, SkShader::TileMode tileMode> |
345 class SkGradientShaderBase::GradientShaderBase4fContext::TSampler { | 345 class SkGradientShaderBase::GradientShaderBase4fContext::TSampler { |
346 public: | 346 public: |
347 TSampler(const GradientShaderBase4fContext& ctx) | 347 TSampler(const GradientShaderBase4fContext& ctx) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 if (i < fFirstInterval) { | 417 if (i < fFirstInterval) { |
418 i = fLastInterval; | 418 i = fLastInterval; |
419 } | 419 } |
420 } while (tiled_t < i->fP0 || tiled_t >= i->fP1); | 420 } while (tiled_t < i->fP0 || tiled_t >= i->fP1); |
421 } | 421 } |
422 | 422 |
423 return i; | 423 return i; |
424 } | 424 } |
425 | 425 |
426 void loadIntervalData(const Interval* i) { | 426 void loadIntervalData(const Interval* i) { |
427 fCc = dst_swizzle<DstType>(i->fC0) * dst_component_scale<DstType>(); | 427 fCc = scale_for_dest<DstType, kLinear_SkColorProfileType>(dst_swizzle<Ds
tType>(i->fC0)); |
428 fDc = dst_swizzle<DstType>(i->fDc) * dst_component_scale<DstType>(); | 428 fDc = scale_for_dest<DstType, kLinear_SkColorProfileType>(dst_swizzle<Ds
tType>(i->fDc)); |
429 } | 429 } |
430 | 430 |
431 const Interval* fFirstInterval; | 431 const Interval* fFirstInterval; |
432 const Interval* fLastInterval; | 432 const Interval* fLastInterval; |
433 const Interval* fInterval; | 433 const Interval* fInterval; |
434 SkScalar fPrevT; | 434 SkScalar fPrevT; |
435 Sk4f fCc; | 435 Sk4f fCc; |
436 Sk4f fDc; | 436 Sk4f fDc; |
437 }; | 437 }; |
OLD | NEW |