| 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 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 // doesn't matter how this is set, just be consistent because it is part
of the effect key. | 1093 // doesn't matter how this is set, just be consistent because it is part
of the effect key. |
| 1094 fPremulType = kBeforeInterp_PremulType; | 1094 fPremulType = kBeforeInterp_PremulType; |
| 1095 SkBitmap bitmap; | 1095 SkBitmap bitmap; |
| 1096 shader.getGradientTableBitmap(&bitmap); | 1096 shader.getGradientTableBitmap(&bitmap); |
| 1097 | 1097 |
| 1098 GrTextureStripAtlas::Desc desc; | 1098 GrTextureStripAtlas::Desc desc; |
| 1099 desc.fWidth = bitmap.width(); | 1099 desc.fWidth = bitmap.width(); |
| 1100 desc.fHeight = 32; | 1100 desc.fHeight = 32; |
| 1101 desc.fRowHeight = bitmap.height(); | 1101 desc.fRowHeight = bitmap.height(); |
| 1102 desc.fContext = ctx; | 1102 desc.fContext = ctx; |
| 1103 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.colorType(), bitmap.alph
aType()); | 1103 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info()); |
| 1104 fAtlas = GrTextureStripAtlas::GetAtlas(desc); | 1104 fAtlas = GrTextureStripAtlas::GetAtlas(desc); |
| 1105 SkASSERT(NULL != fAtlas); | 1105 SkASSERT(NULL != fAtlas); |
| 1106 | 1106 |
| 1107 // We always filter the gradient table. Each table is one row of a textu
re, always y-clamp. | 1107 // We always filter the gradient table. Each table is one row of a textu
re, always y-clamp. |
| 1108 GrTextureParams params; | 1108 GrTextureParams params; |
| 1109 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); | 1109 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); |
| 1110 params.setTileModeX(tileMode); | 1110 params.setTileModeX(tileMode); |
| 1111 | 1111 |
| 1112 fRow = fAtlas->lockRow(bitmap); | 1112 fRow = fAtlas->lockRow(bitmap); |
| 1113 if (-1 != fRow) { | 1113 if (-1 != fRow) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 (*stops)[i] = stop; | 1195 (*stops)[i] = stop; |
| 1196 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1196 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
| 1197 } | 1197 } |
| 1198 } | 1198 } |
| 1199 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1199 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
| 1200 | 1200 |
| 1201 return outColors; | 1201 return outColors; |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 #endif | 1204 #endif |
| OLD | NEW |