OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TEST_UTILS_H_ | 5 #ifndef CC_TEST_PIXEL_TEST_UTILS_H_ |
6 #define CC_TEST_PIXEL_TEST_UTILS_H_ | 6 #define CC_TEST_PIXEL_TEST_UTILS_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "cc/test/pixel_comparator.h" | |
9 | 10 |
10 class SkBitmap; | 11 class SkBitmap; |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 | 14 |
14 // Encodes a bitmap into a PNG and write to disk. Returns true on success. The | 15 // Encodes a bitmap into a PNG and write to disk. Returns true on success. The |
15 // parent directory does not have to exist. | 16 // parent directory does not have to exist. |
16 bool WritePNGFile(const SkBitmap& bitmap, const base::FilePath& file_path); | 17 bool WritePNGFile(const SkBitmap& bitmap, const base::FilePath& file_path); |
17 | 18 |
18 // Reads and decodes a PNG image to a bitmap. Returns true on success. The PNG | 19 // Reads and decodes a PNG image to a bitmap. Returns true on success. The PNG |
19 // should have been encoded using |gfx::PNGCodec::Encode|. | 20 // should have been encoded using |gfx::PNGCodec::Encode|. |
20 bool ReadPNGFile(const base::FilePath& file_path, SkBitmap* bitmap); | 21 bool ReadPNGFile(const base::FilePath& file_path, SkBitmap* bitmap); |
21 | 22 |
22 // Compares with a PNG file on disk, and returns true if it is the same as | 23 // Compares with a PNG file on disk using the given ImageComparator, and returns |
reveman
2013/03/07 21:41:25
s/ImageComparator/PixelComparator/
ernstm
2013/03/08 00:14:46
Done.
| |
23 // the given image. |ref_img_path| is absolute. | 24 // true if the comparator returns a match. |ref_img_path| is absolute. |
24 bool IsSameAsPNGFile(const SkBitmap& gen_bmp, base::FilePath ref_img_path); | 25 bool MatchesPNGFile(const SkBitmap& gen_bmp, base::FilePath ref_img_path, |
26 const PixelComparator& comparator); | |
25 | 27 |
26 } // namespace cc | 28 } // namespace cc |
27 | 29 |
28 #endif // CC_TEST_PIXEL_TEST_UTILS_H_ | 30 #endif // CC_TEST_PIXEL_TEST_UTILS_H_ |
OLD | NEW |