| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 7 |
| 8 #include "Test.h" | 8 #include "Test.h" |
| 9 #include "TestClassDef.h" |
| 10 #include "SkCanvas.h" |
| 11 #include "SkEdgeClipper.h" |
| 12 #include "SkLineClipper.h" |
| 9 #include "SkPath.h" | 13 #include "SkPath.h" |
| 10 #include "SkLineClipper.h" | |
| 11 #include "SkEdgeClipper.h" | |
| 12 | 14 |
| 13 #include "SkCanvas.h" | |
| 14 static void test_hairclipping(skiatest::Reporter* reporter) { | 15 static void test_hairclipping(skiatest::Reporter* reporter) { |
| 15 SkBitmap bm; | 16 SkBitmap bm; |
| 16 bm.setConfig(SkBitmap::kARGB_8888_Config, 4, 4); | 17 bm.setConfig(SkBitmap::kARGB_8888_Config, 4, 4); |
| 17 bm.allocPixels(); | 18 bm.allocPixels(); |
| 18 bm.eraseColor(SK_ColorWHITE); | 19 bm.eraseColor(SK_ColorWHITE); |
| 19 | 20 |
| 20 SkPaint paint; | 21 SkPaint paint; |
| 21 paint.setAntiAlias(true); | 22 paint.setAntiAlias(true); |
| 22 | 23 |
| 23 SkCanvas canvas(bm); | 24 SkCanvas canvas(bm); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 bool valid = SkLineClipper::IntersectLine(&gPartial[i], gR, dst); | 138 bool valid = SkLineClipper::IntersectLine(&gPartial[i], gR, dst); |
| 138 if (!valid || memcmp(&gPartial[i+2], dst, sizeof(dst))) { | 139 if (!valid || memcmp(&gPartial[i+2], dst, sizeof(dst))) { |
| 139 SkDebugf("++++ [%d] %g %g -> %g %g\n", i/2, dst[0].fX, dst[0].fY, ds
t[1].fX, dst[1].fY); | 140 SkDebugf("++++ [%d] %g %g -> %g %g\n", i/2, dst[0].fX, dst[0].fY, ds
t[1].fX, dst[1].fY); |
| 140 } | 141 } |
| 141 REPORTER_ASSERT(reporter, valid && | 142 REPORTER_ASSERT(reporter, valid && |
| 142 !memcmp(&gPartial[i+2], dst, sizeof(dst))); | 143 !memcmp(&gPartial[i+2], dst, sizeof(dst))); |
| 143 } | 144 } |
| 144 | 145 |
| 145 } | 146 } |
| 146 | 147 |
| 147 static void TestClipper(skiatest::Reporter* reporter) { | 148 DEF_TEST(Clipper, reporter) { |
| 148 test_intersectline(reporter); | 149 test_intersectline(reporter); |
| 149 test_edgeclipper(); | 150 test_edgeclipper(); |
| 150 test_hairclipping(reporter); | 151 test_hairclipping(reporter); |
| 151 } | 152 } |
| 152 | |
| 153 #include "TestClassDef.h" | |
| 154 DEFINE_TESTCLASS("Clipper", TestClipperClass, TestClipper) | |
| OLD | NEW |