| 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 | 7 |
| 8 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
| 10 | 10 |
| 11 #include "SkImageDiffer.h" | 11 #include "SkImageDiffer.h" |
| 12 #include "skpdiff_util.h" | 12 #include "skpdiff_util.h" |
| 13 | 13 |
| 14 const double SkImageDiffer::RESULT_CORRECT = 1.0f; |
| 15 const double SkImageDiffer::RESULT_INCORRECT = 0.0f; |
| 14 | 16 |
| 15 SkImageDiffer::SkImageDiffer() | 17 SkImageDiffer::SkImageDiffer() |
| 16 : fIsGood(true) { | 18 : fIsGood(true) { |
| 17 | 19 |
| 18 } | 20 } |
| 19 | 21 |
| 20 SkImageDiffer::~SkImageDiffer() { | 22 SkImageDiffer::~SkImageDiffer() { |
| 21 | 23 |
| 22 } | 24 } |
| 23 | 25 |
| 24 int SkImageDiffer::queueDiffOfFile(const char baseline[], const char test[]) { | 26 int SkImageDiffer::queueDiffOfFile(const char baseline[], const char test[]) { |
| 25 SkBitmap baselineBitmap; | 27 SkBitmap baselineBitmap; |
| 26 SkBitmap testBitmap; | 28 SkBitmap testBitmap; |
| 27 if (!SkImageDecoder::DecodeFile(baseline, &baselineBitmap)) { | 29 if (!SkImageDecoder::DecodeFile(baseline, &baselineBitmap)) { |
| 28 SkDebugf("Failed to load bitmap \"%s\"\n", baseline); | 30 SkDebugf("Failed to load bitmap \"%s\"\n", baseline); |
| 29 return -1; | 31 return -1; |
| 30 } | 32 } |
| 31 if (!SkImageDecoder::DecodeFile(test, &testBitmap)) { | 33 if (!SkImageDecoder::DecodeFile(test, &testBitmap)) { |
| 32 SkDebugf("Failed to load bitmap \"%s\"\n", test); | 34 SkDebugf("Failed to load bitmap \"%s\"\n", test); |
| 33 return -1; | 35 return -1; |
| 34 } | 36 } |
| 35 return this->queueDiff(&baselineBitmap, &testBitmap); | 37 return this->queueDiff(&baselineBitmap, &testBitmap); |
| 36 } | 38 } |
| OLD | NEW |