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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 size_t dataSize = data ? data->size() : 0; | 573 size_t dataSize = data ? data->size() : 0; |
574 } | 574 } |
575 #endif | 575 #endif |
576 } | 576 } |
577 } | 577 } |
578 } | 578 } |
579 } | 579 } |
580 | 580 |
581 #define GENERATE_CANVAS(recorder, x) \ | 581 #define GENERATE_CANVAS(recorder, x) \ |
582 (x) ? recorder.EXPERIMENTAL_beginRecording(100, 100) \ | 582 (x) ? recorder.EXPERIMENTAL_beginRecording(100, 100) \ |
583 : recorder.beginRecording(100,100); | 583 : recorder. DEPRECATED_beginRecording(100,100); |
584 | 584 |
585 /* Hit a few SkPicture::Analysis cases not handled elsewhere. */ | 585 /* Hit a few SkPicture::Analysis cases not handled elsewhere. */ |
586 static void test_analysis(skiatest::Reporter* reporter, bool useNewPath) { | 586 static void test_analysis(skiatest::Reporter* reporter, bool useNewPath) { |
587 SkPictureRecorder recorder; | 587 SkPictureRecorder recorder; |
588 | 588 |
589 SkCanvas* canvas = GENERATE_CANVAS(recorder, useNewPath); | 589 SkCanvas* canvas = GENERATE_CANVAS(recorder, useNewPath); |
590 { | 590 { |
591 canvas->drawRect(SkRect::MakeWH(10, 10), SkPaint ()); | 591 canvas->drawRect(SkRect::MakeWH(10, 10), SkPaint ()); |
592 } | 592 } |
593 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 593 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 // Restore | 890 // Restore |
891 // 3) | 891 // 3) |
892 // SaveLayer w/ copyable paint | 892 // SaveLayer w/ copyable paint |
893 // Restore | 893 // Restore |
894 // 4) | 894 // 4) |
895 // SaveLayer w/ non-copyable paint | 895 // SaveLayer w/ non-copyable paint |
896 // Restore | 896 // Restore |
897 { | 897 { |
898 SkPictureRecorder recorder; | 898 SkPictureRecorder recorder; |
899 | 899 |
900 SkCanvas* c = recorder.beginRecording(kWidth, kHeight); | 900 SkCanvas* c = recorder.DEPRECATED_beginRecording(kWidth, kHeight); |
901 // 1) | 901 // 1) |
902 c->saveLayer(NULL, NULL); | 902 c->saveLayer(NULL, NULL); |
903 c->restore(); | 903 c->restore(); |
904 | 904 |
905 // 2) | 905 // 2) |
906 c->saveLayer(NULL, NULL); | 906 c->saveLayer(NULL, NULL); |
907 c->translate(kWidth/2, kHeight/2); | 907 c->translate(kWidth/2, kHeight/2); |
908 SkRect r = SkRect::MakeXYWH(0, 0, kWidth/2, kHeight/2); | 908 SkRect r = SkRect::MakeXYWH(0, 0, kWidth/2, kHeight/2); |
909 c->saveLayer(&r, NULL); | 909 c->saveLayer(&r, NULL); |
910 c->restore(); | 910 c->restore(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 #endif | 995 #endif |
996 } | 996 } |
997 } | 997 } |
998 } | 998 } |
999 | 999 |
1000 #endif | 1000 #endif |
1001 | 1001 |
1002 static void test_has_text(skiatest::Reporter* reporter, bool useNewPath) { | 1002 static void test_has_text(skiatest::Reporter* reporter, bool useNewPath) { |
1003 SkPictureRecorder recorder; | 1003 SkPictureRecorder recorder; |
1004 #define BEGIN_RECORDING useNewPath ? recorder.EXPERIMENTAL_beginRecording(100, 1
00) \ | 1004 #define BEGIN_RECORDING useNewPath ? recorder.EXPERIMENTAL_beginRecording(100, 1
00) \ |
1005 : recorder. beginRecording(100, 1
00) | 1005 : recorder. DEPRECATED_beginRecording(100, 1
00) |
1006 | 1006 |
1007 SkCanvas* canvas = BEGIN_RECORDING; | 1007 SkCanvas* canvas = BEGIN_RECORDING; |
1008 { | 1008 { |
1009 canvas->drawRect(SkRect::MakeWH(20, 20), SkPaint()); | 1009 canvas->drawRect(SkRect::MakeWH(20, 20), SkPaint()); |
1010 } | 1010 } |
1011 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 1011 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
1012 REPORTER_ASSERT(reporter, !picture->hasText()); | 1012 REPORTER_ASSERT(reporter, !picture->hasText()); |
1013 | 1013 |
1014 SkPoint point = SkPoint::Make(10, 10); | 1014 SkPoint point = SkPoint::Make(10, 10); |
1015 canvas = BEGIN_RECORDING; | 1015 canvas = BEGIN_RECORDING; |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); | 1851 SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); |
1852 | 1852 |
1853 SkCanvas big(640, 480), small(300, 200); | 1853 SkCanvas big(640, 480), small(300, 200); |
1854 | 1854 |
1855 picture->draw(&big); | 1855 picture->draw(&big); |
1856 REPORTER_ASSERT(r, bbh.searchCalls == 0); | 1856 REPORTER_ASSERT(r, bbh.searchCalls == 0); |
1857 | 1857 |
1858 picture->draw(&small); | 1858 picture->draw(&small); |
1859 REPORTER_ASSERT(r, bbh.searchCalls == 1); | 1859 REPORTER_ASSERT(r, bbh.searchCalls == 1); |
1860 } | 1860 } |
OLD | NEW |