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

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

Issue 1767163003: Use float rather than SkFixed for gradient TileProcs. (Closed) Base URL: https://skia.googlesource.com/skia@scalar-pin-to-fixed
Patch Set: Created 4 years, 9 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/gradients/SkClampRange.h ('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 2011 Google Inc. 2 * Copyright 2011 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 "SkClampRange.h" 8 #include "SkClampRange.h"
9 #include "SkMath.h" 9 #include "SkMath.h"
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (fx <= 0) { 58 if (fx <= 0) {
59 fCount0 = 1; 59 fCount0 = 1;
60 } else if (fx < kFracMax_SkGradFixed) { 60 } else if (fx < kFracMax_SkGradFixed) {
61 fCount1 = 1; 61 fCount1 = 1;
62 fFx1 = fx; 62 fFx1 = fx;
63 } else { 63 } else {
64 fCount2 = 1; 64 fCount2 = 1;
65 } 65 }
66 } 66 }
67 67
68 void SkClampRange::init(SkGradFixed fx0, SkGradFixed dx0, int count, int v0, int v1) { 68 void SkClampRange::init(float float_fx0, float float_dx0, int count, int v0, int v1) {
69 SkASSERT(count > 0); 69 SkASSERT(count > 0);
70 70
71 SkGradFixed fx0 = SkFloatToGradFixed(float_fx0);
72 SkGradFixed dx0 = SkFloatToGradFixed(float_dx0);
73
71 fV0 = v0; 74 fV0 = v0;
72 fV1 = v1; 75 fV1 = v1;
73 76
74 // special case 1 == count, as it is slightly common for skia 77 // special case 1 == count, as it is slightly common for skia
75 // and avoids us ever calling divide or 64bit multiply 78 // and avoids us ever calling divide or 64bit multiply
76 if (1 == count) { 79 if (1 == count) {
77 this->initFor1(fx0); 80 this->initFor1(fx0);
78 return; 81 return;
79 } 82 }
80 83
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (doSwap) { 152 if (doSwap) {
150 SkTSwap(fCount0, fCount2); 153 SkTSwap(fCount0, fCount2);
151 SkTSwap(fV0, fV1); 154 SkTSwap(fV0, fV1);
152 dx = -dx; 155 dx = -dx;
153 } 156 }
154 157
155 if (fCount1 > 0) { 158 if (fCount1 > 0) {
156 fFx1 = fx0 + fCount0 * dx; 159 fFx1 = fx0 + fCount0 * dx;
157 } 160 }
158 } 161 }
OLDNEW
« no previous file with comments | « src/effects/gradients/SkClampRange.h ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698