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

Side by Side Diff: tools/get_images_from_skps.cpp

Issue 1917413003: Treat kIncompleteInput as successes in get_images_from_skps (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 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
« 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 2016 Google Inc. 2 * Copyright 2016 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 "SkCodec.h" 9 #include "SkCodec.h"
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 default: 75 default:
76 // This should be unreachable because we cannot create a codec i f we do not know 76 // This should be unreachable because we cannot create a codec i f we do not know
77 // the image type. 77 // the image type.
78 SkASSERT(false); 78 SkASSERT(false);
79 } 79 }
80 80
81 if (FLAGS_testDecode) { 81 if (FLAGS_testDecode) {
82 SkBitmap bitmap; 82 SkBitmap bitmap;
83 SkImageInfo info = codec->getInfo().makeColorType(kN32_SkColorType); 83 SkImageInfo info = codec->getInfo().makeColorType(kN32_SkColorType);
84 bitmap.allocPixels(info); 84 bitmap.allocPixels(info);
85 if (SkCodec::kSuccess != codec->getPixels(info, bitmap.getPixels(), bitmap.rowBytes())) 85 const SkCodec::Result result = codec->getPixels(
86 info, bitmap.getPixels(), bitmap.rowBytes());
87 if (SkCodec::kIncompleteInput != result && SkCodec::kSuccess != resu lt)
86 { 88 {
87 SkDebugf("Decoding failed for %s\n", skpName.c_str()); 89 SkDebugf("Decoding failed for %s\n", skpName.c_str());
88 gSkpToUnknownCount[skpName]++; 90 gSkpToUnknownCount[skpName]++;
89 return; 91 return;
90 } 92 }
91 } 93 }
92 94
93 if (FLAGS_writeImages) { 95 if (FLAGS_writeImages) {
94 SkString path; 96 SkString path;
95 path.appendf("%s/%d.%s", gOutputDir, gKnown, ext.c_str()); 97 path.appendf("%s/%d.%s", gOutputDir, gKnown, ext.c_str());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (!FLAGS_failuresJsonPath.isEmpty()) { 163 if (!FLAGS_failuresJsonPath.isEmpty()) {
162 SkDebugf("Writing failures to %s\n", FLAGS_failuresJsonPath[0]); 164 SkDebugf("Writing failures to %s\n", FLAGS_failuresJsonPath[0]);
163 SkFILEWStream stream(FLAGS_failuresJsonPath[0]); 165 SkFILEWStream stream(FLAGS_failuresJsonPath[0]);
164 stream.writeText(Json::StyledWriter().write(fRoot).c_str()); 166 stream.writeText(Json::StyledWriter().write(fRoot).c_str());
165 stream.flush(); 167 stream.flush();
166 } 168 }
167 return -1; 169 return -1;
168 } 170 }
169 return 0; 171 return 0;
170 } 172 }
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