| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 SkFixed dp = SK_Fixed1 / (desc.fCount - 1); | 118 SkFixed dp = SK_Fixed1 / (desc.fCount - 1); |
| 119 SkFixed p = dp; | 119 SkFixed p = dp; |
| 120 SkFixed scale = (desc.fCount - 1) << 8; // (1 << 24) / dp | 120 SkFixed scale = (desc.fCount - 1) << 8; // (1 << 24) / dp |
| 121 for (int i = 1; i < desc.fCount - 1; i++) { | 121 for (int i = 1; i < desc.fCount - 1; i++) { |
| 122 recs->fPos = p; | 122 recs->fPos = p; |
| 123 recs->fScale = scale; | 123 recs->fScale = scale; |
| 124 recs += 1; | 124 recs += 1; |
| 125 p += dp; | 125 p += dp; |
| 126 } | 126 } |
| 127 recs->fPos = SK_Fixed1; | 127 recs->fPos = SK_Fixed1; |
| 128 recs->fScale = scale; |
| 128 } | 129 } |
| 129 } | 130 } |
| 130 this->initCommon(); | 131 this->initCommon(); |
| 131 } | 132 } |
| 132 | 133 |
| 133 static uint32_t pack_mode_flags(SkShader::TileMode mode, uint32_t flags) { | 134 static uint32_t pack_mode_flags(SkShader::TileMode mode, uint32_t flags) { |
| 134 SkASSERT(0 == (flags >> 28)); | 135 SkASSERT(0 == (flags >> 28)); |
| 135 SkASSERT(0 == ((uint32_t)mode >> 4)); | 136 SkASSERT(0 == ((uint32_t)mode >> 4)); |
| 136 return (flags << 4) | mode; | 137 return (flags << 4) | mode; |
| 137 } | 138 } |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 (*stops)[i] = stop; | 1195 (*stops)[i] = stop; |
| 1195 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1196 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
| 1196 } | 1197 } |
| 1197 } | 1198 } |
| 1198 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1199 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
| 1199 | 1200 |
| 1200 return outColors; | 1201 return outColors; |
| 1201 } | 1202 } |
| 1202 | 1203 |
| 1203 #endif | 1204 #endif |
| OLD | NEW |