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

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

Issue 608253002: Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
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 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 return fTextureAccess.getTexture() == s.fTextureAccess.getTexture() && 1210 return fTextureAccess.getTexture() == s.fTextureAccess.getTexture() &&
1211 fTextureAccess.getParams().getTileModeX() == 1211 fTextureAccess.getParams().getTileModeX() ==
1212 s.fTextureAccess.getParams().getTileModeX() && 1212 s.fTextureAccess.getParams().getTileModeX() &&
1213 this->useAtlas() == s.useAtlas() && 1213 this->useAtlas() == s.useAtlas() &&
1214 fCoordTransform.getMatrix().cheapEqualTo(s.fCoordTransform.getMatrix ()); 1214 fCoordTransform.getMatrix().cheapEqualTo(s.fCoordTransform.getMatrix ());
1215 } 1215 }
1216 1216
1217 return false; 1217 return false;
1218 } 1218 }
1219 1219
1220 void GrGradientEffect::getConstantColorComponents(GrColor* color, uint32_t* vali dFlags) const { 1220 void GrGradientEffect::onGetConstantColorComponents(GrColor* color, uint32_t* va lidFlags,
1221 bool* isSingleComponent) con st {
1221 if (fIsOpaque && (kA_GrColorComponentFlag & *validFlags) && 0xff == GrColorU npackA(*color)) { 1222 if (fIsOpaque && (kA_GrColorComponentFlag & *validFlags) && 0xff == GrColorU npackA(*color)) {
1222 *validFlags = kA_GrColorComponentFlag; 1223 *validFlags = kA_GrColorComponentFlag;
1223 } else { 1224 } else {
1224 *validFlags = 0; 1225 *validFlags = 0;
1225 } 1226 }
1226 } 1227 }
1227 1228
1228 int GrGradientEffect::RandomGradientParams(SkRandom* random, 1229 int GrGradientEffect::RandomGradientParams(SkRandom* random,
1229 SkColor colors[], 1230 SkColor colors[],
1230 SkScalar** stops, 1231 SkScalar** stops,
(...skipping 12 matching lines...) Expand all
1243 (*stops)[i] = stop; 1244 (*stops)[i] = stop;
1244 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1245 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1245 } 1246 }
1246 } 1247 }
1247 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1248 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1248 1249
1249 return outColors; 1250 return outColors;
1250 } 1251 }
1251 1252
1252 #endif 1253 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698