| 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 | 9 |
| 10 #include "SkDifferentPixelsMetric.h" | 10 #include "SkDifferentPixelsMetric.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 "
\n" | 29 "
\n" |
| 30 " atomic_inc(result);
\n" | 30 " atomic_inc(result);
\n" |
| 31 " // TODO: generate alpha mask
\n" | 31 " // TODO: generate alpha mask
\n" |
| 32 " }
\n" | 32 " }
\n" |
| 33 "}
\n"; | 33 "}
\n"; |
| 34 | 34 |
| 35 const char* SkDifferentPixelsMetric::getName() const { | 35 const char* SkDifferentPixelsMetric::getName() const { |
| 36 return "different_pixels"; | 36 return "different_pixels"; |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool SkDifferentPixelsMetric::diff(SkBitmap* baseline, SkBitmap* test, bool comp
uteMask, | 39 bool SkDifferentPixelsMetric::diff(SkBitmap* baseline, SkBitmap* test, bool comp
uteAlphaMask, |
| 40 bool computeRgbDiff, bool computeWhiteDiff, |
| 40 Result* result) const { | 41 Result* result) const { |
| 41 double startTime = get_seconds(); | 42 double startTime = get_seconds(); |
| 42 | 43 |
| 43 if (!fIsGood) { | 44 if (!fIsGood) { |
| 44 return false; | 45 return false; |
| 45 } | 46 } |
| 46 | 47 |
| 47 // If we never end up running the kernel, include some safe defaults in the
result. | 48 // If we never end up running the kernel, include some safe defaults in the
result. |
| 48 result->poiCount = 0; | 49 result->poiCount = 0; |
| 49 | 50 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return true; | 112 return true; |
| 112 } | 113 } |
| 113 | 114 |
| 114 bool SkDifferentPixelsMetric::onInit() { | 115 bool SkDifferentPixelsMetric::onInit() { |
| 115 if (!this->loadKernelSource(kDifferentPixelsKernelSource, "diff", &fKernel))
{ | 116 if (!this->loadKernelSource(kDifferentPixelsKernelSource, "diff", &fKernel))
{ |
| 116 return false; | 117 return false; |
| 117 } | 118 } |
| 118 | 119 |
| 119 return true; | 120 return true; |
| 120 } | 121 } |
| OLD | NEW |