OLD | NEW |
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 | 7 |
8 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkDashPathEffect.h" | 10 #include "SkDashPathEffect.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 path.moveTo(64, 3); | 210 path.moveTo(64, 3); |
211 path.cubicTo(-329936, -100000000, -329936, 100000000, 1153, 330003); | 211 path.cubicTo(-329936, -100000000, -329936, 100000000, 1153, 330003); |
212 | 212 |
213 SkPaint paint; | 213 SkPaint paint; |
214 paint.setAntiAlias(true); | 214 paint.setAntiAlias(true); |
215 | 215 |
216 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480)); | 216 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480)); |
217 surface->getCanvas()->drawPath(path, paint); | 217 surface->getCanvas()->drawPath(path, paint); |
218 } | 218 } |
219 | 219 |
| 220 // asserts if halfway case is not handled |
| 221 static void test_halfway() { |
| 222 SkPaint paint; |
| 223 SkPath path; |
| 224 path.moveTo(16365.5f, 1394); |
| 225 path.lineTo(16365.5f, 1387.5f); |
| 226 path.quadTo(16365.5f, 1385.43f, 16367, 1383.96f); |
| 227 path.quadTo(16368.4f, 1382.5f, 16370.5f, 1382.5f); |
| 228 path.lineTo(16465.5f, 1382.5f); |
| 229 path.quadTo(16467.6f, 1382.5f, 16469, 1383.96f); |
| 230 path.quadTo(16470.5f, 1385.43f, 16470.5f, 1387.5f); |
| 231 path.lineTo(16470.5f, 1394); |
| 232 path.quadTo(16470.5f, 1396.07f, 16469, 1397.54f); |
| 233 path.quadTo(16467.6f, 1399, 16465.5f, 1399); |
| 234 path.lineTo(16370.5f, 1399); |
| 235 path.quadTo(16368.4f, 1399, 16367, 1397.54f); |
| 236 path.quadTo(16365.5f, 1396.07f, 16365.5f, 1394); |
| 237 path.close(); |
| 238 SkPath p2; |
| 239 SkMatrix m; |
| 240 m.reset(); |
| 241 m.postTranslate(0.001f, 0.001f); |
| 242 path.transform(m, &p2); |
| 243 |
| 244 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480)); |
| 245 SkCanvas* canvas = surface->getCanvas(); |
| 246 canvas->translate(-16366, -1383); |
| 247 canvas->drawPath(p2, paint); |
| 248 |
| 249 m.reset(); |
| 250 m.postTranslate(-0.001f, -0.001f); |
| 251 path.transform(m, &p2); |
| 252 canvas->drawPath(p2, paint); |
| 253 |
| 254 m.reset(); |
| 255 path.transform(m, &p2); |
| 256 canvas->drawPath(p2, paint); |
| 257 } |
| 258 |
220 // we used to assert if the bounds of the device (clip) was larger than 32K | 259 // we used to assert if the bounds of the device (clip) was larger than 32K |
221 // even when the path itself was smaller. We just draw and hope in the debug | 260 // even when the path itself was smaller. We just draw and hope in the debug |
222 // version to not assert. | 261 // version to not assert. |
223 static void test_giantaa() { | 262 static void test_giantaa() { |
224 const int W = 400; | 263 const int W = 400; |
225 const int H = 400; | 264 const int H = 400; |
226 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(33000, 10)); | 265 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(33000, 10)); |
227 | 266 |
228 SkPaint paint; | 267 SkPaint paint; |
229 paint.setAntiAlias(true); | 268 paint.setAntiAlias(true); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 test_bigcubic(); | 319 test_bigcubic(); |
281 test_crbug_124652(); | 320 test_crbug_124652(); |
282 test_crbug_140642(); | 321 test_crbug_140642(); |
283 test_crbug_140803(); | 322 test_crbug_140803(); |
284 test_inversepathwithclip(); | 323 test_inversepathwithclip(); |
285 // why? | 324 // why? |
286 if (false) test_crbug131181(); | 325 if (false) test_crbug131181(); |
287 test_infinite_dash(reporter); | 326 test_infinite_dash(reporter); |
288 test_crbug_165432(reporter); | 327 test_crbug_165432(reporter); |
289 test_big_aa_rect(reporter); | 328 test_big_aa_rect(reporter); |
| 329 test_halfway(); |
290 } | 330 } |
OLD | NEW |