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

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

Issue 245963010: Move SkShader::fLocalMatrix into SkShader constructor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 6 years, 7 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/SkShader.h ('k') | samplecode/SampleAARectModes.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 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
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 If this is not null, the values must begin with 0, end w ith 1.0, and 42 If this is not null, the values must begin with 0, end w ith 1.0, and
43 intermediate values must be strictly increasing. 43 intermediate values must be strictly increasing.
44 @param count Must be >=2. The number of colors (and pos if not NULL) entries. 44 @param count Must be >=2. The number of colors (and pos if not NULL) entries.
45 @param mode The tiling mode 45 @param mode The tiling mode
46 @param mapper May be NULL. Callback to modify the spread of the colors . 46 @param mapper May be NULL. Callback to modify the spread of the colors .
47 */ 47 */
48 static SkShader* CreateLinear(const SkPoint pts[2], 48 static SkShader* CreateLinear(const SkPoint pts[2],
49 const SkColor colors[], const SkScalar pos[], int count, 49 const SkColor colors[], const SkScalar pos[], int count,
50 SkShader::TileMode mode, 50 SkShader::TileMode mode,
51 SkUnitMapper* mapper = NULL, 51 SkUnitMapper* mapper = NULL,
52 uint32_t flags = 0); 52 uint32_t flags = 0,
53 const SkMatrix* localMatrix = NULL);
53 54
54 /** Returns a shader that generates a radial gradient given the center and r adius. 55 /** Returns a shader that generates a radial gradient given the center and r adius.
55 <p /> 56 <p />
56 CreateRadial returns a shader with a reference count of 1. 57 CreateRadial returns a shader with a reference count of 1.
57 The caller should decrement the shader's reference count when done with the shader. 58 The caller should decrement the shader's reference count when done with the shader.
58 It is an error for colorCount to be < 2, or for radius to be <= 0. 59 It is an error for colorCount to be < 2, or for radius to be <= 0.
59 @param center The center of the circle for this gradient 60 @param center The center of the circle for this gradient
60 @param radius Must be positive. The radius of the circle for this grad ient 61 @param radius Must be positive. The radius of the circle for this grad ient
61 @param colors The array[count] of colors, to be distributed between th e center and edge of the circle 62 @param colors The array[count] of colors, to be distributed between th e center and edge of the circle
62 @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of 63 @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of
63 each corresponding color in the colors array. If this is NULL, 64 each corresponding color in the colors array. If this is NULL,
64 the the colors are distributed evenly between the center and edge of the circle. 65 the the colors are distributed evenly between the center and edge of the circle.
65 If this is not null, the values must begin with 0, end w ith 1.0, and 66 If this is not null, the values must begin with 0, end w ith 1.0, and
66 intermediate values must be strictly increasing. 67 intermediate values must be strictly increasing.
67 @param count Must be >= 2. The number of colors (and pos if not NULL) entries 68 @param count Must be >= 2. The number of colors (and pos if not NULL) entries
68 @param mode The tiling mode 69 @param mode The tiling mode
69 @param mapper May be NULL. Callback to modify the spread of the colors . 70 @param mapper May be NULL. Callback to modify the spread of the colors .
70 */ 71 */
71 static SkShader* CreateRadial(const SkPoint& center, SkScalar radius, 72 static SkShader* CreateRadial(const SkPoint& center, SkScalar radius,
72 const SkColor colors[], const SkScalar pos[], int count, 73 const SkColor colors[], const SkScalar pos[], int count,
73 SkShader::TileMode mode, 74 SkShader::TileMode mode,
74 SkUnitMapper* mapper = NULL, 75 SkUnitMapper* mapper = NULL,
75 uint32_t flags = 0); 76 uint32_t flags = 0,
77 const SkMatrix* localMatrix = NULL);
76 78
77 /** Returns a shader that generates a radial gradient given the start positi on, start radius, end position and end radius. 79 /** Returns a shader that generates a radial gradient given the start positi on, start radius, end position and end radius.
78 <p /> 80 <p />
79 CreateTwoPointRadial returns a shader with a reference count of 1. 81 CreateTwoPointRadial returns a shader with a reference count of 1.
80 The caller should decrement the shader's reference count when done with the shader. 82 The caller should decrement the shader's reference count when done with the shader.
81 It is an error for colorCount to be < 2, for startRadius or endRadius to be < 0, or for 83 It is an error for colorCount to be < 2, for startRadius or endRadius to be < 0, or for
82 startRadius to be equal to endRadius. 84 startRadius to be equal to endRadius.
83 @param start The center of the start circle for this gradient 85 @param start The center of the start circle for this gradient
84 @param startRadius Must be positive. The radius of the start circle f or this gradient. 86 @param startRadius Must be positive. The radius of the start circle f or this gradient.
85 @param end The center of the end circle for this gradient 87 @param end The center of the end circle for this gradient
86 @param endRadius Must be positive. The radius of the end circle for th is gradient. 88 @param endRadius Must be positive. The radius of the end circle for th is gradient.
87 @param colors The array[count] of colors, to be distributed between th e center and edge of the circle 89 @param colors The array[count] of colors, to be distributed between th e center and edge of the circle
88 @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of 90 @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of
89 each corresponding color in the colors array. If this is NULL, 91 each corresponding color in the colors array. If this is NULL,
90 the the colors are distributed evenly between the center and edge of the circle. 92 the the colors are distributed evenly between the center and edge of the circle.
91 If this is not null, the values must begin with 0, end w ith 1.0, and 93 If this is not null, the values must begin with 0, end w ith 1.0, and
92 intermediate values must be strictly increasing. 94 intermediate values must be strictly increasing.
93 @param count Must be >= 2. The number of colors (and pos if not NULL) entries 95 @param count Must be >= 2. The number of colors (and pos if not NULL) entries
94 @param mode The tiling mode 96 @param mode The tiling mode
95 @param mapper May be NULL. Callback to modify the spread of the colors . 97 @param mapper May be NULL. Callback to modify the spread of the colors .
96 */ 98 */
97 static SkShader* CreateTwoPointRadial(const SkPoint& start, 99 static SkShader* CreateTwoPointRadial(const SkPoint& start,
98 SkScalar startRadius, 100 SkScalar startRadius,
99 const SkPoint& end, 101 const SkPoint& end,
100 SkScalar endRadius, 102 SkScalar endRadius,
101 const SkColor colors[], 103 const SkColor colors[],
102 const SkScalar pos[], int count, 104 const SkScalar pos[], int count,
103 SkShader::TileMode mode, 105 SkShader::TileMode mode,
104 SkUnitMapper* mapper = NULL, 106 SkUnitMapper* mapper = NULL,
105 uint32_t flags = 0); 107 uint32_t flags = 0,
108 const SkMatrix* localMatrix = NULL);
106 109
107 /** 110 /**
108 * Returns a shader that generates a conical gradient given two circles, or 111 * Returns a shader that generates a conical gradient given two circles, or
109 * returns NULL if the inputs are invalid. The gradient interprets the 112 * returns NULL if the inputs are invalid. The gradient interprets the
110 * two circles according to the following HTML spec. 113 * two circles according to the following HTML spec.
111 * http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient 114 * http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient
112 */ 115 */
113 static SkShader* CreateTwoPointConical(const SkPoint& start, 116 static SkShader* CreateTwoPointConical(const SkPoint& start,
114 SkScalar startRadius, 117 SkScalar startRadius,
115 const SkPoint& end, 118 const SkPoint& end,
116 SkScalar endRadius, 119 SkScalar endRadius,
117 const SkColor colors[], 120 const SkColor colors[],
118 const SkScalar pos[], int count, 121 const SkScalar pos[], int count,
119 SkShader::TileMode mode, 122 SkShader::TileMode mode,
120 SkUnitMapper* mapper = NULL, 123 SkUnitMapper* mapper = NULL,
121 uint32_t flags = 0); 124 uint32_t flags = 0,
125 const SkMatrix* localMatrix = NULL);
122 126
123 /** Returns a shader that generates a sweep gradient given a center. 127 /** Returns a shader that generates a sweep gradient given a center.
124 <p /> 128 <p />
125 CreateSweep returns a shader with a reference count of 1. 129 CreateSweep returns a shader with a reference count of 1.
126 The caller should decrement the shader's reference count when done with the shader. 130 The caller should decrement the shader's reference count when done with the shader.
127 It is an error for colorCount to be < 2. 131 It is an error for colorCount to be < 2.
128 @param cx The X coordinate of the center of the sweep 132 @param cx The X coordinate of the center of the sweep
129 @param cx The Y coordinate of the center of the sweep 133 @param cx The Y coordinate of the center of the sweep
130 @param colors The array[count] of colors, to be distributed around the center. 134 @param colors The array[count] of colors, to be distributed around the center.
131 @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of 135 @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of
132 each corresponding color in the colors array. If this is NULL, 136 each corresponding color in the colors array. If this is NULL,
133 the the colors are distributed evenly between the center and edge of the circle. 137 the the colors are distributed evenly between the center and edge of the circle.
134 If this is not null, the values must begin with 0, end w ith 1.0, and 138 If this is not null, the values must begin with 0, end w ith 1.0, and
135 intermediate values must be strictly increasing. 139 intermediate values must be strictly increasing.
136 @param count Must be >= 2. The number of colors (and pos if not NULL) entries 140 @param count Must be >= 2. The number of colors (and pos if not NULL) entries
137 @param mapper May be NULL. Callback to modify the spread of the colors . 141 @param mapper May be NULL. Callback to modify the spread of the colors .
138 */ 142 */
139 static SkShader* CreateSweep(SkScalar cx, SkScalar cy, 143 static SkShader* CreateSweep(SkScalar cx, SkScalar cy,
140 const SkColor colors[], const SkScalar pos[], 144 const SkColor colors[], const SkScalar pos[],
141 int count, SkUnitMapper* mapper = NULL, 145 int count, SkUnitMapper* mapper = NULL,
142 uint32_t flags = 0); 146 uint32_t flags = 0,
147 const SkMatrix* localMatrix = NULL);
143 148
144 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() 149 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
145 }; 150 };
146 151
147 #endif 152 #endif
OLDNEW
« no previous file with comments | « include/core/SkShader.h ('k') | samplecode/SampleAARectModes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698