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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 SkAutoMutexAcquire ama(gMutex); | 612 SkAutoMutexAcquire ama(gMutex); |
613 | 613 |
614 if (NULL == gCache) { | 614 if (NULL == gCache) { |
615 gCache = SkNEW_ARGS(SkBitmapCache, (MAX_NUM_CACHED_GRADIENT_BITMAPS)); | 615 gCache = SkNEW_ARGS(SkBitmapCache, (MAX_NUM_CACHED_GRADIENT_BITMAPS)); |
616 } | 616 } |
617 size_t size = count * sizeof(int32_t); | 617 size_t size = count * sizeof(int32_t); |
618 | 618 |
619 if (!gCache->find(storage.get(), size, bitmap)) { | 619 if (!gCache->find(storage.get(), size, bitmap)) { |
620 // force our cahce32pixelref to be built | 620 // force our cahce32pixelref to be built |
621 (void)cache->getCache32(); | 621 (void)cache->getCache32(); |
622 bitmap->setInfo(SkImageInfo::MakeN32Premul(kCache32Count, 1)); | 622 bitmap->setConfig(SkImageInfo::MakeN32Premul(kCache32Count, 1)); |
623 bitmap->setPixelRef(cache->getCache32PixelRef()); | 623 bitmap->setPixelRef(cache->getCache32PixelRef()); |
624 | 624 |
625 gCache->add(storage.get(), size, *bitmap); | 625 gCache->add(storage.get(), size, *bitmap); |
626 } | 626 } |
627 } | 627 } |
628 | 628 |
629 void SkGradientShaderBase::commonAsAGradient(GradientInfo* info, bool flipGrad)
const { | 629 void SkGradientShaderBase::commonAsAGradient(GradientInfo* info, bool flipGrad)
const { |
630 if (info) { | 630 if (info) { |
631 if (info->fColorCount >= fColorCount) { | 631 if (info->fColorCount >= fColorCount) { |
632 SkColor* colorLoc; | 632 SkColor* colorLoc; |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 (*stops)[i] = stop; | 1149 (*stops)[i] = stop; |
1150 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1150 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
1151 } | 1151 } |
1152 } | 1152 } |
1153 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1153 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
1154 | 1154 |
1155 return outColors; | 1155 return outColors; |
1156 } | 1156 } |
1157 | 1157 |
1158 #endif | 1158 #endif |
OLD | NEW |