OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 gfx::Rect error_bounding_rect = gfx::Rect(); | 572 gfx::Rect error_bounding_rect = gfx::Rect(); |
573 | 573 |
574 // Check that bitmaps have identical dimensions. | 574 // Check that bitmaps have identical dimensions. |
575 EXPECT_EQ(expected_bmp.width(), actual_bmp.width()); | 575 EXPECT_EQ(expected_bmp.width(), actual_bmp.width()); |
576 EXPECT_EQ(expected_bmp.height(), actual_bmp.height()); | 576 EXPECT_EQ(expected_bmp.height(), actual_bmp.height()); |
577 if (expected_bmp.width() != actual_bmp.width() || | 577 if (expected_bmp.width() != actual_bmp.width() || |
578 expected_bmp.height() != actual_bmp.height()) { | 578 expected_bmp.height() != actual_bmp.height()) { |
579 return false; | 579 return false; |
580 } | 580 } |
581 | 581 |
582 SkAutoLockPixels lock_actual_bmp(actual_bmp); | |
583 SkAutoLockPixels lock_expected_bmp(expected_bmp); | |
584 | |
585 DCHECK(gfx::SkIRectToRect(actual_bmp.bounds()).Contains(matching_mask)); | 582 DCHECK(gfx::SkIRectToRect(actual_bmp.bounds()).Contains(matching_mask)); |
586 | 583 |
587 for (int x = matching_mask.x(); x < matching_mask.right(); ++x) { | 584 for (int x = matching_mask.x(); x < matching_mask.right(); ++x) { |
588 for (int y = matching_mask.y(); y < matching_mask.bottom(); ++y) { | 585 for (int y = matching_mask.y(); y < matching_mask.bottom(); ++y) { |
589 SkColor actual_color = actual_bmp.getColor(x, y); | 586 SkColor actual_color = actual_bmp.getColor(x, y); |
590 SkColor expected_color = expected_bmp.getColor(x, y); | 587 SkColor expected_color = expected_bmp.getColor(x, y); |
591 if (!ColorsMatchWithinLimit(actual_color, expected_color, error_limit)) { | 588 if (!ColorsMatchWithinLimit(actual_color, expected_color, error_limit)) { |
592 if (error_pixels_count < 10) { | 589 if (error_pixels_count < 10) { |
593 LOG(ERROR) << "Pixel (" << x << "," << y << "): expected " | 590 LOG(ERROR) << "Pixel (" << x << "," << y << "): expected " |
594 << expected_color << " actual " << actual_color; | 591 << expected_color << " actual " << actual_color; |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 EXPECT_EQ("polyglottal", value); | 1800 EXPECT_EQ("polyglottal", value); |
1804 found++; | 1801 found++; |
1805 } else { | 1802 } else { |
1806 FAIL(); | 1803 FAIL(); |
1807 } | 1804 } |
1808 } | 1805 } |
1809 EXPECT_EQ(2u, found); | 1806 EXPECT_EQ(2u, found); |
1810 } | 1807 } |
1811 | 1808 |
1812 } // namespace content | 1809 } // namespace content |
OLD | NEW |