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

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

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 | « include/core/SkScalar.h ('k') | src/effects/gradients/SkClampRange.cpp » ('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 #ifndef SkClampRange_DEFINED 8 #ifndef SkClampRange_DEFINED
9 #define SkClampRange_DEFINED 9 #define SkClampRange_DEFINED
10 10
11 #include "SkFixed.h" 11 #include "SkFixed.h"
12 #include "SkScalar.h" 12 #include "SkScalar.h"
13 13
14 #define SkGradFixed SkFixed3232 14 #define SkGradFixed SkFixed3232
15 #define SkScalarToGradFixed(x) SkScalarToFixed3232(x) 15 #define SkScalarToGradFixed(x) SkScalarToFixed3232(x)
16 #define SkFloatToGradFixed(x) SkFloatToFixed3232(x)
16 #define SkFixedToGradFixed(x) SkFixedToFixed3232(x) 17 #define SkFixedToGradFixed(x) SkFixedToFixed3232(x)
17 #define SkGradFixedToFixed(x) (SkFixed)((x) >> 16) 18 #define SkGradFixedToFixed(x) (SkFixed)((x) >> 16)
19 #define SkGradFixedToFloat(x) SkFixed3232ToFloat(x)
18 #define kFracMax_SkGradFixed 0xFFFFFFFFLL 20 #define kFracMax_SkGradFixed 0xFFFFFFFFLL
19 21
20 /** 22 /**
21 * Iteration fixed fx by dx, clamping as you go to [0..kFracMax_SkGradFixed], t his class 23 * Iteration fixed fx by dx, clamping as you go to [0..kFracMax_SkGradFixed], t his class
22 * computes the (up to) 3 spans there are: 24 * computes the (up to) 3 spans there are:
23 * 25 *
24 * range0: use constant value V0 26 * range0: use constant value V0
25 * range1: iterate as usual fx += dx 27 * range1: iterate as usual fx += dx
26 * range2: use constant value V1 28 * range2: use constant value V1
27 */ 29 */
28 struct SkClampRange { 30 struct SkClampRange {
29 int fCount0; // count for fV0 31 int fCount0; // count for fV0
30 int fCount1; // count for interpolating (fV0...fV1) 32 int fCount1; // count for interpolating (fV0...fV1)
31 int fCount2; // count for fV1 33 int fCount2; // count for fV1
32 SkGradFixed fFx1; // initial fx value for the fCount1 range. 34 SkGradFixed fFx1; // initial fx value for the fCount1 range.
33 // only valid if fCount1 > 0 35 // only valid if fCount1 > 0
34 int fV0, fV1; 36 int fV0, fV1;
35 37
36 void init(SkGradFixed fx, SkGradFixed dx, int count, int v0, int v1); 38 void init(float fx, float dx, int count, int v0, int v1);
37 39
38 void validate(int count) const { 40 void validate(int count) const {
39 #ifdef SK_DEBUG 41 #ifdef SK_DEBUG
40 SkASSERT(fCount0 >= 0); 42 SkASSERT(fCount0 >= 0);
41 SkASSERT(fCount1 >= 0); 43 SkASSERT(fCount1 >= 0);
42 SkASSERT(fCount2 >= 0); 44 SkASSERT(fCount2 >= 0);
43 SkASSERT(fCount0 + fCount1 + fCount2 == count); 45 SkASSERT(fCount0 + fCount1 + fCount2 == count);
44 #endif 46 #endif
45 } 47 }
46 48
47 private: 49 private:
48 void initFor1(SkGradFixed fx); 50 void initFor1(SkGradFixed fx);
49 }; 51 };
50 52
51 #endif 53 #endif
OLDNEW
« no previous file with comments | « include/core/SkScalar.h ('k') | src/effects/gradients/SkClampRange.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698