commit-bot@chromium.org | be19b9e | 2013-06-14 17:26:54 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
commit-bot@chromium.org | be19b9e | 2013-06-14 17:26:54 +0000 | [diff] [blame] | 8 | #include "SkBitmap.h" |
| 9 | #include "SkImageDecoder.h" |
| 10 | |
| 11 | #include "SkImageDiffer.h" |
commit-bot@chromium.org | be19b9e | 2013-06-14 17:26:54 +0000 | [diff] [blame] | 12 | #include "skpdiff_util.h" |
| 13 | |
djsollen@google.com | 2761b30d | 2013-11-07 19:40:35 +0000 | [diff] [blame^] | 14 | const double SkImageDiffer::RESULT_CORRECT = 1.0f; |
| 15 | const double SkImageDiffer::RESULT_INCORRECT = 0.0f; |
commit-bot@chromium.org | be19b9e | 2013-06-14 17:26:54 +0000 | [diff] [blame] | 16 | |
| 17 | SkImageDiffer::SkImageDiffer() |
| 18 | : fIsGood(true) { |
| 19 | |
| 20 | } |
| 21 | |
| 22 | SkImageDiffer::~SkImageDiffer() { |
| 23 | |
| 24 | } |
| 25 | |
| 26 | int SkImageDiffer::queueDiffOfFile(const char baseline[], const char test[]) { |
| 27 | SkBitmap baselineBitmap; |
| 28 | SkBitmap testBitmap; |
| 29 | if (!SkImageDecoder::DecodeFile(baseline, &baselineBitmap)) { |
| 30 | SkDebugf("Failed to load bitmap \"%s\"\n", baseline); |
| 31 | return -1; |
| 32 | } |
| 33 | if (!SkImageDecoder::DecodeFile(test, &testBitmap)) { |
| 34 | SkDebugf("Failed to load bitmap \"%s\"\n", test); |
| 35 | return -1; |
| 36 | } |
| 37 | return this->queueDiff(&baselineBitmap, &testBitmap); |
| 38 | } |