summaryrefslogtreecommitdiffstats
path: root/cc/test/pixel_comparator.cc
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-29 20:35:07 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-29 20:35:07 +0000
commit598067a04707fad741bba1b07586b968bb8c470d (patch)
tree0a3a7ae0567cd19e57e54f8ea3f2bc409c4c43e4 /cc/test/pixel_comparator.cc
parent6d5733d7e21dd379bc15393156b0e80b9f3e26d0 (diff)
downloadchromium_src-598067a04707fad741bba1b07586b968bb8c470d.zip
chromium_src-598067a04707fad741bba1b07586b968bb8c470d.tar.gz
chromium_src-598067a04707fad741bba1b07586b968bb8c470d.tar.bz2
cc: Add software renderer pixel tests
Parameterize the existing gl renderer tests to use the software renderer and reuse them when appropriate. As the software renderer doesn't support filters or antialiasing, these are only turned on for the gl renderer at this point. R=danakj@chromium.org BUG=none Review URL: https://chromiumcodereview.appspot.com/14135011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197121 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/pixel_comparator.cc')
-rw-r--r--cc/test/pixel_comparator.cc37
1 files changed, 25 insertions, 12 deletions
diff --git a/cc/test/pixel_comparator.cc b/cc/test/pixel_comparator.cc
index 53b1f9d..01e54cb 100644
--- a/cc/test/pixel_comparator.cc
+++ b/cc/test/pixel_comparator.cc
@@ -114,18 +114,6 @@ bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp,
if (actual_color != expected_color) {
++error_pixels_count;
- LOG(ERROR) << "Pixel error at x=" << x << " y=" << y << "; "
- << "actual RGBA=("
- << SkColorGetR(actual_color) << ","
- << SkColorGetG(actual_color) << ","
- << SkColorGetB(actual_color) << ","
- << SkColorGetA(actual_color) << "); "
- << "expected RGBA=("
- << SkColorGetR(expected_color) << ","
- << SkColorGetG(expected_color) << ","
- << SkColorGetB(expected_color) << ","
- << SkColorGetA(expected_color) << ")";
-
// Compute per channel errors
int error_r = SkColorGetR(actual_color) - SkColorGetR(expected_color);
int error_g = SkColorGetG(actual_color) - SkColorGetG(expected_color);
@@ -204,6 +192,31 @@ bool FuzzyPixelComparator::Compare(const SkBitmap& actual_bmp,
<< "G=" << max_abs_error_g << " "
<< "B=" << max_abs_error_b << " "
<< "A=" << max_abs_error_a;
+
+ for (int x = 0; x < actual_bmp.width(); ++x) {
+ for (int y = 0; y < actual_bmp.height(); ++y) {
+ SkColor actual_color = actual_bmp.getColor(x, y);
+ SkColor expected_color = expected_bmp.getColor(x, y);
+ if (discard_alpha_) {
+ SkColorSetA(actual_color, 0);
+ SkColorSetA(expected_color, 0);
+ }
+ if (actual_color != expected_color) {
+ LOG(ERROR) << "Pixel error at x=" << x << " y=" << y << "; "
+ << "actual RGBA=("
+ << SkColorGetR(actual_color) << ","
+ << SkColorGetG(actual_color) << ","
+ << SkColorGetB(actual_color) << ","
+ << SkColorGetA(actual_color) << "); "
+ << "expected RGBA=("
+ << SkColorGetR(expected_color) << ","
+ << SkColorGetG(expected_color) << ","
+ << SkColorGetB(expected_color) << ","
+ << SkColorGetA(expected_color) << ")";
+ }
+ }
+ }
+
return false;
} else {
return true;