| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 * TODO(epoger): Combine this with tools/image_expectations.cpp, or eliminate on
e of the two. | 7 * TODO(epoger): Combine this with tools/image_expectations.cpp, or eliminate on
e of the two. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 #include "gm_expectations.h" | 10 #include "gm_expectations.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 return jsonExpectations; | 200 return jsonExpectations; |
| 201 } | 201 } |
| 202 #endif | 202 #endif |
| 203 | 203 |
| 204 // IndividualImageExpectationsSource class... | 204 // IndividualImageExpectationsSource class... |
| 205 | 205 |
| 206 Expectations IndividualImageExpectationsSource::get(const char *testName) co
nst { | 206 Expectations IndividualImageExpectationsSource::get(const char *testName) co
nst { |
| 207 SkString path = SkOSPath::SkPathJoin(fRootDir.c_str(), testName); | 207 SkString path = SkOSPath::SkPathJoin(fRootDir.c_str(), testName); |
| 208 SkBitmap referenceBitmap; | 208 SkBitmap referenceBitmap; |
| 209 bool decodedReferenceBitmap = | 209 bool decodedReferenceBitmap = |
| 210 SkImageDecoder::DecodeFile(path.c_str(), &referenceBitmap, | 210 SkImageDecoder::DecodeFile(path.c_str(), &referenceBitmap, kN32_SkCo
lorType, |
| 211 SkBitmap::kARGB_8888_Config, | 211 SkImageDecoder::kDecodePixels_Mode, NULL)
; |
| 212 SkImageDecoder::kDecodePixels_Mode, | |
| 213 NULL); | |
| 214 if (decodedReferenceBitmap) { | 212 if (decodedReferenceBitmap) { |
| 215 return Expectations(referenceBitmap); | 213 return Expectations(referenceBitmap); |
| 216 } else { | 214 } else { |
| 217 return Expectations(); | 215 return Expectations(); |
| 218 } | 216 } |
| 219 } | 217 } |
| 220 | 218 |
| 221 | 219 |
| 222 #ifdef SK_BUILD_JSON_WRITER | 220 #ifdef SK_BUILD_JSON_WRITER |
| 223 // JsonExpectationsSource class... | 221 // JsonExpectationsSource class... |
| (...skipping 20 matching lines...) Expand all Loading... |
| 244 Json::Reader reader; | 242 Json::Reader reader; |
| 245 if (!reader.parse(bytes, bytes+size, *jsonRoot)) { | 243 if (!reader.parse(bytes, bytes+size, *jsonRoot)) { |
| 246 SkDebugf("error parsing JSON file %s\n", jsonPath); | 244 SkDebugf("error parsing JSON file %s\n", jsonPath); |
| 247 DEBUGFAIL_SEE_STDERR; | 245 DEBUGFAIL_SEE_STDERR; |
| 248 return false; | 246 return false; |
| 249 } | 247 } |
| 250 return true; | 248 return true; |
| 251 } | 249 } |
| 252 #endif | 250 #endif |
| 253 } | 251 } |
| OLD | NEW |