| 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 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); | 1123 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); |
| 1124 params.setTileModeX(tileMode); | 1124 params.setTileModeX(tileMode); |
| 1125 | 1125 |
| 1126 fRow = fAtlas->lockRow(bitmap); | 1126 fRow = fAtlas->lockRow(bitmap); |
| 1127 if (-1 != fRow) { | 1127 if (-1 != fRow) { |
| 1128 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * fAtlas->getNorm
alizedTexelHeight(); | 1128 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * fAtlas->getNorm
alizedTexelHeight(); |
| 1129 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture(), param
s.filterMode()); | 1129 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture(), param
s.filterMode()); |
| 1130 fTextureAccess.reset(fAtlas->getTexture(), params); | 1130 fTextureAccess.reset(fAtlas->getTexture(), params); |
| 1131 } else { | 1131 } else { |
| 1132 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap
, ¶ms)); | 1132 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap
, ¶ms)); |
| 1133 if (!texture) { |
| 1134 return; |
| 1135 } |
| 1133 fCoordTransform.reset(kCoordSet, matrix, texture, params.filterMode(
)); | 1136 fCoordTransform.reset(kCoordSet, matrix, texture, params.filterMode(
)); |
| 1134 fTextureAccess.reset(texture, params); | 1137 fTextureAccess.reset(texture, params); |
| 1135 fYCoord = SK_ScalarHalf; | 1138 fYCoord = SK_ScalarHalf; |
| 1136 } | 1139 } |
| 1137 this->addTextureAccess(&fTextureAccess); | 1140 this->addTextureAccess(&fTextureAccess); |
| 1138 } | 1141 } |
| 1139 this->addCoordTransform(&fCoordTransform); | 1142 this->addCoordTransform(&fCoordTransform); |
| 1140 } | 1143 } |
| 1141 | 1144 |
| 1142 GrGradientEffect::~GrGradientEffect() { | 1145 GrGradientEffect::~GrGradientEffect() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 (*stops)[i] = stop; | 1203 (*stops)[i] = stop; |
| 1201 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1204 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
| 1202 } | 1205 } |
| 1203 } | 1206 } |
| 1204 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1207 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
| 1205 | 1208 |
| 1206 return outColors; | 1209 return outColors; |
| 1207 } | 1210 } |
| 1208 | 1211 |
| 1209 #endif | 1212 #endif |
| OLD | NEW |