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 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 fAtlas = GrTextureStripAtlas::GetAtlas(desc); | 1152 fAtlas = GrTextureStripAtlas::GetAtlas(desc); |
1153 SkASSERT(fAtlas); | 1153 SkASSERT(fAtlas); |
1154 | 1154 |
1155 // We always filter the gradient table. Each table is one row of a textu
re, always y-clamp. | 1155 // We always filter the gradient table. Each table is one row of a textu
re, always y-clamp. |
1156 GrTextureParams params; | 1156 GrTextureParams params; |
1157 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); | 1157 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); |
1158 params.setTileModeX(tileMode); | 1158 params.setTileModeX(tileMode); |
1159 | 1159 |
1160 fRow = fAtlas->lockRow(bitmap); | 1160 fRow = fAtlas->lockRow(bitmap); |
1161 if (-1 != fRow) { | 1161 if (-1 != fRow) { |
1162 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * | 1162 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * fAtlas->getNorm
alizedTexelHeight(); |
1163 fAtlas->getVerticalScaleFactor(); | |
1164 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture()); | 1163 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture()); |
1165 fTextureAccess.reset(fAtlas->getTexture(), params); | 1164 fTextureAccess.reset(fAtlas->getTexture(), params); |
1166 } else { | 1165 } else { |
1167 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap
, ¶ms)); | 1166 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap
, ¶ms)); |
1168 fCoordTransform.reset(kCoordSet, matrix, texture); | 1167 fCoordTransform.reset(kCoordSet, matrix, texture); |
1169 fTextureAccess.reset(texture, params); | 1168 fTextureAccess.reset(texture, params); |
1170 fYCoord = SK_ScalarHalf; | 1169 fYCoord = SK_ScalarHalf; |
1171 } | 1170 } |
1172 this->addTextureAccess(&fTextureAccess); | 1171 this->addTextureAccess(&fTextureAccess); |
1173 } | 1172 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 (*stops)[i] = stop; | 1234 (*stops)[i] = stop; |
1236 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1235 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
1237 } | 1236 } |
1238 } | 1237 } |
1239 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1238 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
1240 | 1239 |
1241 return outColors; | 1240 return outColors; |
1242 } | 1241 } |
1243 | 1242 |
1244 #endif | 1243 #endif |
OLD | NEW |