OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "Test.h" | 8 #include "Test.h" |
9 | |
10 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | |
11 | |
12 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
13 #include "SkDebugCanvas.h" | 10 #include "SkDebugCanvas.h" |
14 #include "SkPicture.h" | 11 #include "SkPicture.h" |
15 #include "SkPictureFlat.h" | 12 #include "SkPictureFlat.h" |
16 #include "SkPictureRecord.h" | 13 #include "SkPictureRecord.h" |
17 | 14 |
18 // This test exercises the Matrix/Clip State collapsing system. It generates | 15 // This test exercises the Matrix/Clip State collapsing system. It generates |
19 // example skps and the compares the actual stored operations to the expected | 16 // example skps and the compares the actual stored operations to the expected |
20 // operations. The test works by emitting canvas operations at three levels: | 17 // operations. The test works by emitting canvas operations at three levels: |
21 // overall structure, bodies that draw something and model/clip state changes. | 18 // overall structure, bodies that draw something and model/clip state changes. |
(...skipping 26 matching lines...) Expand all Loading... |
48 // - not sure if this would be useful since it somewhat duplicates the | 45 // - not sure if this would be useful since it somewhat duplicates the |
49 // correctness test of running render_pictures in record mode and | 46 // correctness test of running render_pictures in record mode and |
50 // rendering before and after images. Additionally the matrix/clip collap
se | 47 // rendering before and after images. Additionally the matrix/clip collap
se |
51 // is sure to cause some small differences so an automated test might | 48 // is sure to cause some small differences so an automated test might |
52 // yield too many false positives. | 49 // yield too many false positives. |
53 // run the matrix/clip collapse system on the 10K skp set | 50 // run the matrix/clip collapse system on the 10K skp set |
54 // - this should give us warm fuzzies that the matrix clip collapse | 51 // - this should give us warm fuzzies that the matrix clip collapse |
55 // system is ready for prime time | 52 // system is ready for prime time |
56 // bench the recording times with/without matrix/clip collapsing | 53 // bench the recording times with/without matrix/clip collapsing |
57 | 54 |
| 55 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
58 | 56 |
59 // Enable/disable debugging helper code | 57 // Enable/disable debugging helper code |
60 //#define TEST_COLLAPSE_MATRIX_CLIP_STATE 1 | 58 //#define TEST_COLLAPSE_MATRIX_CLIP_STATE 1 |
61 | 59 |
62 // Extract the command ops from the input SkPicture | 60 // Extract the command ops from the input SkPicture |
63 static void gets_ops(SkPicture& input, SkTDArray<DrawType>* ops) { | 61 static void gets_ops(SkPicture& input, SkTDArray<DrawType>* ops) { |
64 SkDebugCanvas debugCanvas(input.width(), input.height()); | 62 SkDebugCanvas debugCanvas(input.width(), input.height()); |
65 debugCanvas.setBounds(input.width(), input.height()); | 63 debugCanvas.setBounds(input.width(), input.height()); |
66 input.draw(&debugCanvas); | 64 input.draw(&debugCanvas); |
67 | 65 |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 } | 721 } |
724 } | 722 } |
725 } | 723 } |
726 } | 724 } |
727 | 725 |
728 DEF_TEST(MatrixClipCollapse, reporter) { | 726 DEF_TEST(MatrixClipCollapse, reporter) { |
729 test_collapse(reporter); | 727 test_collapse(reporter); |
730 } | 728 } |
731 | 729 |
732 #endif | 730 #endif |
OLD | NEW |