| OLD | NEW |
| 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 <cmath> | 8 #include <cmath> |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkGeometry.h" | 10 #include "SkGeometry.h" |
| (...skipping 4098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4109 SkPath q; | 4109 SkPath q; |
| 4110 q.moveTo(10, 10); | 4110 q.moveTo(10, 10); |
| 4111 SkPathPriv::AddGenIDChangeListener(q, new ChangeListener(&changed)); | 4111 SkPathPriv::AddGenIDChangeListener(q, new ChangeListener(&changed)); |
| 4112 REPORTER_ASSERT(reporter, !changed); | 4112 REPORTER_ASSERT(reporter, !changed); |
| 4113 } | 4113 } |
| 4114 // q went out of scope. | 4114 // q went out of scope. |
| 4115 REPORTER_ASSERT(reporter, changed); | 4115 REPORTER_ASSERT(reporter, changed); |
| 4116 } | 4116 } |
| 4117 }; | 4117 }; |
| 4118 | 4118 |
| 4119 static void test_crbug_629455(skiatest::Reporter* reporter) { |
| 4120 SkPath path; |
| 4121 path.moveTo(0, 0); |
| 4122 path.cubicTo(SkBits2Float(0xcdcdcd00), SkBits2Float(0xcdcdcdcd), |
| 4123 SkBits2Float(0xcdcdcdcd), SkBits2Float(0xcdcdcdcd), |
| 4124 SkBits2Float(0x423fcdcd), SkBits2Float(0x40ed9341)); |
| 4125 // AKA: cubicTo(-4.31596e+08f, -4.31602e+08f, -4.31602e+08f, -4.31602e+08f, 47.
951f, 7.42423f); |
| 4126 path.lineTo(0, 0); |
| 4127 |
| 4128 auto surface = SkSurface::MakeRasterN32Premul(100, 100); |
| 4129 SkPaint paint; |
| 4130 paint.setAntiAlias(true); |
| 4131 surface->getCanvas()->drawPath(path, paint); |
| 4132 } |
| 4133 |
| 4119 static void test_interp(skiatest::Reporter* reporter) { | 4134 static void test_interp(skiatest::Reporter* reporter) { |
| 4120 SkPath p1, p2, out; | 4135 SkPath p1, p2, out; |
| 4121 REPORTER_ASSERT(reporter, p1.isInterpolatable(p2)); | 4136 REPORTER_ASSERT(reporter, p1.isInterpolatable(p2)); |
| 4122 REPORTER_ASSERT(reporter, p1.interpolate(p2, 0, &out)); | 4137 REPORTER_ASSERT(reporter, p1.interpolate(p2, 0, &out)); |
| 4123 REPORTER_ASSERT(reporter, p1 == out); | 4138 REPORTER_ASSERT(reporter, p1 == out); |
| 4124 REPORTER_ASSERT(reporter, p1.interpolate(p2, 1, &out)); | 4139 REPORTER_ASSERT(reporter, p1.interpolate(p2, 1, &out)); |
| 4125 REPORTER_ASSERT(reporter, p1 == out); | 4140 REPORTER_ASSERT(reporter, p1 == out); |
| 4126 p1.moveTo(0, 2); | 4141 p1.moveTo(0, 2); |
| 4127 p1.lineTo(0, 4); | 4142 p1.lineTo(0, 4); |
| 4128 REPORTER_ASSERT(reporter, !p1.isInterpolatable(p2)); | 4143 REPORTER_ASSERT(reporter, !p1.isInterpolatable(p2)); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4157 | 4172 |
| 4158 DEF_TEST(PathInterp, reporter) { | 4173 DEF_TEST(PathInterp, reporter) { |
| 4159 test_interp(reporter); | 4174 test_interp(reporter); |
| 4160 } | 4175 } |
| 4161 | 4176 |
| 4162 DEF_TEST(PathContains, reporter) { | 4177 DEF_TEST(PathContains, reporter) { |
| 4163 test_contains(reporter); | 4178 test_contains(reporter); |
| 4164 } | 4179 } |
| 4165 | 4180 |
| 4166 DEF_TEST(Paths, reporter) { | 4181 DEF_TEST(Paths, reporter) { |
| 4182 test_crbug_629455(reporter); |
| 4167 test_path_crbug364224(); | 4183 test_path_crbug364224(); |
| 4168 | 4184 |
| 4169 SkTSize<SkScalar>::Make(3,4); | 4185 SkTSize<SkScalar>::Make(3,4); |
| 4170 | 4186 |
| 4171 SkPath p, empty; | 4187 SkPath p, empty; |
| 4172 SkRect bounds, bounds2; | 4188 SkRect bounds, bounds2; |
| 4173 test_empty(reporter, p); | 4189 test_empty(reporter, p); |
| 4174 | 4190 |
| 4175 REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); | 4191 REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); |
| 4176 | 4192 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4312 PathTest_Private::TestPathTo(reporter); | 4328 PathTest_Private::TestPathTo(reporter); |
| 4313 PathRefTest_Private::TestPathRef(reporter); | 4329 PathRefTest_Private::TestPathRef(reporter); |
| 4314 PathTest_Private::TestPathrefListeners(reporter); | 4330 PathTest_Private::TestPathrefListeners(reporter); |
| 4315 test_dump(reporter); | 4331 test_dump(reporter); |
| 4316 test_path_crbug389050(reporter); | 4332 test_path_crbug389050(reporter); |
| 4317 test_path_crbugskia2820(reporter); | 4333 test_path_crbugskia2820(reporter); |
| 4318 test_skbug_3469(reporter); | 4334 test_skbug_3469(reporter); |
| 4319 test_skbug_3239(reporter); | 4335 test_skbug_3239(reporter); |
| 4320 test_bounds_crbug_513799(reporter); | 4336 test_bounds_crbug_513799(reporter); |
| 4321 } | 4337 } |
| OLD | NEW |