| 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 "SkGradientShaderPriv.h" | 8 #include "SkGradientShaderPriv.h" |
| 9 #include "SkLinearGradient.h" | 9 #include "SkLinearGradient.h" |
| 10 #include "SkRadialGradient.h" | 10 #include "SkRadialGradient.h" |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 b += db; | 477 b += db; |
| 478 } while (--count != 0); | 478 } while (--count != 0); |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 | 481 |
| 482 static inline int SkFixedToFFFF(SkFixed x) { | 482 static inline int SkFixedToFFFF(SkFixed x) { |
| 483 SkASSERT((unsigned)x <= SK_Fixed1); | 483 SkASSERT((unsigned)x <= SK_Fixed1); |
| 484 return x - (x >> 16); | 484 return x - (x >> 16); |
| 485 } | 485 } |
| 486 | 486 |
| 487 static inline U16CPU bitsTo16(unsigned x, const unsigned bits) { | |
| 488 SkASSERT(x < (1U << bits)); | |
| 489 if (6 == bits) { | |
| 490 return (x << 10) | (x << 4) | (x >> 2); | |
| 491 } | |
| 492 if (8 == bits) { | |
| 493 return (x << 8) | x; | |
| 494 } | |
| 495 sk_throw(); | |
| 496 return 0; | |
| 497 } | |
| 498 | |
| 499 const uint16_t* SkGradientShaderBase::GradientShaderCache::getCache16() { | 487 const uint16_t* SkGradientShaderBase::GradientShaderCache::getCache16() { |
| 500 SkOnce(&fCache16Inited, &fCache16Mutex, SkGradientShaderBase::GradientShader
Cache::initCache16, | 488 SkOnce(&fCache16Inited, &fCache16Mutex, SkGradientShaderBase::GradientShader
Cache::initCache16, |
| 501 this); | 489 this); |
| 502 SkASSERT(fCache16); | 490 SkASSERT(fCache16); |
| 503 return fCache16; | 491 return fCache16; |
| 504 } | 492 } |
| 505 | 493 |
| 506 void SkGradientShaderBase::GradientShaderCache::initCache16(GradientShaderCache*
cache) { | 494 void SkGradientShaderBase::GradientShaderCache::initCache16(GradientShaderCache*
cache) { |
| 507 // double the count for dither entries | 495 // double the count for dither entries |
| 508 const int entryCount = kCache16Count * 2; | 496 const int entryCount = kCache16Count * 2; |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 (*stops)[i] = stop; | 1149 (*stops)[i] = stop; |
| 1162 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1150 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
| 1163 } | 1151 } |
| 1164 } | 1152 } |
| 1165 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1153 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
| 1166 | 1154 |
| 1167 return outColors; | 1155 return outColors; |
| 1168 } | 1156 } |
| 1169 | 1157 |
| 1170 #endif | 1158 #endif |
| OLD | NEW |