OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCommandLineFlags.h" | 9 #include "SkCommandLineFlags.h" |
10 #include "SkCommonFlags.h" | 10 #include "SkCommonFlags.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 int tool_main(int argc, char** argv); | 31 int tool_main(int argc, char** argv); |
32 int tool_main(int argc, char** argv) { | 32 int tool_main(int argc, char** argv) { |
33 SkCommandLineFlags::SetUsage("Brute force blur of an image."); | 33 SkCommandLineFlags::SetUsage("Brute force blur of an image."); |
34 SkCommandLineFlags::Parse(argc, argv); | 34 SkCommandLineFlags::Parse(argc, argv); |
35 | 35 |
36 if (FLAGS_sigma <= 0) { | 36 if (FLAGS_sigma <= 0) { |
37 if (!FLAGS_quiet) { | 37 if (!FLAGS_quiet) { |
38 SkDebugf("Sigma must be greater than zero (it is %f).\n", FLAGS_sigm
a); | 38 SkDebugf("Sigma must be greater than zero (it is %f).\n", FLAGS_sigm
a); |
39 } | 39 } |
40 return kError; | 40 return kError; |
41 } | 41 } |
42 | 42 |
43 sk_sp<SkData> data(SkData::MakeFromFileName(FLAGS_in[0])); | 43 sk_sp<SkData> data(SkData::MakeFromFileName(FLAGS_in[0])); |
44 if (nullptr == data) { | 44 if (nullptr == data) { |
45 if (!FLAGS_quiet) { | 45 if (!FLAGS_quiet) { |
46 SkDebugf("Couldn't open file: %s\n", FLAGS_in[0]); | 46 SkDebugf("Couldn't open file: %s\n", FLAGS_in[0]); |
47 } | 47 } |
48 return kError; | 48 return kError; |
49 } | 49 } |
50 | 50 |
(...skipping 12 matching lines...) Expand all Loading... |
63 } | 63 } |
64 return kError; | 64 return kError; |
65 } | 65 } |
66 | 66 |
67 SkBitmap dst = sk_tool_utils::slow_blur(src, (float) FLAGS_sigma); | 67 SkBitmap dst = sk_tool_utils::slow_blur(src, (float) FLAGS_sigma); |
68 | 68 |
69 if (!SkImageEncoder::EncodeFile(FLAGS_out[0], dst, SkImageEncoder::kPNG_Type
, 100)) { | 69 if (!SkImageEncoder::EncodeFile(FLAGS_out[0], dst, SkImageEncoder::kPNG_Type
, 100)) { |
70 if (!FLAGS_quiet) { | 70 if (!FLAGS_quiet) { |
71 SkDebugf("Couldn't write to file: %s\n", FLAGS_out[0]); | 71 SkDebugf("Couldn't write to file: %s\n", FLAGS_out[0]); |
72 } | 72 } |
73 return kError; | 73 return kError; |
74 } | 74 } |
75 | 75 |
76 return kSuccess; | 76 return kSuccess; |
77 } | 77 } |
78 | 78 |
79 #if !defined SK_BUILD_FOR_IOS | 79 #if !defined SK_BUILD_FOR_IOS |
80 int main(int argc, char * const argv[]) { | 80 int main(int argc, char * const argv[]) { |
81 return tool_main(argc, (char**) argv); | 81 return tool_main(argc, (char**) argv); |
82 } | 82 } |
83 #endif | 83 #endif |
OLD | NEW |