From 5a625e08f05157c1519012d8d04942c8f7606ba8 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Tue, 8 Aug 2017 15:48:54 -0400 Subject: add tool_util to compare images Bug: skia: Change-Id: I826190aa15cf42a3ca7f3c7d5271ead5b514c116 Reviewed-on: https://skia-review.googlesource.com/32220 Reviewed-by: Florin Malita Commit-Queue: Mike Reed --- tools/sk_tool_utils.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tools/sk_tool_utils.h') diff --git a/tools/sk_tool_utils.h b/tools/sk_tool_utils.h index ea06c119e7..dc8c8c10a0 100644 --- a/tools/sk_tool_utils.h +++ b/tools/sk_tool_utils.h @@ -91,6 +91,17 @@ namespace sk_tool_utils { */ void write_pixels(SkCanvas*, const SkBitmap&, int x, int y, SkColorType, SkAlphaType); + /** + * Returns true iff all of the pixels between the two images differ by <= the maxDiff value + * per component. + * + * If the configs differ, return false. + * + * If the colorType is half-float, then maxDiff is interpreted as 0..255 --> 0..1 + */ + bool equal_pixels(const SkPixmap&, const SkPixmap&, unsigned maxDiff = 0); + bool equal_pixels(const SkBitmap&, const SkBitmap&, unsigned maxDiff = 0); + // private to sk_tool_utils sk_sp create_font(const char* name, SkFontStyle); -- cgit v1.2.3