OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkGradientShader.h" | 8 #include "SkGradientShader.h" |
9 | 9 |
10 using namespace skiagm; | 10 using namespace skiagm; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 /////////////////////////////////////////////////////////////////////////////// | 122 /////////////////////////////////////////////////////////////////////////////// |
123 | 123 |
124 struct ColorPos { | 124 struct ColorPos { |
125 SkColor* fColors; | 125 SkColor* fColors; |
126 SkScalar* fPos; | 126 SkScalar* fPos; |
127 int fCount; | 127 int fCount; |
128 | 128 |
129 ColorPos() : fColors(NULL), fPos(NULL), fCount(0) {} | 129 ColorPos() : fColors(NULL), fPos(NULL), fCount(0) {} |
130 ~ColorPos() { | 130 ~ColorPos() { |
131 SkDELETE_ARRAY(fColors); | 131 delete[] fColors; |
132 SkDELETE_ARRAY(fPos); | 132 delete[] fPos; |
133 } | 133 } |
134 | 134 |
135 void construct(const SkColor colors[], const SkScalar pos[], int count) { | 135 void construct(const SkColor colors[], const SkScalar pos[], int count) { |
136 fColors = SkNEW_ARRAY(SkColor, count); | 136 fColors = new SkColor[count]; |
137 memcpy(fColors, colors, count * sizeof(SkColor)); | 137 memcpy(fColors, colors, count * sizeof(SkColor)); |
138 if (pos) { | 138 if (pos) { |
139 fPos = SkNEW_ARRAY(SkScalar, count); | 139 fPos = new SkScalar[count]; |
140 memcpy(fPos, pos, count * sizeof(SkScalar)); | 140 memcpy(fPos, pos, count * sizeof(SkScalar)); |
141 fPos[0] = 0; | 141 fPos[0] = 0; |
142 fPos[count - 1] = 1; | 142 fPos[count - 1] = 1; |
143 } | 143 } |
144 fCount = count; | 144 fCount = count; |
145 } | 145 } |
146 }; | 146 }; |
147 | 147 |
148 static void make0(ColorPos* rec) { | 148 static void make0(ColorPos* rec) { |
149 #if 0 | 149 #if 0 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 canvas->translate(0, r.height() + 20); | 241 canvas->translate(0, r.height() + 20); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 private: | 245 private: |
246 typedef GM INHERITED; | 246 typedef GM INHERITED; |
247 }; | 247 }; |
248 | 248 |
249 /////////////////////////////////////////////////////////////////////////////// | 249 /////////////////////////////////////////////////////////////////////////////// |
250 | 250 |
251 DEF_GM( return SkNEW(GradientsNoTextureGM)); | 251 DEF_GM(return new GradientsNoTextureGM); |
252 DEF_GM( return SkNEW(GradientsManyColorsGM)); | 252 DEF_GM(return new GradientsManyColorsGM); |
OLD | NEW |