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 "Sk4fLinearGradient.h" | 8 #include "Sk4fLinearGradient.h" |
9 #include "SkGradientShaderPriv.h" | 9 #include "SkGradientShaderPriv.h" |
10 #include "SkLinearGradient.h" | 10 #include "SkLinearGradient.h" |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 | 1122 |
1123 // We always filter the gradient table. Each table is one row of a textu
re, always y-clamp. | 1123 // We always filter the gradient table. Each table is one row of a textu
re, always y-clamp. |
1124 GrTextureParams params; | 1124 GrTextureParams params; |
1125 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); | 1125 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); |
1126 params.setTileModeX(tileMode); | 1126 params.setTileModeX(tileMode); |
1127 | 1127 |
1128 fRow = fAtlas->lockRow(bitmap); | 1128 fRow = fAtlas->lockRow(bitmap); |
1129 if (-1 != fRow) { | 1129 if (-1 != fRow) { |
1130 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * fAtlas->getNorm
alizedTexelHeight(); | 1130 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * fAtlas->getNorm
alizedTexelHeight(); |
1131 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture(), param
s.filterMode()); | 1131 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture(), param
s.filterMode()); |
1132 fTextureAccess.reset(fAtlas->getTexture(), params); | 1132 fTextureAccess.reset(fAtlas->getTexture(), nullptr, params); |
1133 } else { | 1133 } else { |
1134 SkAutoTUnref<GrTexture> texture( | 1134 SkAutoTUnref<GrTexture> texture( |
1135 GrRefCachedBitmapTexture(ctx, bitmap, params, SkSourceGammaTreat
ment::kRespect)); | 1135 GrRefCachedBitmapTexture(ctx, bitmap, params, SkSourceGammaTreat
ment::kRespect)); |
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, nullptr, 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); |
1146 } | 1146 } |
1147 | 1147 |
1148 GrGradientEffect::~GrGradientEffect() { | 1148 GrGradientEffect::~GrGradientEffect() { |
1149 if (this->useAtlas()) { | 1149 if (this->useAtlas()) { |
1150 fAtlas->unlockRow(fRow); | 1150 fAtlas->unlockRow(fRow); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 (*stops)[i] = stop; | 1208 (*stops)[i] = stop; |
1209 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1209 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
1210 } | 1210 } |
1211 } | 1211 } |
1212 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1212 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
1213 | 1213 |
1214 return outColors; | 1214 return outColors; |
1215 } | 1215 } |
1216 | 1216 |
1217 #endif | 1217 #endif |
OLD | NEW |