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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 fDstToIndexProc = fDstToIndex.getMapXYProc(); | 307 fDstToIndexProc = fDstToIndex.getMapXYProc(); |
308 fDstToIndexClass = (uint8_t)SkShader::Context::ComputeMatrixClass(fDstToInde
x); | 308 fDstToIndexClass = (uint8_t)SkShader::Context::ComputeMatrixClass(fDstToInde
x); |
309 | 309 |
310 // now convert our colors in to PMColors | 310 // now convert our colors in to PMColors |
311 unsigned paintAlpha = this->getPaintAlpha(); | 311 unsigned paintAlpha = this->getPaintAlpha(); |
312 | 312 |
313 fFlags = this->INHERITED::getFlags(); | 313 fFlags = this->INHERITED::getFlags(); |
314 if (shader.fColorsAreOpaque && paintAlpha == 0xFF) { | 314 if (shader.fColorsAreOpaque && paintAlpha == 0xFF) { |
315 fFlags |= kOpaqueAlpha_Flag; | 315 fFlags |= kOpaqueAlpha_Flag; |
316 } | 316 } |
317 // we can do span16 as long as our individual colors are opaque, | |
318 // regardless of the paint's alpha | |
319 if (shader.fColorsAreOpaque) { | |
320 fFlags |= kHasSpan16_Flag; | |
321 } | |
322 } | 317 } |
323 | 318 |
324 SkGradientShaderBase::GradientShaderCache::GradientShaderCache( | 319 SkGradientShaderBase::GradientShaderCache::GradientShaderCache( |
325 U8CPU alpha, bool dither, const SkGradientShaderBase& shader) | 320 U8CPU alpha, bool dither, const SkGradientShaderBase& shader) |
326 : fCacheAlpha(alpha) | 321 : fCacheAlpha(alpha) |
327 , fCacheDither(dither) | 322 , fCacheDither(dither) |
328 , fShader(shader) | 323 , fShader(shader) |
329 , fCache16Inited(false) | 324 , fCache16Inited(false) |
330 , fCache32Inited(false) | 325 , fCache32Inited(false) |
331 { | 326 { |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 (*stops)[i] = stop; | 1205 (*stops)[i] = stop; |
1211 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1206 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
1212 } | 1207 } |
1213 } | 1208 } |
1214 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1209 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
1215 | 1210 |
1216 return outColors; | 1211 return outColors; |
1217 } | 1212 } |
1218 | 1213 |
1219 #endif | 1214 #endif |
OLD | NEW |