| 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 #include "SkOSFile.h" | 10 #include "SkOSFile.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return b; | 65 return b; |
| 66 } else { | 66 } else { |
| 67 return a; | 67 return a; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 void SkDiffContext::addDiff(const char* baselinePath, const char* testPath) { | 71 void SkDiffContext::addDiff(const char* baselinePath, const char* testPath) { |
| 72 // Load the images at the paths | 72 // Load the images at the paths |
| 73 SkBitmap baselineBitmap; | 73 SkBitmap baselineBitmap; |
| 74 SkBitmap testBitmap; | 74 SkBitmap testBitmap; |
| 75 SkAutoMutexAcquire imageLock(fImageMutex); | |
| 76 if (!SkImageDecoder::DecodeFile(baselinePath, &baselineBitmap)) { | 75 if (!SkImageDecoder::DecodeFile(baselinePath, &baselineBitmap)) { |
| 77 SkDebugf("Failed to load bitmap \"%s\"\n", baselinePath); | 76 SkDebugf("Failed to load bitmap \"%s\"\n", baselinePath); |
| 78 return; | 77 return; |
| 79 } | 78 } |
| 80 if (!SkImageDecoder::DecodeFile(testPath, &testBitmap)) { | 79 if (!SkImageDecoder::DecodeFile(testPath, &testBitmap)) { |
| 81 SkDebugf("Failed to load bitmap \"%s\"\n", testPath); | 80 SkDebugf("Failed to load bitmap \"%s\"\n", testPath); |
| 82 return; | 81 return; |
| 83 } | 82 } |
| 84 imageLock.release(); | |
| 85 | 83 |
| 86 // Setup a record for this diff | 84 // Setup a record for this diff |
| 87 fRecordMutex.acquire(); | 85 fRecordMutex.acquire(); |
| 88 DiffRecord* newRecord = fRecords.addToHead(DiffRecord()); | 86 DiffRecord* newRecord = fRecords.addToHead(DiffRecord()); |
| 89 fRecordMutex.release(); | 87 fRecordMutex.release(); |
| 90 | 88 |
| 91 // compute the common name | 89 // compute the common name |
| 92 SkString baseName = SkOSPath::SkBasename(baselinePath); | 90 SkString baseName = SkOSPath::SkBasename(baselinePath); |
| 93 SkString testName = SkOSPath::SkBasename(testPath); | 91 SkString testName = SkOSPath::SkBasename(testPath); |
| 94 newRecord->fCommonName = get_common_prefix(baseName, testName); | 92 newRecord->fCommonName = get_common_prefix(baseName, testName); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 for (int i = 0; i < cntColumns; i++) { | 354 for (int i = 0; i < cntColumns; i++) { |
| 357 SkString str; | 355 SkString str; |
| 358 str.printf(", %f", values[i]); | 356 str.printf(", %f", values[i]); |
| 359 stream.writeText(str.c_str()); | 357 stream.writeText(str.c_str()); |
| 360 } | 358 } |
| 361 stream.writeText("\n"); | 359 stream.writeText("\n"); |
| 362 | 360 |
| 363 currentRecord = iter2.next(); | 361 currentRecord = iter2.next(); |
| 364 } | 362 } |
| 365 } | 363 } |
| OLD | NEW |