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 <stdint.h> |
| 8 |
7 #include <algorithm> | 9 #include <algorithm> |
8 | 10 |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
11 | 13 |
12 namespace cc { | 14 namespace cc { |
13 | 15 |
14 ExactPixelComparator::ExactPixelComparator(const bool discard_alpha) | 16 ExactPixelComparator::ExactPixelComparator(const bool discard_alpha) |
15 : discard_alpha_(discard_alpha) { | 17 : discard_alpha_(discard_alpha) { |
16 } | 18 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 small_error_threshold_(small_error_threshold) { | 70 small_error_threshold_(small_error_threshold) { |
69 } | 71 } |
70 | 72 |
71 bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp, | 73 bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp, |
72 const SkBitmap& expected_bmp) const { | 74 const SkBitmap& expected_bmp) const { |
73 // Number of pixels with an error | 75 // Number of pixels with an error |
74 int error_pixels_count = 0; | 76 int error_pixels_count = 0; |
75 // Number of pixels with a small error | 77 // Number of pixels with a small error |
76 int small_error_pixels_count = 0; | 78 int small_error_pixels_count = 0; |
77 // The per channel sums of absolute errors over all pixels. | 79 // The per channel sums of absolute errors over all pixels. |
78 int64 sum_abs_error_r = 0; | 80 int64_t sum_abs_error_r = 0; |
79 int64 sum_abs_error_g = 0; | 81 int64_t sum_abs_error_g = 0; |
80 int64 sum_abs_error_b = 0; | 82 int64_t sum_abs_error_b = 0; |
81 int64 sum_abs_error_a = 0; | 83 int64_t sum_abs_error_a = 0; |
82 // The per channel maximum absolute errors over all pixels. | 84 // The per channel maximum absolute errors over all pixels. |
83 int max_abs_error_r = 0; | 85 int max_abs_error_r = 0; |
84 int max_abs_error_g = 0; | 86 int max_abs_error_g = 0; |
85 int max_abs_error_b = 0; | 87 int max_abs_error_b = 0; |
86 int max_abs_error_a = 0; | 88 int max_abs_error_a = 0; |
87 | 89 |
88 gfx::Rect error_bounding_rect = gfx::Rect(); | 90 gfx::Rect error_bounding_rect = gfx::Rect(); |
89 | 91 |
90 // Check that bitmaps have identical dimensions. | 92 // Check that bitmaps have identical dimensions. |
91 DCHECK(actual_bmp.width() == expected_bmp.width() && | 93 DCHECK(actual_bmp.width() == expected_bmp.width() && |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 203 } |
202 } | 204 } |
203 LOG(ERROR) << "Error Bounding Box : " << error_bounding_rect.ToString(); | 205 LOG(ERROR) << "Error Bounding Box : " << error_bounding_rect.ToString(); |
204 return false; | 206 return false; |
205 } else { | 207 } else { |
206 return true; | 208 return true; |
207 } | 209 } |
208 } | 210 } |
209 | 211 |
210 } // namespace cc | 212 } // namespace cc |
OLD | NEW |