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

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

Issue 1824733002: For *ToFixed, in debug mode, assert that the value is in range. (Closed) Base URL: https://skia.googlesource.com/skia@scalar-pin-to-fixed
Patch Set: Rebase. Created 4 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 | « src/core/SkScan.h ('k') | 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 2012 Google Inc. 2 * Copyright 2012 Google Inc.
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 "SkTwoPointConicalGradient.h" 8 #include "SkTwoPointConicalGradient.h"
9 #include "SkTwoPointConicalGradient_gpu.h" 9 #include "SkTwoPointConicalGradient_gpu.h"
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // find_quad_roots returns the values sorted, so we start with the last 122 // find_quad_roots returns the values sorted, so we start with the last
123 float t = roots[countRoots - 1]; 123 float t = roots[countRoots - 1];
124 float r = lerp(fRec.fRadius, fRec.fDRadius, t); 124 float r = lerp(fRec.fRadius, fRec.fDRadius, t);
125 if (r < 0) { 125 if (r < 0) {
126 t = roots[0]; // might be the same as roots[countRoots-1] 126 t = roots[0]; // might be the same as roots[countRoots-1]
127 r = lerp(fRec.fRadius, fRec.fDRadius, t); 127 r = lerp(fRec.fRadius, fRec.fDRadius, t);
128 if (r < 0) { 128 if (r < 0) {
129 return TwoPtRadial::kDontDrawT; 129 return TwoPtRadial::kDontDrawT;
130 } 130 }
131 } 131 }
132 return SkFloatToFixed(t); 132 return SkFloatPinToFixed(t);
133 } 133 }
134 134
135 typedef void (*TwoPointConicalProc)(TwoPtRadialContext* rec, SkPMColor* dstC, 135 typedef void (*TwoPointConicalProc)(TwoPtRadialContext* rec, SkPMColor* dstC,
136 const SkPMColor* cache, int toggle, int coun t); 136 const SkPMColor* cache, int toggle, int coun t);
137 137
138 static void twopoint_clamp(TwoPtRadialContext* rec, SkPMColor* SK_RESTRICT dstC, 138 static void twopoint_clamp(TwoPtRadialContext* rec, SkPMColor* SK_RESTRICT dstC,
139 const SkPMColor* SK_RESTRICT cache, int toggle, 139 const SkPMColor* SK_RESTRICT cache, int toggle,
140 int count) { 140 int count) {
141 for (; count > 0; --count) { 141 for (; count > 0; --count) {
142 SkFixed t = rec->nextT(); 142 SkFixed t = rec->nextT();
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 str->appendScalar(fCenter2.fY); 388 str->appendScalar(fCenter2.fY);
389 str->append(") radius2: "); 389 str->append(") radius2: ");
390 str->appendScalar(fRadius2); 390 str->appendScalar(fRadius2);
391 str->append(" "); 391 str->append(" ");
392 392
393 this->INHERITED::toString(str); 393 this->INHERITED::toString(str);
394 394
395 str->append(")"); 395 str->append(")");
396 } 396 }
397 #endif 397 #endif
OLDNEW
« no previous file with comments | « src/core/SkScan.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698