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 "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 REPORTER_ASSERT(reporter, 0 == info7.fBounds.fLeft && 0 == info7.fBounds
.fTop); | 459 REPORTER_ASSERT(reporter, 0 == info7.fBounds.fLeft && 0 == info7.fBounds
.fTop); |
460 REPORTER_ASSERT(reporter, info7.fLocalMat.isIdentity()); | 460 REPORTER_ASSERT(reporter, info7.fLocalMat.isIdentity()); |
461 REPORTER_ASSERT(reporter, info7.fPreMat.isIdentity()); | 461 REPORTER_ASSERT(reporter, info7.fPreMat.isIdentity()); |
462 REPORTER_ASSERT(reporter, NULL != info7.fPaint); | 462 REPORTER_ASSERT(reporter, NULL != info7.fPaint); |
463 REPORTER_ASSERT(reporter, info7.fIsNested && !info7.fHasNestedLayers); /
/ is nested | 463 REPORTER_ASSERT(reporter, info7.fIsNested && !info7.fHasNestedLayers); /
/ is nested |
464 } | 464 } |
465 } | 465 } |
466 | 466 |
467 static void test_has_text(skiatest::Reporter* reporter) { | 467 static void test_has_text(skiatest::Reporter* reporter) { |
468 SkPictureRecorder recorder; | 468 SkPictureRecorder recorder; |
| 469 SkMatrix matrix; |
| 470 SkCanvas::TextOnPathMethod method = SkCanvas::kStretch_TextOnPathMethod; |
469 | 471 |
470 SkCanvas* canvas = recorder.beginRecording(100,100); | 472 SkCanvas* canvas = recorder.beginRecording(100,100); |
471 { | 473 { |
472 canvas->drawRect(SkRect::MakeWH(20, 20), SkPaint()); | 474 canvas->drawRect(SkRect::MakeWH(20, 20), SkPaint()); |
473 } | 475 } |
474 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 476 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
475 REPORTER_ASSERT(reporter, !picture->hasText()); | 477 REPORTER_ASSERT(reporter, !picture->hasText()); |
476 | 478 |
477 SkPoint point = SkPoint::Make(10, 10); | 479 SkPoint point = SkPoint::Make(10, 10); |
478 canvas = recorder.beginRecording(100,100); | 480 canvas = recorder.beginRecording(100,100); |
(...skipping 16 matching lines...) Expand all Loading... |
495 } | 497 } |
496 picture.reset(recorder.endRecording()); | 498 picture.reset(recorder.endRecording()); |
497 REPORTER_ASSERT(reporter, picture->hasText()); | 499 REPORTER_ASSERT(reporter, picture->hasText()); |
498 | 500 |
499 canvas = recorder.beginRecording(100,100); | 501 canvas = recorder.beginRecording(100,100); |
500 { | 502 { |
501 SkPath path; | 503 SkPath path; |
502 path.moveTo(0, 0); | 504 path.moveTo(0, 0); |
503 path.lineTo(50, 50); | 505 path.lineTo(50, 50); |
504 | 506 |
505 canvas->drawTextOnPathHV("Q", 1, path, point.fX, point.fY, SkPaint()); | 507 matrix.setTranslate(point.fX, point.fY); |
| 508 canvas->drawTextOnPath("Q", 1, path, &matrix, method, SkPaint()); |
506 } | 509 } |
507 picture.reset(recorder.endRecording()); | 510 picture.reset(recorder.endRecording()); |
508 REPORTER_ASSERT(reporter, picture->hasText()); | 511 REPORTER_ASSERT(reporter, picture->hasText()); |
509 | 512 |
510 canvas = recorder.beginRecording(100,100); | 513 canvas = recorder.beginRecording(100,100); |
511 { | 514 { |
512 SkPath path; | 515 SkPath path; |
513 path.moveTo(0, 0); | 516 path.moveTo(0, 0); |
514 path.lineTo(50, 50); | 517 path.lineTo(50, 50); |
515 | 518 |
516 canvas->drawTextOnPath("Q", 1, path, NULL, SkPaint()); | 519 canvas->drawTextOnPath("Q", 1, path, NULL, method, SkPaint()); |
517 } | 520 } |
518 picture.reset(recorder.endRecording()); | 521 picture.reset(recorder.endRecording()); |
519 REPORTER_ASSERT(reporter, picture->hasText()); | 522 REPORTER_ASSERT(reporter, picture->hasText()); |
520 | 523 |
521 // Nest the previous picture inside a new one. | 524 // Nest the previous picture inside a new one. |
522 canvas = recorder.beginRecording(100,100); | 525 canvas = recorder.beginRecording(100,100); |
523 { | 526 { |
524 canvas->drawPicture(picture.get()); | 527 canvas->drawPicture(picture.get()); |
525 } | 528 } |
526 picture.reset(recorder.endRecording()); | 529 picture.reset(recorder.endRecording()); |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 | 1315 |
1313 // The picture shares the immutable pixels but copies the mutable ones. | 1316 // The picture shares the immutable pixels but copies the mutable ones. |
1314 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1317 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1315 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); | 1318 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); |
1316 | 1319 |
1317 // When the picture goes away, it's just our bitmaps holding the refs. | 1320 // When the picture goes away, it's just our bitmaps holding the refs. |
1318 pic.reset(NULL); | 1321 pic.reset(NULL); |
1319 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1322 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1320 REPORTER_ASSERT(r, immut.pixelRef()->unique()); | 1323 REPORTER_ASSERT(r, immut.pixelRef()->unique()); |
1321 } | 1324 } |
OLD | NEW |