Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/test/pixel_comparator.h" | 5 #include "cc/test/pixel_comparator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 SkColor actual_color = actual_bmp.getColor(x, y); | 107 SkColor actual_color = actual_bmp.getColor(x, y); |
| 108 SkColor expected_color = expected_bmp.getColor(x, y); | 108 SkColor expected_color = expected_bmp.getColor(x, y); |
| 109 if (discard_alpha_) { | 109 if (discard_alpha_) { |
| 110 SkColorSetA(actual_color, 0); | 110 SkColorSetA(actual_color, 0); |
| 111 SkColorSetA(expected_color, 0); | 111 SkColorSetA(expected_color, 0); |
| 112 } | 112 } |
| 113 | 113 |
| 114 if (actual_color != expected_color) { | 114 if (actual_color != expected_color) { |
| 115 ++error_pixels_count; | 115 ++error_pixels_count; |
| 116 | 116 |
| 117 LOG(ERROR) << "Pixel error at x=" << x << " y=" << y << "; " | |
|
enne (OOO)
2013/04/28 02:56:55
This is spammy. No errors should be logged unless
| |
| 118 << "actual RGBA=(" | |
| 119 << SkColorGetR(actual_color) << "," | |
| 120 << SkColorGetG(actual_color) << "," | |
| 121 << SkColorGetB(actual_color) << "," | |
| 122 << SkColorGetA(actual_color) << "); " | |
| 123 << "expected RGBA=(" | |
| 124 << SkColorGetR(expected_color) << "," | |
| 125 << SkColorGetG(expected_color) << "," | |
| 126 << SkColorGetB(expected_color) << "," | |
| 127 << SkColorGetA(expected_color) << ")"; | |
| 128 | |
| 129 // Compute per channel errors | 117 // Compute per channel errors |
| 130 int error_r = SkColorGetR(actual_color) - SkColorGetR(expected_color); | 118 int error_r = SkColorGetR(actual_color) - SkColorGetR(expected_color); |
| 131 int error_g = SkColorGetG(actual_color) - SkColorGetG(expected_color); | 119 int error_g = SkColorGetG(actual_color) - SkColorGetG(expected_color); |
| 132 int error_b = SkColorGetB(actual_color) - SkColorGetB(expected_color); | 120 int error_b = SkColorGetB(actual_color) - SkColorGetB(expected_color); |
| 133 int error_a = SkColorGetA(actual_color) - SkColorGetA(expected_color); | 121 int error_a = SkColorGetA(actual_color) - SkColorGetA(expected_color); |
| 134 int abs_error_r = std::abs(error_r); | 122 int abs_error_r = std::abs(error_r); |
| 135 int abs_error_g = std::abs(error_g); | 123 int abs_error_g = std::abs(error_g); |
| 136 int abs_error_b = std::abs(error_b); | 124 int abs_error_b = std::abs(error_b); |
| 137 int abs_error_a = std::abs(error_a); | 125 int abs_error_a = std::abs(error_a); |
| 138 | 126 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 << "G=" << max_abs_error_g << " " | 192 << "G=" << max_abs_error_g << " " |
| 205 << "B=" << max_abs_error_b << " " | 193 << "B=" << max_abs_error_b << " " |
| 206 << "A=" << max_abs_error_a; | 194 << "A=" << max_abs_error_a; |
| 207 return false; | 195 return false; |
| 208 } else { | 196 } else { |
| 209 return true; | 197 return true; |
| 210 } | 198 } |
| 211 } | 199 } |
| 212 | 200 |
| 213 } // namespace cc | 201 } // namespace cc |
| OLD | NEW |