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 22 matching lines...) Expand all Loading... |
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 SkAutoTUnref<SkData> data(SkData::NewFromFileName(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 |
51 SkAutoTDelete<SkImage> image(SkImage::NewFromEncoded(data)); | 51 sk_sp<SkImage> image(SkImage::MakeFromEncoded(data)); |
52 if (!image) { | 52 if (!image) { |
53 if (!FLAGS_quiet) { | 53 if (!FLAGS_quiet) { |
54 SkDebugf("Couldn't create image for: %s.\n", FLAGS_in[0]); | 54 SkDebugf("Couldn't create image for: %s.\n", FLAGS_in[0]); |
55 } | 55 } |
56 return kError; | 56 return kError; |
57 } | 57 } |
58 | 58 |
59 SkBitmap src; | 59 SkBitmap src; |
60 if (!image->asLegacyBitmap(&src, SkImage::kRW_LegacyBitmapMode)) { | 60 if (!image->asLegacyBitmap(&src, SkImage::kRW_LegacyBitmapMode)) { |
61 if (!FLAGS_quiet) { | 61 if (!FLAGS_quiet) { |
(...skipping 12 matching lines...) Expand all Loading... |
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 |