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

Side by Side Diff: tests/PathOpsTestCommon.cpp

Issue 16951017: convert pathops to use SkSTArray where possible. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: pathops use SkTArray Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « tests/PathOpsTestCommon.h ('k') | 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 2012 Google Inc. 2 * Copyright 2012 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 "PathOpsTestCommon.h" 7 #include "PathOpsTestCommon.h"
8 #include "SkPathOpsCubic.h" 8 #include "SkPathOpsCubic.h"
9 9
10 void CubicToQuads(const SkDCubic& cubic, double precision, SkTDArray<SkDQuad>& q uads) { 10 void CubicToQuads(const SkDCubic& cubic, double precision, SkTArray<SkDQuad, tru e>& quads) {
11 SkTDArray<double> ts; 11 SkTArray<double, true> ts;
12 cubic.toQuadraticTs(precision, &ts); 12 cubic.toQuadraticTs(precision, &ts);
13 if (ts.count() <= 0) { 13 if (ts.count() <= 0) {
14 SkDQuad quad = cubic.toQuad(); 14 SkDQuad quad = cubic.toQuad();
15 *quads.append() = quad; 15 quads.push_back(quad);
16 return; 16 return;
17 } 17 }
18 double tStart = 0; 18 double tStart = 0;
19 for (int i1 = 0; i1 <= ts.count(); ++i1) { 19 for (int i1 = 0; i1 <= ts.count(); ++i1) {
20 const double tEnd = i1 < ts.count() ? ts[i1] : 1; 20 const double tEnd = i1 < ts.count() ? ts[i1] : 1;
21 SkDCubic part = cubic.subDivide(tStart, tEnd); 21 SkDCubic part = cubic.subDivide(tStart, tEnd);
22 SkDQuad quad = part.toQuad(); 22 SkDQuad quad = part.toQuad();
23 *quads.append() = quad; 23 quads.push_back(quad);
24 tStart = tEnd; 24 tStart = tEnd;
25 } 25 }
26 } 26 }
OLDNEW
« no previous file with comments | « tests/PathOpsTestCommon.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698