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