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

Side by Side Diff: include/effects/SkGradientShader.h

Issue 2371603003: Remove outdated comments about pre-sk_sp semantics (Closed)
Patch Set: Created 4 years, 2 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 #ifndef SkGradientShader_DEFINED 8 #ifndef SkGradientShader_DEFINED
9 #define SkGradientShader_DEFINED 9 #define SkGradientShader_DEFINED
10 10
11 #include "SkShader.h" 11 #include "SkShader.h"
12 12
13 /** \class SkGradientShader 13 /** \class SkGradientShader
14 14
15 SkGradientShader hosts factories for creating subclasses of SkShader that 15 SkGradientShader hosts factories for creating subclasses of SkShader that
16 render linear and radial gradients. 16 render linear and radial gradients.
17 */ 17 */
18 class SK_API SkGradientShader { 18 class SK_API SkGradientShader {
19 public: 19 public:
20 enum Flags { 20 enum Flags {
21 /** By default gradients will interpolate their colors in unpremul space 21 /** By default gradients will interpolate their colors in unpremul space
22 * and then premultiply each of the results. By setting this flag, the 22 * and then premultiply each of the results. By setting this flag, the
23 * gradients will premultiply their colors first, and then interpolate 23 * gradients will premultiply their colors first, and then interpolate
24 * between them. 24 * between them.
25 */ 25 */
26 kInterpolateColorsInPremul_Flag = 1 << 0, 26 kInterpolateColorsInPremul_Flag = 1 << 0,
27 }; 27 };
28 28
29 /** Returns a shader that generates a linear gradient between the two 29 /** Returns a shader that generates a linear gradient between the two specif ied points.
30 specified points.
31 <p /> 30 <p />
32 CreateLinear returns a shader with a reference count of 1. 31 @param pts The start and end points for the gradient.
33 The caller should decrement the shader's reference count when done with the shader.
34 It is an error for count to be < 2.
35 @param pts The start and end points for the gradient.
36 @param colors The array[count] of colors, to be distributed between th e two points 32 @param colors The array[count] of colors, to be distributed between th e two points
37 @param pos May be NULL. array[count] of SkScalars, or NULL, of the relative position of 33 @param pos May be NULL. array[count] of SkScalars, or NULL, of the relative position of
38 each corresponding color in the colors array. If this is NULL, 34 each corresponding color in the colors array. If this is NULL,
39 the the colors are distributed evenly between the start and end point. 35 the the colors are distributed evenly between the start and end point.
40 If this is not null, the values must begin with 0, end w ith 1.0, and 36 If this is not null, the values must begin with 0, end w ith 1.0, and
41 intermediate values must be strictly increasing. 37 intermediate values must be strictly increasing.
42 @param count Must be >=2. The number of colors (and pos if not NULL) entries. 38 @param count Must be >=2. The number of colors (and pos if not NULL) entries.
43 @param mode The tiling mode 39 @param mode The tiling mode
44 */ 40 */
45 static sk_sp<SkShader> MakeLinear(const SkPoint pts[2], 41 static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
46 const SkColor colors[], const SkScalar pos [], int count, 42 const SkColor colors[], const SkScalar pos [], int count,
47 SkShader::TileMode mode, 43 SkShader::TileMode mode,
48 uint32_t flags, const SkMatrix* localMatri x); 44 uint32_t flags, const SkMatrix* localMatri x);
49 static sk_sp<SkShader> MakeLinear(const SkPoint pts[2], 45 static sk_sp<SkShader> MakeLinear(const SkPoint pts[2],
50 const SkColor colors[], const SkScalar pos [], int count, 46 const SkColor colors[], const SkScalar pos [], int count,
51 SkShader::TileMode mode) { 47 SkShader::TileMode mode) {
52 return MakeLinear(pts, colors, pos, count, mode, 0, NULL); 48 return MakeLinear(pts, colors, pos, count, mode, 0, NULL);
53 } 49 }
54 50
55 /** Returns a shader that generates a radial gradient given the center and r adius. 51 /** Returns a shader that generates a radial gradient given the center and r adius.
56 <p /> 52 <p />
57 CreateRadial returns a shader with a reference count of 1.
58 The caller should decrement the shader's reference count when done with the shader.
59 It is an error for colorCount to be < 2, or for radius to be <= 0.
60 @param center The center of the circle for this gradient 53 @param center The center of the circle for this gradient
61 @param radius Must be positive. The radius of the circle for this grad ient 54 @param radius Must be positive. The radius of the circle for this grad ient
62 @param colors The array[count] of colors, to be distributed between th e center and edge of the circle 55 @param colors The array[count] of colors, to be distributed between th e center and edge of the circle
63 @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of 56 @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of
64 each corresponding color in the colors array. If this is NULL, 57 each corresponding color in the colors array. If this is NULL,
65 the the colors are distributed evenly between the center and edge of the circle. 58 the the colors are distributed evenly between the center and edge of the circle.
66 If this is not null, the values must begin with 0, end w ith 1.0, and 59 If this is not null, the values must begin with 0, end w ith 1.0, and
67 intermediate values must be strictly increasing. 60 intermediate values must be strictly increasing.
68 @param count Must be >= 2. The number of colors (and pos if not NULL) entries 61 @param count Must be >= 2. The number of colors (and pos if not NULL) entries
69 @param mode The tiling mode 62 @param mode The tiling mode
(...skipping 22 matching lines...) Expand all
92 static sk_sp<SkShader> MakeTwoPointConical(const SkPoint& start, SkScalar st artRadius, 85 static sk_sp<SkShader> MakeTwoPointConical(const SkPoint& start, SkScalar st artRadius,
93 const SkPoint& end, SkScalar endR adius, 86 const SkPoint& end, SkScalar endR adius,
94 const SkColor colors[], const SkS calar pos[], 87 const SkColor colors[], const SkS calar pos[],
95 int count, SkShader::TileMode mod e) { 88 int count, SkShader::TileMode mod e) {
96 return MakeTwoPointConical(start, startRadius, end, endRadius, colors, p os, count, mode, 89 return MakeTwoPointConical(start, startRadius, end, endRadius, colors, p os, count, mode,
97 0, NULL); 90 0, NULL);
98 } 91 }
99 92
100 /** Returns a shader that generates a sweep gradient given a center. 93 /** Returns a shader that generates a sweep gradient given a center.
101 <p /> 94 <p />
102 CreateSweep returns a shader with a reference count of 1.
103 The caller should decrement the shader's reference count when done with the shader.
104 It is an error for colorCount to be < 2.
105 @param cx The X coordinate of the center of the sweep 95 @param cx The X coordinate of the center of the sweep
106 @param cx The Y coordinate of the center of the sweep 96 @param cx The Y coordinate of the center of the sweep
107 @param colors The array[count] of colors, to be distributed around the center. 97 @param colors The array[count] of colors, to be distributed around the center.
108 @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of 98 @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of
109 each corresponding color in the colors array. If this is NULL, 99 each corresponding color in the colors array. If this is NULL,
110 the the colors are distributed evenly between the center and edge of the circle. 100 the the colors are distributed evenly between the center and edge of the circle.
111 If this is not null, the values must begin with 0, end w ith 1.0, and 101 If this is not null, the values must begin with 0, end w ith 1.0, and
112 intermediate values must be strictly increasing. 102 intermediate values must be strictly increasing.
113 @param count Must be >= 2. The number of colors (and pos if not NULL) entries 103 @param count Must be >= 2. The number of colors (and pos if not NULL) entries
114 */ 104 */
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 const SkColor colors[], const SkScalar pos[], i nt count) { 161 const SkColor colors[], const SkScalar pos[], i nt count) {
172 return CreateSweep(cx, cy, colors, pos, count, 0, NULL); 162 return CreateSweep(cx, cy, colors, pos, count, 0, NULL);
173 } 163 }
174 #endif 164 #endif
175 165
176 166
177 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() 167 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
178 }; 168 };
179 169
180 #endif 170 #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