| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 bool SkGradientShaderBase::setContext(const SkBitmap& device, | 227 bool SkGradientShaderBase::setContext(const SkBitmap& device, |
| 228 const SkPaint& paint, | 228 const SkPaint& paint, |
| 229 const SkMatrix& matrix) { | 229 const SkMatrix& matrix) { |
| 230 if (!this->INHERITED::setContext(device, paint, matrix)) { | 230 if (!this->INHERITED::setContext(device, paint, matrix)) { |
| 231 return false; | 231 return false; |
| 232 } | 232 } |
| 233 | 233 |
| 234 const SkMatrix& inverse = this->getTotalInverse(); | 234 const SkMatrix& inverse = this->getTotalInverse(); |
| 235 | 235 |
| 236 if (!fDstToIndex.setConcat(fPtsToUnit, inverse)) { | 236 fDstToIndex.setConcat(fPtsToUnit, inverse); |
| 237 // need to keep our set/end context calls balanced. | |
| 238 this->INHERITED::endContext(); | |
| 239 return false; | |
| 240 } | |
| 241 | |
| 242 fDstToIndexProc = fDstToIndex.getMapXYProc(); | 237 fDstToIndexProc = fDstToIndex.getMapXYProc(); |
| 243 fDstToIndexClass = (uint8_t)SkShader::ComputeMatrixClass(fDstToIndex); | 238 fDstToIndexClass = (uint8_t)SkShader::ComputeMatrixClass(fDstToIndex); |
| 244 | 239 |
| 245 // now convert our colors in to PMColors | 240 // now convert our colors in to PMColors |
| 246 unsigned paintAlpha = this->getPaintAlpha(); | 241 unsigned paintAlpha = this->getPaintAlpha(); |
| 247 | 242 |
| 248 fFlags = this->INHERITED::getFlags(); | 243 fFlags = this->INHERITED::getFlags(); |
| 249 if (fColorsAreOpaque && paintAlpha == 0xFF) { | 244 if (fColorsAreOpaque && paintAlpha == 0xFF) { |
| 250 fFlags |= kOpaqueAlpha_Flag; | 245 fFlags |= kOpaqueAlpha_Flag; |
| 251 } | 246 } |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 (*stops)[i] = stop; | 1133 (*stops)[i] = stop; |
| 1139 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1134 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
| 1140 } | 1135 } |
| 1141 } | 1136 } |
| 1142 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1137 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
| 1143 | 1138 |
| 1144 return outColors; | 1139 return outColors; |
| 1145 } | 1140 } |
| 1146 | 1141 |
| 1147 #endif | 1142 #endif |
| OLD | NEW |