Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: tools/filtermain.cpp

Issue 15029008: Fix memory leak in filter tool (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkGraphics.h" 10 #include "SkGraphics.h"
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 { check_4, apply_4, 0 }, 619 { check_4, apply_4, 0 },
620 { check_5, apply_5, 0 }, 620 { check_5, apply_5, 0 },
621 { check_6, apply_6, 0 }, 621 { check_6, apply_6, 0 },
622 { check_7, apply_7, 0 }, 622 { check_7, apply_7, 0 },
623 { check_8, apply_8, 0 }, 623 { check_8, apply_8, 0 },
624 { check_9, apply_9, 0 }, 624 { check_9, apply_9, 0 },
625 }; 625 };
626 626
627 627
628 static int filter_picture(const SkString& inFile, const SkString& outFile) { 628 static int filter_picture(const SkString& inFile, const SkString& outFile) {
629 SkPicture* inPicture = NULL; 629 SkAutoTDelete<SkPicture> inPicture;
bungeman-skia 2013/05/10 17:30:36 SkPicture is SkRefCnt, it seems odd to SkAutoTDele
630 630
631 SkFILEStream inStream(inFile.c_str()); 631 SkFILEStream inStream(inFile.c_str());
632 if (inStream.isValid()) { 632 if (inStream.isValid()) {
633 inPicture = SkNEW_ARGS(SkPicture, (&inStream, NULL, &SkImageDecoder::Dec odeMemory)); 633 inPicture.reset(SkNEW_ARGS(SkPicture, (&inStream, NULL, &SkImageDecoder: :DecodeMemory)));
634 } 634 }
635 635
636 if (NULL == inPicture) { 636 if (NULL == inPicture.get()) {
637 SkDebugf("Could not read file %s\n", inFile.c_str()); 637 SkDebugf("Could not read file %s\n", inFile.c_str());
638 return -1; 638 return -1;
639 } 639 }
640 640
641 int localCount[SK_ARRAY_COUNT(gOptTable)]; 641 int localCount[SK_ARRAY_COUNT(gOptTable)];
642 642
643 memset(localCount, 0, sizeof(localCount)); 643 memset(localCount, 0, sizeof(localCount));
644 644
645 SkDebugCanvas debugCanvas(inPicture->width(), inPicture->height()); 645 SkDebugCanvas debugCanvas(inPicture->width(), inPicture->height());
646 debugCanvas.setBounds(inPicture->width(), inPicture->height()); 646 debugCanvas.setBounds(inPicture->width(), inPicture->height());
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 } 708 }
709 709
710 return 0; 710 return 0;
711 } 711 }
712 712
713 // This function is not marked as 'static' so it can be referenced externally 713 // This function is not marked as 'static' so it can be referenced externally
714 // in the iOS build. 714 // in the iOS build.
715 int tool_main(int argc, char** argv); // suppress a warning on mac 715 int tool_main(int argc, char** argv); // suppress a warning on mac
716 716
717 int tool_main(int argc, char** argv) { 717 int tool_main(int argc, char** argv) {
718 #if SK_ENABLE_INST_COUNT
719 gPrintInstCount = true;
720 #endif
721
jvanverth1 2013/05/10 14:34:46 Did you mean to leave this in there?
robertphillips 2013/05/10 14:36:18 Yep - when enabled it prints out leak info
718 SkGraphics::Init(); 722 SkGraphics::Init();
719 723
720 if (argc < 3) { 724 if (argc < 3) {
721 usage(); 725 usage();
722 return -1; 726 return -1;
723 } 727 }
724 728
725 SkString inFile, outFile, inDir, outDir; 729 SkString inFile, outFile, inDir, outDir;
726 730
727 char* const* stop = argv + argc; 731 char* const* stop = argv + argc;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 803
800 SkGraphics::Term(); 804 SkGraphics::Term();
801 return 0; 805 return 0;
802 } 806 }
803 807
804 #if !defined SK_BUILD_FOR_IOS 808 #if !defined SK_BUILD_FOR_IOS
805 int main(int argc, char * const argv[]) { 809 int main(int argc, char * const argv[]) {
806 return tool_main(argc, (char**) argv); 810 return tool_main(argc, (char**) argv);
807 } 811 }
808 #endif 812 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698