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

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

Issue 245623005: Add missing scale value to fix SkGradientShader memory error (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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 | « no previous file | no next file » | 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 SkFixed dp = SK_Fixed1 / (desc.fCount - 1); 118 SkFixed dp = SK_Fixed1 / (desc.fCount - 1);
119 SkFixed p = dp; 119 SkFixed p = dp;
120 SkFixed scale = (desc.fCount - 1) << 8; // (1 << 24) / dp 120 SkFixed scale = (desc.fCount - 1) << 8; // (1 << 24) / dp
121 for (int i = 1; i < desc.fCount - 1; i++) { 121 for (int i = 1; i < desc.fCount - 1; i++) {
122 recs->fPos = p; 122 recs->fPos = p;
123 recs->fScale = scale; 123 recs->fScale = scale;
124 recs += 1; 124 recs += 1;
125 p += dp; 125 p += dp;
126 } 126 }
127 recs->fPos = SK_Fixed1; 127 recs->fPos = SK_Fixed1;
128 recs->fScale = scale;
128 } 129 }
129 } 130 }
130 this->initCommon(); 131 this->initCommon();
131 } 132 }
132 133
133 static uint32_t pack_mode_flags(SkShader::TileMode mode, uint32_t flags) { 134 static uint32_t pack_mode_flags(SkShader::TileMode mode, uint32_t flags) {
134 SkASSERT(0 == (flags >> 28)); 135 SkASSERT(0 == (flags >> 28));
135 SkASSERT(0 == ((uint32_t)mode >> 4)); 136 SkASSERT(0 == ((uint32_t)mode >> 4));
136 return (flags << 4) | mode; 137 return (flags << 4) | mode;
137 } 138 }
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 (*stops)[i] = stop; 1195 (*stops)[i] = stop;
1195 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1196 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1196 } 1197 }
1197 } 1198 }
1198 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1199 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1199 1200
1200 return outColors; 1201 return outColors;
1201 } 1202 }
1202 1203
1203 #endif 1204 #endif
OLDNEW
« 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