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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 } | 510 } |
511 return fCache16; | 511 return fCache16; |
512 } | 512 } |
513 | 513 |
514 const SkPMColor* SkGradientShaderBase::getCache32() const { | 514 const SkPMColor* SkGradientShaderBase::getCache32() const { |
515 if (fCache32 == NULL) { | 515 if (fCache32 == NULL) { |
516 SkImageInfo info; | 516 SkImageInfo info; |
517 info.fWidth = kCache32Count; | 517 info.fWidth = kCache32Count; |
518 info.fHeight = 4; // for our 4 dither rows | 518 info.fHeight = 4; // for our 4 dither rows |
519 info.fAlphaType = kPremul_SkAlphaType; | 519 info.fAlphaType = kPremul_SkAlphaType; |
520 info.fColorType = kPMColor_SkColorType; | 520 info.fColorType = kN32_SkColorType; |
521 | 521 |
522 if (NULL == fCache32PixelRef) { | 522 if (NULL == fCache32PixelRef) { |
523 fCache32PixelRef = SkMallocPixelRef::NewAllocate(info, 0, NULL); | 523 fCache32PixelRef = SkMallocPixelRef::NewAllocate(info, 0, NULL); |
524 } | 524 } |
525 fCache32 = (SkPMColor*)fCache32PixelRef->getAddr(); | 525 fCache32 = (SkPMColor*)fCache32PixelRef->getAddr(); |
526 if (fColorCount == 2) { | 526 if (fColorCount == 2) { |
527 Build32bitCache(fCache32, fOrigColors[0], fOrigColors[1], | 527 Build32bitCache(fCache32, fOrigColors[0], fOrigColors[1], |
528 kCache32Count, fCacheAlpha, fGradFlags); | 528 kCache32Count, fCacheAlpha, fGradFlags); |
529 } else { | 529 } else { |
530 Rec* rec = fRecs; | 530 Rec* rec = fRecs; |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 (*stops)[i] = stop; | 1133 (*stops)[i] = stop; |
1134 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; |
1135 } | 1135 } |
1136 } | 1136 } |
1137 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1137 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
1138 | 1138 |
1139 return outColors; | 1139 return outColors; |
1140 } | 1140 } |
1141 | 1141 |
1142 #endif | 1142 #endif |
OLD | NEW |