| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 void SkGradientShaderBase::flipGradientColors() { | 247 void SkGradientShaderBase::flipGradientColors() { |
| 248 FlipGradientColors(fOrigColors, fRecs, fOrigColors, fRecs, fColorCount); | 248 FlipGradientColors(fOrigColors, fRecs, fOrigColors, fRecs, fColorCount); |
| 249 } | 249 } |
| 250 | 250 |
| 251 bool SkGradientShaderBase::isOpaque() const { | 251 bool SkGradientShaderBase::isOpaque() const { |
| 252 return fColorsAreOpaque; | 252 return fColorsAreOpaque; |
| 253 } | 253 } |
| 254 | 254 |
| 255 SkGradientShaderBase::GradientShaderBaseContext::GradientShaderBaseContext( | 255 SkGradientShaderBase::GradientShaderBaseContext::GradientShaderBaseContext( |
| 256 const SkGradientShaderBase& shader, const SkBitmap& device, | 256 const SkGradientShaderBase& shader, const ContextRec& rec) |
| 257 const SkPaint& paint, const SkMatrix& matrix) | 257 : INHERITED(shader, rec) |
| 258 : INHERITED(shader, device, paint, matrix) | |
| 259 , fCache(shader.refCache(getPaintAlpha())) | 258 , fCache(shader.refCache(getPaintAlpha())) |
| 260 { | 259 { |
| 261 const SkMatrix& inverse = this->getTotalInverse(); | 260 const SkMatrix& inverse = this->getTotalInverse(); |
| 262 | 261 |
| 263 fDstToIndex.setConcat(shader.fPtsToUnit, inverse); | 262 fDstToIndex.setConcat(shader.fPtsToUnit, inverse); |
| 264 | 263 |
| 265 fDstToIndexProc = fDstToIndex.getMapXYProc(); | 264 fDstToIndexProc = fDstToIndex.getMapXYProc(); |
| 266 fDstToIndexClass = (uint8_t)SkShader::Context::ComputeMatrixClass(fDstToInde
x); | 265 fDstToIndexClass = (uint8_t)SkShader::Context::ComputeMatrixClass(fDstToInde
x); |
| 267 | 266 |
| 268 // now convert our colors in to PMColors | 267 // now convert our colors in to PMColors |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 (*stops)[i] = stop; | 1210 (*stops)[i] = stop; |
| 1212 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1211 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
| 1213 } | 1212 } |
| 1214 } | 1213 } |
| 1215 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1214 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
| 1216 | 1215 |
| 1217 return outColors; | 1216 return outColors; |
| 1218 } | 1217 } |
| 1219 | 1218 |
| 1220 #endif | 1219 #endif |
| OLD | NEW |