Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: cc/test/pixel_comparator.h

Issue 628443002: replace OVERRIDE and FINAL with override and final in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/ordered_simple_task_runner.h ('k') | cc/test/pixel_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CC_TEST_PIXEL_COMPARATOR_H_ 5 #ifndef CC_TEST_PIXEL_COMPARATOR_H_
6 #define CC_TEST_PIXEL_COMPARATOR_H_ 6 #define CC_TEST_PIXEL_COMPARATOR_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 10
(...skipping 11 matching lines...) Expand all
22 // Exact pixel comparator. Counts the number of pixel with an error. 22 // Exact pixel comparator. Counts the number of pixel with an error.
23 class ExactPixelComparator : public PixelComparator { 23 class ExactPixelComparator : public PixelComparator {
24 public: 24 public:
25 explicit ExactPixelComparator(const bool discard_alpha); 25 explicit ExactPixelComparator(const bool discard_alpha);
26 virtual ~ExactPixelComparator() {} 26 virtual ~ExactPixelComparator() {}
27 27
28 // Returns true if the two bitmaps are identical. Otherwise, returns false 28 // Returns true if the two bitmaps are identical. Otherwise, returns false
29 // and report the number of pixels with an error on LOG(ERROR). Differences 29 // and report the number of pixels with an error on LOG(ERROR). Differences
30 // in the alpha channel are ignored. 30 // in the alpha channel are ignored.
31 virtual bool Compare(const SkBitmap& actual_bmp, 31 virtual bool Compare(const SkBitmap& actual_bmp,
32 const SkBitmap& expected_bmp) const OVERRIDE; 32 const SkBitmap& expected_bmp) const override;
33 33
34 private: 34 private:
35 // Exclude alpha channel from comparison? 35 // Exclude alpha channel from comparison?
36 bool discard_alpha_; 36 bool discard_alpha_;
37 }; 37 };
38 38
39 // Fuzzy pixel comparator. Counts small and arbitrary errors separately and 39 // Fuzzy pixel comparator. Counts small and arbitrary errors separately and
40 // computes average and maximum absolute errors per color channel. 40 // computes average and maximum absolute errors per color channel.
41 class FuzzyPixelComparator : public PixelComparator { 41 class FuzzyPixelComparator : public PixelComparator {
42 public: 42 public:
43 FuzzyPixelComparator(const bool discard_alpha, 43 FuzzyPixelComparator(const bool discard_alpha,
44 const float error_pixels_percentage_limit, 44 const float error_pixels_percentage_limit,
45 const float small_error_pixels_percentage_limit, 45 const float small_error_pixels_percentage_limit,
46 const float avg_abs_error_limit, 46 const float avg_abs_error_limit,
47 const int max_abs_error_limit, 47 const int max_abs_error_limit,
48 const int small_error_threshold); 48 const int small_error_threshold);
49 virtual ~FuzzyPixelComparator() {} 49 virtual ~FuzzyPixelComparator() {}
50 50
51 // Computes error metrics and returns true if the errors don't exceed the 51 // Computes error metrics and returns true if the errors don't exceed the
52 // specified limits. Otherwise, returns false and reports the error metrics on 52 // specified limits. Otherwise, returns false and reports the error metrics on
53 // LOG(ERROR). Differences in the alpha channel are ignored. 53 // LOG(ERROR). Differences in the alpha channel are ignored.
54 virtual bool Compare(const SkBitmap& actual_bmp, 54 virtual bool Compare(const SkBitmap& actual_bmp,
55 const SkBitmap& expected_bmp) const OVERRIDE; 55 const SkBitmap& expected_bmp) const override;
56 56
57 private: 57 private:
58 // Exclude alpha channel from comparison? 58 // Exclude alpha channel from comparison?
59 bool discard_alpha_; 59 bool discard_alpha_;
60 // Limit for percentage of pixels with an error. 60 // Limit for percentage of pixels with an error.
61 float error_pixels_percentage_limit_; 61 float error_pixels_percentage_limit_;
62 // Limit for percentage of pixels with a small error. 62 // Limit for percentage of pixels with a small error.
63 float small_error_pixels_percentage_limit_; 63 float small_error_pixels_percentage_limit_;
64 // Limit for average absolute error (excluding identical pixels). 64 // Limit for average absolute error (excluding identical pixels).
65 float avg_abs_error_limit_; 65 float avg_abs_error_limit_;
66 // Limit for largest absolute error. 66 // Limit for largest absolute error.
67 int max_abs_error_limit_; 67 int max_abs_error_limit_;
68 // Threshold for small errors. 68 // Threshold for small errors.
69 int small_error_threshold_; 69 int small_error_threshold_;
70 }; 70 };
71 71
72 // All pixels can be off by one, but any more than that is an error. 72 // All pixels can be off by one, but any more than that is an error.
73 class FuzzyPixelOffByOneComparator : public FuzzyPixelComparator { 73 class FuzzyPixelOffByOneComparator : public FuzzyPixelComparator {
74 public: 74 public:
75 explicit FuzzyPixelOffByOneComparator(bool discard_alpha) 75 explicit FuzzyPixelOffByOneComparator(bool discard_alpha)
76 : FuzzyPixelComparator(discard_alpha, 100.f, 0.f, 1.f, 1, 0) {} 76 : FuzzyPixelComparator(discard_alpha, 100.f, 0.f, 1.f, 1, 0) {}
77 }; 77 };
78 78
79 } // namespace cc 79 } // namespace cc
80 80
81 #endif // CC_TEST_PIXEL_COMPARATOR_H_ 81 #endif // CC_TEST_PIXEL_COMPARATOR_H_
OLDNEW
« no previous file with comments | « cc/test/ordered_simple_task_runner.h ('k') | cc/test/pixel_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698