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

Unified Diff: src/effects/gradients/SkGradientShader.cpp

Issue 2345343002: Improve ColorStopOptimizer safety (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkGradientShader.cpp
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 749d1751e280f8b94e2f2d70e5771e747c823d24..3a28da8099501708cf9ced29befa7154207293c7 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -845,19 +845,19 @@ sk_sp<SkShader> SkGradientShader::MakeTwoPointConical(const SkPoint& start,
return sk_make_sp<SkTwoPointConicalGradient>(start, startRadius, end, endRadius,
flipGradient, desc);
} else {
- SkAutoSTArray<8, SkColor> colorsNew(colorCount);
- SkAutoSTArray<8, SkScalar> posNew(colorCount);
- for (int i = 0; i < colorCount; ++i) {
- colorsNew[i] = opt.fColors[colorCount - i - 1];
+ SkAutoSTArray<8, SkColor> colorsNew(opt.fCount);
+ SkAutoSTArray<8, SkScalar> posNew(opt.fCount);
+ for (int i = 0; i < opt.fCount; ++i) {
+ colorsNew[i] = opt.fColors[opt.fCount - i - 1];
}
if (pos) {
- for (int i = 0; i < colorCount; ++i) {
- posNew[i] = 1 - opt.fPos[colorCount - i - 1];
+ for (int i = 0; i < opt.fCount; ++i) {
+ posNew[i] = 1 - opt.fPos[opt.fCount - i - 1];
}
- desc_init(&desc, colorsNew.get(), posNew.get(), colorCount, mode, flags, localMatrix);
+ desc_init(&desc, colorsNew.get(), posNew.get(), opt.fCount, mode, flags, localMatrix);
} else {
- desc_init(&desc, colorsNew.get(), nullptr, colorCount, mode, flags, localMatrix);
+ desc_init(&desc, colorsNew.get(), nullptr, opt.fCount, mode, flags, localMatrix);
}
return sk_make_sp<SkTwoPointConicalGradient>(end, endRadius, start, startRadius,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698