| 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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 SkASSERT(fAtlas); | 1099 SkASSERT(fAtlas); |
| 1100 | 1100 |
| 1101 // We always filter the gradient table. Each table is one row of a textu
re, always y-clamp. | 1101 // We always filter the gradient table. Each table is one row of a textu
re, always y-clamp. |
| 1102 GrTextureParams params; | 1102 GrTextureParams params; |
| 1103 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); | 1103 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); |
| 1104 params.setTileModeX(tileMode); | 1104 params.setTileModeX(tileMode); |
| 1105 | 1105 |
| 1106 fRow = fAtlas->lockRow(bitmap); | 1106 fRow = fAtlas->lockRow(bitmap); |
| 1107 if (-1 != fRow) { | 1107 if (-1 != fRow) { |
| 1108 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * fAtlas->getNorm
alizedTexelHeight(); | 1108 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * fAtlas->getNorm
alizedTexelHeight(); |
| 1109 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture()); | 1109 fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture(), param
s.filterMode()); |
| 1110 fTextureAccess.reset(fAtlas->getTexture(), params); | 1110 fTextureAccess.reset(fAtlas->getTexture(), params); |
| 1111 } else { | 1111 } else { |
| 1112 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap
, ¶ms)); | 1112 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap
, ¶ms)); |
| 1113 fCoordTransform.reset(kCoordSet, matrix, texture); | 1113 fCoordTransform.reset(kCoordSet, matrix, texture, params.filterMode(
)); |
| 1114 fTextureAccess.reset(texture, params); | 1114 fTextureAccess.reset(texture, params); |
| 1115 fYCoord = SK_ScalarHalf; | 1115 fYCoord = SK_ScalarHalf; |
| 1116 } | 1116 } |
| 1117 this->addTextureAccess(&fTextureAccess); | 1117 this->addTextureAccess(&fTextureAccess); |
| 1118 } | 1118 } |
| 1119 this->addCoordTransform(&fCoordTransform); | 1119 this->addCoordTransform(&fCoordTransform); |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 GrGradientEffect::~GrGradientEffect() { | 1122 GrGradientEffect::~GrGradientEffect() { |
| 1123 if (this->useAtlas()) { | 1123 if (this->useAtlas()) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 (*stops)[i] = stop; | 1180 (*stops)[i] = stop; |
| 1181 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1181 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
| 1182 } | 1182 } |
| 1183 } | 1183 } |
| 1184 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1184 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
| 1185 | 1185 |
| 1186 return outColors; | 1186 return outColors; |
| 1187 } | 1187 } |
| 1188 | 1188 |
| 1189 #endif | 1189 #endif |
| OLD | NEW |