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

Side by Side Diff: tools/imgslice.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 years, 9 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
« no previous file with comments | « tools/imgblur.cpp ('k') | tools/skhello.cpp » ('j') | 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 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 "SkData.h" 10 #include "SkData.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return kError; 52 return kError;
53 } 53 }
54 54
55 if (FLAGS_row < 0 && FLAGS_column < 0) { 55 if (FLAGS_row < 0 && FLAGS_column < 0) {
56 if (!FLAGS_quiet) { 56 if (!FLAGS_quiet) {
57 SkDebugf("At least one of '-c' or '-r' need to be specified.\n"); 57 SkDebugf("At least one of '-c' or '-r' need to be specified.\n");
58 } 58 }
59 return kError; 59 return kError;
60 } 60 }
61 61
62 SkAutoTUnref<SkData> data(SkData::NewFromFileName(FLAGS_image[0])); 62 sk_sp<SkData> data(SkData::MakeFromFileName(FLAGS_image[0]));
63 if (nullptr == data) { 63 if (nullptr == data) {
64 if (!FLAGS_quiet) { 64 if (!FLAGS_quiet) {
65 SkDebugf("Couldn't open file: %s\n", FLAGS_image[0]); 65 SkDebugf("Couldn't open file: %s\n", FLAGS_image[0]);
66 } 66 }
67 return kError; 67 return kError;
68 } 68 }
69 69
70 SkAutoTDelete<SkImage> image(SkImage::NewFromEncoded(data)); 70 sk_sp<SkImage> image(SkImage::MakeFromEncoded(data));
71 if (!image) { 71 if (!image) {
72 if (!FLAGS_quiet) { 72 if (!FLAGS_quiet) {
73 SkDebugf("Couldn't create image for: %s.\n", FLAGS_image[0]); 73 SkDebugf("Couldn't create image for: %s.\n", FLAGS_image[0]);
74 } 74 }
75 return kError; 75 return kError;
76 } 76 }
77 77
78 SkBitmap bitmap; 78 SkBitmap bitmap;
79 if (!image->asLegacyBitmap(&bitmap, SkImage::kRW_LegacyBitmapMode)) { 79 if (!image->asLegacyBitmap(&bitmap, SkImage::kRW_LegacyBitmapMode)) {
80 if (!FLAGS_quiet) { 80 if (!FLAGS_quiet) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 SkDebugf("\n"); 134 SkDebugf("\n");
135 135
136 return kSuccess; 136 return kSuccess;
137 } 137 }
138 138
139 #if !defined SK_BUILD_FOR_IOS 139 #if !defined SK_BUILD_FOR_IOS
140 int main(int argc, char * const argv[]) { 140 int main(int argc, char * const argv[]) {
141 return tool_main(argc, (char**) argv); 141 return tool_main(argc, (char**) argv);
142 } 142 }
143 #endif 143 #endif
OLDNEW
« no previous file with comments | « tools/imgblur.cpp ('k') | tools/skhello.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698