Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: src/effects/gradients/SkGradientShader.cpp

Issue 571163002: removing GrDrawEffect (Closed) Base URL: https://skia.googlesource.com/skia.git@gp3
Patch Set: rebase after revert Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 float a = SkColorGetA(*color) / 255.f; 994 float a = SkColorGetA(*color) / 255.f;
995 float aDiv255 = a / 255.f; 995 float aDiv255 = a / 255.f;
996 pdman.set4f(uni, 996 pdman.set4f(uni,
997 SkColorGetR(*color) * aDiv255, 997 SkColorGetR(*color) * aDiv255,
998 SkColorGetG(*color) * aDiv255, 998 SkColorGetG(*color) * aDiv255,
999 SkColorGetB(*color) * aDiv255, 999 SkColorGetB(*color) * aDiv255,
1000 a); 1000 a);
1001 } 1001 }
1002 1002
1003 void GrGLGradientEffect::setData(const GrGLProgramDataManager& pdman, 1003 void GrGLGradientEffect::setData(const GrGLProgramDataManager& pdman,
1004 const GrDrawEffect& drawEffect) { 1004 const GrEffect& effect) {
1005 1005
1006 const GrGradientEffect& e = drawEffect.castEffect<GrGradientEffect>(); 1006 const GrGradientEffect& e = effect.cast<GrGradientEffect>();
1007 1007
1008 1008
1009 if (SkGradientShaderBase::kTwo_GpuColorType == e.getColorType()){ 1009 if (SkGradientShaderBase::kTwo_GpuColorType == e.getColorType()){
1010 1010
1011 if (GrGradientEffect::kBeforeInterp_PremulType == e.getPremulType()) { 1011 if (GrGradientEffect::kBeforeInterp_PremulType == e.getPremulType()) {
1012 set_mul_color_uni(pdman, fColorStartUni, e.getColors(0)); 1012 set_mul_color_uni(pdman, fColorStartUni, e.getColors(0));
1013 set_mul_color_uni(pdman, fColorEndUni, e.getColors(1)); 1013 set_mul_color_uni(pdman, fColorEndUni, e.getColors(1));
1014 } else { 1014 } else {
1015 set_color_uni(pdman, fColorStartUni, e.getColors(0)); 1015 set_color_uni(pdman, fColorStartUni, e.getColors(0));
1016 set_color_uni(pdman, fColorEndUni, e.getColors(1)); 1016 set_color_uni(pdman, fColorEndUni, e.getColors(1));
(...skipping 14 matching lines...) Expand all
1031 1031
1032 SkScalar yCoord = e.getYCoord(); 1032 SkScalar yCoord = e.getYCoord();
1033 if (yCoord != fCachedYCoord) { 1033 if (yCoord != fCachedYCoord) {
1034 pdman.set1f(fFSYUni, yCoord); 1034 pdman.set1f(fFSYUni, yCoord);
1035 fCachedYCoord = yCoord; 1035 fCachedYCoord = yCoord;
1036 } 1036 }
1037 } 1037 }
1038 } 1038 }
1039 1039
1040 1040
1041 uint32_t GrGLGradientEffect::GenBaseGradientKey(const GrDrawEffect& drawEffect) { 1041 uint32_t GrGLGradientEffect::GenBaseGradientKey(const GrEffect& effect) {
1042 const GrGradientEffect& e = drawEffect.castEffect<GrGradientEffect>(); 1042 const GrGradientEffect& e = effect.cast<GrGradientEffect>();
1043 1043
1044 uint32_t key = 0; 1044 uint32_t key = 0;
1045 1045
1046 if (SkGradientShaderBase::kTwo_GpuColorType == e.getColorType()) { 1046 if (SkGradientShaderBase::kTwo_GpuColorType == e.getColorType()) {
1047 key |= kTwoColorKey; 1047 key |= kTwoColorKey;
1048 } else if (SkGradientShaderBase::kThree_GpuColorType == e.getColorType()){ 1048 } else if (SkGradientShaderBase::kThree_GpuColorType == e.getColorType()){
1049 key |= kThreeColorKey; 1049 key |= kThreeColorKey;
1050 } 1050 }
1051 1051
1052 if (GrGradientEffect::kBeforeInterp_PremulType == e.getPremulType()) { 1052 if (GrGradientEffect::kBeforeInterp_PremulType == e.getPremulType()) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 this->addCoordTransform(&fCoordTransform); 1179 this->addCoordTransform(&fCoordTransform);
1180 } 1180 }
1181 1181
1182 GrGradientEffect::~GrGradientEffect() { 1182 GrGradientEffect::~GrGradientEffect() {
1183 if (this->useAtlas()) { 1183 if (this->useAtlas()) {
1184 fAtlas->unlockRow(fRow); 1184 fAtlas->unlockRow(fRow);
1185 } 1185 }
1186 } 1186 }
1187 1187
1188 bool GrGradientEffect::onIsEqual(const GrEffect& effect) const { 1188 bool GrGradientEffect::onIsEqual(const GrEffect& effect) const {
1189 const GrGradientEffect& s = CastEffect<GrGradientEffect>(effect); 1189 const GrGradientEffect& s = effect.cast<GrGradientEffect>();
1190 1190
1191 if (this->fColorType == s.getColorType()){ 1191 if (this->fColorType == s.getColorType()){
1192 1192
1193 if (SkGradientShaderBase::kTwo_GpuColorType == fColorType) { 1193 if (SkGradientShaderBase::kTwo_GpuColorType == fColorType) {
1194 if (*this->getColors(0) != *s.getColors(0) || 1194 if (*this->getColors(0) != *s.getColors(0) ||
1195 *this->getColors(1) != *s.getColors(1)) { 1195 *this->getColors(1) != *s.getColors(1)) {
1196 return false; 1196 return false;
1197 } 1197 }
1198 } else if (SkGradientShaderBase::kThree_GpuColorType == fColorType) { 1198 } else if (SkGradientShaderBase::kThree_GpuColorType == fColorType) {
1199 if (*this->getColors(0) != *s.getColors(0) || 1199 if (*this->getColors(0) != *s.getColors(0) ||
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 (*stops)[i] = stop; 1243 (*stops)[i] = stop;
1244 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1244 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1245 } 1245 }
1246 } 1246 }
1247 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1247 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1248 1248
1249 return outColors; 1249 return outColors;
1250 } 1250 }
1251 1251
1252 #endif 1252 #endif
OLDNEW
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698