| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |