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