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

Side by Side Diff: tests/GeometryTest.cpp

Issue 1041573002: impl SkConvertQuadToCubic w/ Sk2s (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « src/core/SkGeometry.cpp ('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 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 #include "SkGeometry.h" 8 #include "SkGeometry.h"
9 #include "Test.h" 9 #include "Test.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 SkPoint pts[3], dst[5]; 109 SkPoint pts[3], dst[5];
110 110
111 pts[0].set(0, 0); 111 pts[0].set(0, 0);
112 pts[1].set(100, 50); 112 pts[1].set(100, 50);
113 pts[2].set(0, 100); 113 pts[2].set(0, 100);
114 114
115 int count = SkChopQuadAtMaxCurvature(pts, dst); 115 int count = SkChopQuadAtMaxCurvature(pts, dst);
116 REPORTER_ASSERT(reporter, count == 1 || count == 2); 116 REPORTER_ASSERT(reporter, count == 1 || count == 2);
117 117
118 pts[0].set(0, 0); 118 pts[0].set(0, 0);
119 pts[1].set(SkIntToScalar(3), 0); 119 pts[1].set(3, 0);
120 pts[2].set(SkIntToScalar(3), SkIntToScalar(3)); 120 pts[2].set(3, 3);
121 SkConvertQuadToCubic(pts, dst); 121 SkConvertQuadToCubic(pts, dst);
122 const SkPoint cubic[] = { 122 const SkPoint cubic[] = {
123 { 0, 0, }, 123 { 0, 0, }, { 2, 0, }, { 3, 1, }, { 3, 3 },
124 { SkIntToScalar(2), 0, },
125 { SkIntToScalar(3), SkIntToScalar(1), },
126 { SkIntToScalar(3), SkIntToScalar(3) },
127 }; 124 };
128 for (int i = 0; i < 4; ++i) { 125 for (int i = 0; i < 4; ++i) {
129 REPORTER_ASSERT(reporter, nearly_equal(cubic[i], dst[i])); 126 REPORTER_ASSERT(reporter, nearly_equal(cubic[i], dst[i]));
130 } 127 }
131 128
132 testChopCubic(reporter); 129 testChopCubic(reporter);
133 test_evalquadat(reporter); 130 test_evalquadat(reporter);
134 test_conic(reporter); 131 test_conic(reporter);
135 } 132 }
OLDNEW
« no previous file with comments | « src/core/SkGeometry.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698