| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 fLocalMatrix = &fLocalMatrixStorage; | 60 fLocalMatrix = &fLocalMatrixStorage; |
| 61 buffer.readMatrix(&fLocalMatrixStorage); | 61 buffer.readMatrix(&fLocalMatrixStorage); |
| 62 } else { | 62 } else { |
| 63 fLocalMatrix = NULL; | 63 fLocalMatrix = NULL; |
| 64 } | 64 } |
| 65 return buffer.isValid(); | 65 return buffer.isValid(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 ////////////////////////////////////////////////////////////////////////////////
//////////// | 68 ////////////////////////////////////////////////////////////////////////////////
//////////// |
| 69 | 69 |
| 70 SkGradientShaderBase::SkGradientShaderBase(const Descriptor& desc) | 70 SkGradientShaderBase::SkGradientShaderBase(const Descriptor& desc, const SkMatri
x& ptsToUnit) |
| 71 : INHERITED(desc.fLocalMatrix) | 71 : INHERITED(desc.fLocalMatrix) |
| 72 , fPtsToUnit(ptsToUnit) |
| 72 { | 73 { |
| 74 fPtsToUnit.getType(); // Precache so reads are threadsafe. |
| 73 SkASSERT(desc.fCount > 1); | 75 SkASSERT(desc.fCount > 1); |
| 74 | 76 |
| 75 fGradFlags = SkToU8(desc.fGradFlags); | 77 fGradFlags = SkToU8(desc.fGradFlags); |
| 76 | 78 |
| 77 SkASSERT((unsigned)desc.fTileMode < SkShader::kTileModeCount); | 79 SkASSERT((unsigned)desc.fTileMode < SkShader::kTileModeCount); |
| 78 SkASSERT(SkShader::kTileModeCount == SK_ARRAY_COUNT(gTileProcs)); | 80 SkASSERT(SkShader::kTileModeCount == SK_ARRAY_COUNT(gTileProcs)); |
| 79 fTileMode = desc.fTileMode; | 81 fTileMode = desc.fTileMode; |
| 80 fTileProc = gTileProcs[desc.fTileMode]; | 82 fTileProc = gTileProcs[desc.fTileMode]; |
| 81 | 83 |
| 82 /* Note: we let the caller skip the first and/or last position. | 84 /* Note: we let the caller skip the first and/or last position. |
| (...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 (*stops)[i] = stop; | 1182 (*stops)[i] = stop; |
| 1181 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1183 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
| 1182 } | 1184 } |
| 1183 } | 1185 } |
| 1184 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1186 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
| 1185 | 1187 |
| 1186 return outColors; | 1188 return outColors; |
| 1187 } | 1189 } |
| 1188 | 1190 |
| 1189 #endif | 1191 #endif |
| OLD | NEW |