| 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 631 |
| 632 if (NULL == inPicture.get()) { | 632 if (NULL == inPicture.get()) { |
| 633 SkDebugf("Could not read file %s\n", inFile.c_str()); | 633 SkDebugf("Could not read file %s\n", inFile.c_str()); |
| 634 return -1; | 634 return -1; |
| 635 } | 635 } |
| 636 | 636 |
| 637 int localCount[SK_ARRAY_COUNT(gOptTable)]; | 637 int localCount[SK_ARRAY_COUNT(gOptTable)]; |
| 638 | 638 |
| 639 memset(localCount, 0, sizeof(localCount)); | 639 memset(localCount, 0, sizeof(localCount)); |
| 640 | 640 |
| 641 SkDebugCanvas debugCanvas(SkScalarCeilToInt(inPicture->cullRect().width()), | 641 SkDebugCanvas debugCanvas(SkScalarCeilToInt(inPicture->cullRect().width()), |
| 642 SkScalarCeilToInt(inPicture->cullRect().height()))
; | 642 SkScalarCeilToInt(inPicture->cullRect().height()))
; |
| 643 inPicture->playback(&debugCanvas); | 643 inPicture->playback(&debugCanvas); |
| 644 | 644 |
| 645 // delete the initial save and restore since replaying the commands will | 645 // delete the initial save and restore since replaying the commands will |
| 646 // re-add them | 646 // re-add them |
| 647 if (debugCanvas.getSize() > 1) { | 647 if (debugCanvas.getSize() > 1) { |
| 648 debugCanvas.deleteDrawCommandAt(0); | 648 debugCanvas.deleteDrawCommandAt(0); |
| 649 debugCanvas.deleteDrawCommandAt(debugCanvas.getSize()-1); | 649 debugCanvas.deleteDrawCommandAt(debugCanvas.getSize()-1); |
| 650 } | 650 } |
| 651 | 651 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 671 changed = true; | 671 changed = true; |
| 672 } | 672 } |
| 673 } | 673 } |
| 674 } | 674 } |
| 675 } | 675 } |
| 676 | 676 |
| 677 int numAfter = debugCanvas.getSize(); | 677 int numAfter = debugCanvas.getSize(); |
| 678 | 678 |
| 679 if (!outFile.isEmpty()) { | 679 if (!outFile.isEmpty()) { |
| 680 SkPictureRecorder recorder; | 680 SkPictureRecorder recorder; |
| 681 SkCanvas* canvas = recorder.beginRecording(inPicture->cullRect().width()
, | 681 SkCanvas* canvas = recorder.beginRecording(inPicture->cullRect().width()
, |
| 682 inPicture->cullRect().height(
), | 682 inPicture->cullRect().height(
), |
| 683 NULL, 0); | 683 NULL, 0); |
| 684 debugCanvas.draw(canvas); | 684 debugCanvas.draw(canvas); |
| 685 SkAutoTUnref<SkPicture> outPicture(recorder.endRecording()); | 685 SkAutoTUnref<SkPicture> outPicture(recorder.endRecording()); |
| 686 | 686 |
| 687 SkFILEWStream outStream(outFile.c_str()); | 687 SkFILEWStream outStream(outFile.c_str()); |
| 688 | 688 |
| 689 outPicture->serialize(&outStream); | 689 outPicture->serialize(&outStream); |
| 690 } | 690 } |
| 691 | 691 |
| 692 bool someOptFired = false; | 692 bool someOptFired = false; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 705 } | 705 } |
| 706 | 706 |
| 707 return 0; | 707 return 0; |
| 708 } | 708 } |
| 709 | 709 |
| 710 // This function is not marked as 'static' so it can be referenced externally | 710 // This function is not marked as 'static' so it can be referenced externally |
| 711 // in the iOS build. | 711 // in the iOS build. |
| 712 int tool_main(int argc, char** argv); // suppress a warning on mac | 712 int tool_main(int argc, char** argv); // suppress a warning on mac |
| 713 | 713 |
| 714 int tool_main(int argc, char** argv) { | 714 int tool_main(int argc, char** argv) { |
| 715 #if SK_ENABLE_INST_COUNT | |
| 716 gPrintInstCount = true; | |
| 717 #endif | |
| 718 | |
| 719 SkGraphics::Init(); | 715 SkGraphics::Init(); |
| 720 | 716 |
| 721 if (argc < 3) { | 717 if (argc < 3) { |
| 722 usage(); | 718 usage(); |
| 723 return -1; | 719 return -1; |
| 724 } | 720 } |
| 725 | 721 |
| 726 SkString inFile, outFile, inDir, outDir; | 722 SkString inFile, outFile, inDir, outDir; |
| 727 | 723 |
| 728 char* const* stop = argv + argc; | 724 char* const* stop = argv + argc; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 | 796 |
| 801 SkGraphics::Term(); | 797 SkGraphics::Term(); |
| 802 return 0; | 798 return 0; |
| 803 } | 799 } |
| 804 | 800 |
| 805 #if !defined SK_BUILD_FOR_IOS | 801 #if !defined SK_BUILD_FOR_IOS |
| 806 int main(int argc, char * const argv[]) { | 802 int main(int argc, char * const argv[]) { |
| 807 return tool_main(argc, (char**) argv); | 803 return tool_main(argc, (char**) argv); |
| 808 } | 804 } |
| 809 #endif | 805 #endif |
| OLD | NEW |