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

Side by Side Diff: tools/iOSShell.cpp

Issue 389653004: share dm and command flags (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address comments Created 6 years, 5 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
« tests/skia_test.cpp ('K') | « tools/flags/SkCommonFlags.cpp ('k') | 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 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 "iOSShell.h" 8 #include "iOSShell.h"
9 9
10 #include "Resources.h" 10 #include "Resources.h"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkCommandLineFlags.h" 12 #include "SkCommonFlags.h"
13 #include "SkGraphics.h" 13 #include "SkGraphics.h"
14 #include "SkThreadPool.h"
14 #include "SkWindow.h" 15 #include "SkWindow.h"
15 #include "sk_tool_utils.h" 16 #include "sk_tool_utils.h"
16 17
17 ////////////////////////////////////////////////////////////////////////////// 18 //////////////////////////////////////////////////////////////////////////////
18 19
19 static SkView* curr_view(SkWindow* wind) { 20 static SkView* curr_view(SkWindow* wind) {
20 SkView::F2BIter iter(wind); 21 SkView::F2BIter iter(wind);
21 return iter.next(); 22 return iter.next();
22 } 23 }
23 24
(...skipping 21 matching lines...) Expand all
45 } 46 }
46 47
47 void ShellWindow::onSizeChange() { 48 void ShellWindow::onSizeChange() {
48 this->INHERITED::onSizeChange(); 49 this->INHERITED::onSizeChange();
49 50
50 SkView::F2BIter iter(this); 51 SkView::F2BIter iter(this);
51 SkView* view = iter.next(); 52 SkView* view = iter.next();
52 view->setSize(this->width(), this->height()); 53 view->setSize(this->width(), this->height());
53 } 54 }
54 55
55 void tool_main(int argc, char *argv[]); 56 DEFINE_bool(dm, false, "run dm");
57 DEFINE_bool(unittests, false, "run unit tests");
58
59 void dm_main(int argc, char *argv[]);
60 void test_main(int argc, char *argv[]);
56 61
57 bool set_cmd_line_args(int argc, char *argv[], const char* resourceDir) { 62 bool set_cmd_line_args(int argc, char *argv[], const char* resourceDir) {
58 for (int index = 0; index < argc; ++index) { 63 SkCommandLineFlags::SetUsage("");
59 if (!strcmp("--test", argv[index])) { 64 SkCommandLineFlags::Parse(argc, argv);
60 SetResourcePath(resourceDir); 65 SetResourcePath(resourceDir);
61 tool_main(argc - 1, argv); 66 if (FLAGS_dm) {
62 return true; 67 dm_main(argc, argv);
63 } 68 return true;
69 }
70 if (FLAGS_unittests) {
71 test_main(argc, argv);
72 return true;
64 } 73 }
65 return false; 74 return false;
66 } 75 }
67 76
68 // FIXME: this should be in a header 77 // FIXME: this should be in a header
69 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv); 78 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv);
70 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) { 79 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) {
71 return new ShellWindow(hwnd, argc, argv); 80 return new ShellWindow(hwnd, argc, argv);
72 } 81 }
73 82
(...skipping 12 matching lines...) Expand all
86 SkGraphics::Init(); 95 SkGraphics::Init();
87 SkEvent::Init(); 96 SkEvent::Init();
88 } 97 }
89 98
90 // FIXME: this should be in a header 99 // FIXME: this should be in a header
91 void application_term(); 100 void application_term();
92 void application_term() { 101 void application_term() {
93 SkEvent::Term(); 102 SkEvent::Term();
94 SkGraphics::Term(); 103 SkGraphics::Term();
95 } 104 }
OLDNEW
« tests/skia_test.cpp ('K') | « tools/flags/SkCommonFlags.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698