| 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 "SkDebugCanvas.h" | 8 #include "SkDebugCanvas.h" |
| 9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
| 10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 | 670 |
| 671 if (NULL == inPicture.get()) { | 671 if (NULL == inPicture.get()) { |
| 672 SkDebugf("Could not read file %s\n", inFile.c_str()); | 672 SkDebugf("Could not read file %s\n", inFile.c_str()); |
| 673 return -1; | 673 return -1; |
| 674 } | 674 } |
| 675 | 675 |
| 676 int localCount[SK_ARRAY_COUNT(gOptTable)]; | 676 int localCount[SK_ARRAY_COUNT(gOptTable)]; |
| 677 | 677 |
| 678 memset(localCount, 0, sizeof(localCount)); | 678 memset(localCount, 0, sizeof(localCount)); |
| 679 | 679 |
| 680 SkDebugCanvas debugCanvas(inPicture->width(), inPicture->height()); | 680 SkDebugCanvas debugCanvas(SkScalarCeilToInt(inPicture->cullRect().width()), |
| 681 debugCanvas.setBounds(inPicture->width(), inPicture->height()); | 681 SkScalarCeilToInt(inPicture->cullRect().height()))
; |
| 682 inPicture->draw(&debugCanvas); | 682 inPicture->draw(&debugCanvas); |
| 683 | 683 |
| 684 // delete the initial save and restore since replaying the commands will | 684 // delete the initial save and restore since replaying the commands will |
| 685 // re-add them | 685 // re-add them |
| 686 if (debugCanvas.getSize() > 1) { | 686 if (debugCanvas.getSize() > 1) { |
| 687 debugCanvas.deleteDrawCommandAt(0); | 687 debugCanvas.deleteDrawCommandAt(0); |
| 688 debugCanvas.deleteDrawCommandAt(debugCanvas.getSize()-1); | 688 debugCanvas.deleteDrawCommandAt(debugCanvas.getSize()-1); |
| 689 } | 689 } |
| 690 | 690 |
| 691 bool changed = true; | 691 bool changed = true; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 710 changed = true; | 710 changed = true; |
| 711 } | 711 } |
| 712 } | 712 } |
| 713 } | 713 } |
| 714 } | 714 } |
| 715 | 715 |
| 716 int numAfter = debugCanvas.getSize(); | 716 int numAfter = debugCanvas.getSize(); |
| 717 | 717 |
| 718 if (!outFile.isEmpty()) { | 718 if (!outFile.isEmpty()) { |
| 719 SkPictureRecorder recorder; | 719 SkPictureRecorder recorder; |
| 720 SkCanvas* canvas = recorder.beginRecording(inPicture->width(), inPicture
->height(), NULL, 0); | 720 SkCanvas* canvas = recorder.beginRecording(inPicture->cullRect().width()
, |
| 721 inPicture->cullRect().height(
), |
| 722 NULL, 0); |
| 721 debugCanvas.draw(canvas); | 723 debugCanvas.draw(canvas); |
| 722 SkAutoTUnref<SkPicture> outPicture(recorder.endRecording()); | 724 SkAutoTUnref<SkPicture> outPicture(recorder.endRecording()); |
| 723 | 725 |
| 724 SkFILEWStream outStream(outFile.c_str()); | 726 SkFILEWStream outStream(outFile.c_str()); |
| 725 | 727 |
| 726 outPicture->serialize(&outStream); | 728 outPicture->serialize(&outStream); |
| 727 } | 729 } |
| 728 | 730 |
| 729 bool someOptFired = false; | 731 bool someOptFired = false; |
| 730 for (size_t opt = 0; opt < SK_ARRAY_COUNT(gOptTable); ++opt) { | 732 for (size_t opt = 0; opt < SK_ARRAY_COUNT(gOptTable); ++opt) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 | 839 |
| 838 SkGraphics::Term(); | 840 SkGraphics::Term(); |
| 839 return 0; | 841 return 0; |
| 840 } | 842 } |
| 841 | 843 |
| 842 #if !defined SK_BUILD_FOR_IOS | 844 #if !defined SK_BUILD_FOR_IOS |
| 843 int main(int argc, char * const argv[]) { | 845 int main(int argc, char * const argv[]) { |
| 844 return tool_main(argc, (char**) argv); | 846 return tool_main(argc, (char**) argv); |
| 845 } | 847 } |
| 846 #endif | 848 #endif |
| OLD | NEW |