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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 const GrGradientEffect& s = CastEffect<GrGradientEffect>(effect); | 859 const GrGradientEffect& s = CastEffect<GrGradientEffect>(effect); |
860 return fTextureAccess.getTexture() == s.fTextureAccess.getTexture() && | 860 return fTextureAccess.getTexture() == s.fTextureAccess.getTexture() && |
861 fTextureAccess.getParams().getTileModeX() == | 861 fTextureAccess.getParams().getTileModeX() == |
862 s.fTextureAccess.getParams().getTileModeX() && | 862 s.fTextureAccess.getParams().getTileModeX() && |
863 this->useAtlas() == s.useAtlas() && | 863 this->useAtlas() == s.useAtlas() && |
864 fYCoord == s.getYCoord() && | 864 fYCoord == s.getYCoord() && |
865 fMatrix.cheapEqualTo(s.getMatrix()); | 865 fMatrix.cheapEqualTo(s.getMatrix()); |
866 } | 866 } |
867 | 867 |
868 void GrGradientEffect::getConstantColorComponents(GrColor* color, uint32_t* vali
dFlags) const { | 868 void GrGradientEffect::getConstantColorComponents(GrColor* color, uint32_t* vali
dFlags) const { |
869 if (fIsOpaque && (kA_ValidComponentFlag & *validFlags) && 0xff == GrColorUnp
ackA(*color)) { | 869 if (fIsOpaque && (kA_GrColorComponentFlag & *validFlags) && 0xff == GrColorU
npackA(*color)) { |
870 *validFlags = kA_ValidComponentFlag; | 870 *validFlags = kA_GrColorComponentFlag; |
871 } else { | 871 } else { |
872 *validFlags = 0; | 872 *validFlags = 0; |
873 } | 873 } |
874 } | 874 } |
875 | 875 |
876 int GrGradientEffect::RandomGradientParams(SkMWCRandom* random, | 876 int GrGradientEffect::RandomGradientParams(SkMWCRandom* random, |
877 SkColor colors[], | 877 SkColor colors[], |
878 SkScalar** stops, | 878 SkScalar** stops, |
879 SkShader::TileMode* tm) { | 879 SkShader::TileMode* tm) { |
880 int outColors = random->nextRangeU(1, kMaxRandomGradientColors); | 880 int outColors = random->nextRangeU(1, kMaxRandomGradientColors); |
(...skipping 10 matching lines...) Expand all Loading... |
891 (*stops)[i] = stop; | 891 (*stops)[i] = stop; |
892 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 892 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
893 } | 893 } |
894 } | 894 } |
895 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 895 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
896 | 896 |
897 return outColors; | 897 return outColors; |
898 } | 898 } |
899 | 899 |
900 #endif | 900 #endif |
OLD | NEW |