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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 REPORTER_ASSERT(reporter, info4.fCTM.isIdentity()); | 981 REPORTER_ASSERT(reporter, info4.fCTM.isIdentity()); |
982 REPORTER_ASSERT(reporter, NULL == info4.fPaint); // paint is/was
uncopyable | 982 REPORTER_ASSERT(reporter, NULL == info4.fPaint); // paint is/was
uncopyable |
983 REPORTER_ASSERT(reporter, !info4.fIsNested && !info4.fHasNestedLayer
s); | 983 REPORTER_ASSERT(reporter, !info4.fIsNested && !info4.fHasNestedLayer
s); |
984 #endif | 984 #endif |
985 } | 985 } |
986 } | 986 } |
987 } | 987 } |
988 | 988 |
989 #endif | 989 #endif |
990 | 990 |
991 static void test_has_text(skiatest::Reporter* reporter) { | 991 static void test_has_text(skiatest::Reporter* reporter, bool useNewPath) { |
992 SkPictureRecorder recorder; | 992 SkPictureRecorder recorder; |
993 SkPaint paint; | 993 #define BEGIN_RECORDING useNewPath ? recorder.EXPERIMENTAL_beginRecording(100, 1
00) \ |
994 paint.setColor(SK_ColorBLUE); | 994 : recorder. beginRecording(100, 1
00) |
995 SkPoint point = SkPoint::Make(10, 10); | |
996 | 995 |
997 SkCanvas* canvas = recorder.beginRecording(100, 100); | 996 SkCanvas* canvas = BEGIN_RECORDING; |
998 { | 997 { |
999 canvas->drawRect(SkRect::MakeWH(20, 20), paint); | 998 canvas->drawRect(SkRect::MakeWH(20, 20), SkPaint()); |
1000 } | 999 } |
1001 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 1000 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
1002 REPORTER_ASSERT(reporter, !picture->hasText()); | 1001 REPORTER_ASSERT(reporter, !picture->hasText()); |
1003 | 1002 |
1004 canvas = recorder.beginRecording(100, 100); | 1003 SkPoint point = SkPoint::Make(10, 10); |
| 1004 canvas = BEGIN_RECORDING; |
1005 { | 1005 { |
1006 canvas->drawText("Q", 1, point.fX, point.fY, paint); | 1006 canvas->drawText("Q", 1, point.fX, point.fY, SkPaint()); |
1007 } | 1007 } |
1008 picture.reset(recorder.endRecording()); | 1008 picture.reset(recorder.endRecording()); |
1009 REPORTER_ASSERT(reporter, picture->hasText()); | 1009 REPORTER_ASSERT(reporter, picture->hasText()); |
1010 | 1010 |
1011 canvas = recorder.beginRecording(100, 100); | 1011 canvas = BEGIN_RECORDING; |
1012 { | 1012 { |
1013 canvas->drawPosText("Q", 1, &point, paint); | 1013 canvas->drawPosText("Q", 1, &point, SkPaint()); |
1014 } | 1014 } |
1015 picture.reset(recorder.endRecording()); | 1015 picture.reset(recorder.endRecording()); |
1016 REPORTER_ASSERT(reporter, picture->hasText()); | 1016 REPORTER_ASSERT(reporter, picture->hasText()); |
1017 | 1017 |
1018 canvas = recorder.beginRecording(100, 100); | 1018 canvas = BEGIN_RECORDING; |
1019 { | 1019 { |
1020 canvas->drawPosTextH("Q", 1, &point.fX, point.fY, paint); | 1020 canvas->drawPosTextH("Q", 1, &point.fX, point.fY, SkPaint()); |
1021 } | 1021 } |
1022 picture.reset(recorder.endRecording()); | 1022 picture.reset(recorder.endRecording()); |
1023 REPORTER_ASSERT(reporter, picture->hasText()); | 1023 REPORTER_ASSERT(reporter, picture->hasText()); |
1024 | 1024 |
1025 canvas = recorder.beginRecording(100, 100); | 1025 canvas = BEGIN_RECORDING; |
1026 { | 1026 { |
1027 SkPath path; | 1027 SkPath path; |
1028 path.moveTo(0, 0); | 1028 path.moveTo(0, 0); |
1029 path.lineTo(50, 50); | 1029 path.lineTo(50, 50); |
1030 | 1030 |
1031 canvas->drawTextOnPathHV("Q", 1, path, point.fX, point.fY, paint); | 1031 canvas->drawTextOnPathHV("Q", 1, path, point.fX, point.fY, SkPaint()); |
1032 } | 1032 } |
1033 picture.reset(recorder.endRecording()); | 1033 picture.reset(recorder.endRecording()); |
1034 REPORTER_ASSERT(reporter, picture->hasText()); | 1034 REPORTER_ASSERT(reporter, picture->hasText()); |
1035 | 1035 |
1036 canvas = recorder.beginRecording(100, 100); | 1036 canvas = BEGIN_RECORDING; |
1037 { | 1037 { |
1038 SkPath path; | 1038 SkPath path; |
1039 path.moveTo(0, 0); | 1039 path.moveTo(0, 0); |
1040 path.lineTo(50, 50); | 1040 path.lineTo(50, 50); |
1041 | 1041 |
1042 canvas->drawTextOnPath("Q", 1, path, NULL, paint); | 1042 canvas->drawTextOnPath("Q", 1, path, NULL, SkPaint()); |
1043 } | 1043 } |
1044 picture.reset(recorder.endRecording()); | 1044 picture.reset(recorder.endRecording()); |
1045 REPORTER_ASSERT(reporter, picture->hasText()); | 1045 REPORTER_ASSERT(reporter, picture->hasText()); |
| 1046 #undef BEGIN_RECORDING |
1046 } | 1047 } |
1047 | 1048 |
1048 static void set_canvas_to_save_count_4(SkCanvas* canvas) { | 1049 static void set_canvas_to_save_count_4(SkCanvas* canvas) { |
1049 canvas->restoreToCount(1); | 1050 canvas->restoreToCount(1); |
1050 canvas->save(); | 1051 canvas->save(); |
1051 canvas->save(); | 1052 canvas->save(); |
1052 canvas->save(); | 1053 canvas->save(); |
1053 } | 1054 } |
1054 | 1055 |
1055 /** | 1056 /** |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 test_serializing_empty_picture(); | 1682 test_serializing_empty_picture(); |
1682 #else | 1683 #else |
1683 test_bad_bitmap(); | 1684 test_bad_bitmap(); |
1684 #endif | 1685 #endif |
1685 test_unbalanced_save_restores(reporter); | 1686 test_unbalanced_save_restores(reporter); |
1686 test_peephole(); | 1687 test_peephole(); |
1687 #if SK_SUPPORT_GPU | 1688 #if SK_SUPPORT_GPU |
1688 test_gpu_veto(reporter, false); | 1689 test_gpu_veto(reporter, false); |
1689 test_gpu_veto(reporter, true); | 1690 test_gpu_veto(reporter, true); |
1690 #endif | 1691 #endif |
1691 test_has_text(reporter); | 1692 test_has_text(reporter, false); |
| 1693 test_has_text(reporter, true); |
1692 test_analysis(reporter, false); | 1694 test_analysis(reporter, false); |
1693 test_analysis(reporter, true); | 1695 test_analysis(reporter, true); |
1694 test_gatherpixelrefs(reporter); | 1696 test_gatherpixelrefs(reporter); |
1695 test_gatherpixelrefsandrects(reporter); | 1697 test_gatherpixelrefsandrects(reporter); |
1696 test_bitmap_with_encoded_data(reporter); | 1698 test_bitmap_with_encoded_data(reporter); |
1697 test_draw_empty(reporter); | 1699 test_draw_empty(reporter); |
1698 test_clip_bound_opt(reporter); | 1700 test_clip_bound_opt(reporter); |
1699 test_clip_expansion(reporter); | 1701 test_clip_expansion(reporter); |
1700 test_hierarchical(reporter); | 1702 test_hierarchical(reporter); |
1701 test_gen_id(reporter); | 1703 test_gen_id(reporter); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); | 1829 SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); |
1828 | 1830 |
1829 SkCanvas big(640, 480), small(300, 200); | 1831 SkCanvas big(640, 480), small(300, 200); |
1830 | 1832 |
1831 picture->draw(&big); | 1833 picture->draw(&big); |
1832 REPORTER_ASSERT(r, bbh.searchCalls == 0); | 1834 REPORTER_ASSERT(r, bbh.searchCalls == 0); |
1833 | 1835 |
1834 picture->draw(&small); | 1836 picture->draw(&small); |
1835 REPORTER_ASSERT(r, bbh.searchCalls == 1); | 1837 REPORTER_ASSERT(r, bbh.searchCalls == 1); |
1836 } | 1838 } |
OLD | NEW |