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 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 desc.fWidth = bitmap.width(); | 907 desc.fWidth = bitmap.width(); |
908 desc.fHeight = 32; | 908 desc.fHeight = 32; |
909 desc.fRowHeight = bitmap.height(); | 909 desc.fRowHeight = bitmap.height(); |
910 desc.fContext = ctx; | 910 desc.fContext = ctx; |
911 desc.fConfig = SkBitmapConfig2GrPixelConfig(bitmap.config()); | 911 desc.fConfig = SkBitmapConfig2GrPixelConfig(bitmap.config()); |
912 fAtlas = GrTextureStripAtlas::GetAtlas(desc); | 912 fAtlas = GrTextureStripAtlas::GetAtlas(desc); |
913 GrAssert(NULL != fAtlas); | 913 GrAssert(NULL != fAtlas); |
914 | 914 |
915 // We always filter the gradient table. Each table is one row of a texture,
so always y-clamp. | 915 // We always filter the gradient table. Each table is one row of a texture,
so always y-clamp. |
916 GrTextureParams params; | 916 GrTextureParams params; |
917 params.setBilerp(true); | 917 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); |
918 params.setTileModeX(tileMode); | 918 params.setTileModeX(tileMode); |
919 | 919 |
920 fRow = fAtlas->lockRow(bitmap); | 920 fRow = fAtlas->lockRow(bitmap); |
921 if (-1 != fRow) { | 921 if (-1 != fRow) { |
922 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * | 922 fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf * |
923 fAtlas->getVerticalScaleFactor(); | 923 fAtlas->getVerticalScaleFactor(); |
924 fTextureAccess.reset(fAtlas->getTexture(), params); | 924 fTextureAccess.reset(fAtlas->getTexture(), params); |
925 } else { | 925 } else { |
926 GrTexture* texture = GrLockAndRefCachedBitmapTexture(ctx, bitmap, ¶m
s); | 926 GrTexture* texture = GrLockAndRefCachedBitmapTexture(ctx, bitmap, ¶m
s); |
927 fTextureAccess.reset(texture, params); | 927 fTextureAccess.reset(texture, params); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 (*stops)[i] = stop; | 977 (*stops)[i] = stop; |
978 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 978 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
979 } | 979 } |
980 } | 980 } |
981 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 981 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
982 | 982 |
983 return outColors; | 983 return outColors; |
984 } | 984 } |
985 | 985 |
986 #endif | 986 #endif |
OLD | NEW |