OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkGradientShaderPriv.h" | 9 #include "SkGradientShaderPriv.h" |
10 #include "SkHalf.h" | 10 #include "SkHalf.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 390 |
391 // now convert our colors in to PMColors | 391 // now convert our colors in to PMColors |
392 unsigned paintAlpha = this->getPaintAlpha(); | 392 unsigned paintAlpha = this->getPaintAlpha(); |
393 | 393 |
394 fFlags = this->INHERITED::getFlags(); | 394 fFlags = this->INHERITED::getFlags(); |
395 if (shader.fColorsAreOpaque && paintAlpha == 0xFF) { | 395 if (shader.fColorsAreOpaque && paintAlpha == 0xFF) { |
396 fFlags |= kOpaqueAlpha_Flag; | 396 fFlags |= kOpaqueAlpha_Flag; |
397 } | 397 } |
398 } | 398 } |
399 | 399 |
| 400 bool SkGradientShaderBase::GradientShaderBaseContext::isValid() const { |
| 401 return fDstToIndex.isFinite(); |
| 402 } |
| 403 |
400 SkGradientShaderBase::GradientShaderCache::GradientShaderCache( | 404 SkGradientShaderBase::GradientShaderCache::GradientShaderCache( |
401 U8CPU alpha, bool dither, const SkGradientShaderBase& shader) | 405 U8CPU alpha, bool dither, const SkGradientShaderBase& shader) |
402 : fCacheAlpha(alpha) | 406 : fCacheAlpha(alpha) |
403 , fCacheDither(dither) | 407 , fCacheDither(dither) |
404 , fShader(shader) | 408 , fShader(shader) |
405 { | 409 { |
406 // Only initialize the cache in getCache32. | 410 // Only initialize the cache in getCache32. |
407 fCache32 = nullptr; | 411 fCache32 = nullptr; |
408 fCache32PixelRef = nullptr; | 412 fCache32PixelRef = nullptr; |
409 } | 413 } |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 (*stops)[i] = stop; | 1741 (*stops)[i] = stop; |
1738 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1742 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
1739 } | 1743 } |
1740 } | 1744 } |
1741 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1745 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
1742 | 1746 |
1743 return outColors; | 1747 return outColors; |
1744 } | 1748 } |
1745 | 1749 |
1746 #endif | 1750 #endif |
OLD | NEW |