aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/sk_tool_utils.h
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-08-08 15:48:54 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-08 20:07:32 +0000
commit5a625e08f05157c1519012d8d04942c8f7606ba8 (patch)
treecbfd3ca8e12424507bf8d2a99023efd4fed2872c /tools/sk_tool_utils.h
parent50d0d053576a4895bdd4c837bf990b499da209cb (diff)
add tool_util to compare images
Bug: skia: Change-Id: I826190aa15cf42a3ca7f3c7d5271ead5b514c116 Reviewed-on: https://skia-review.googlesource.com/32220 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'tools/sk_tool_utils.h')
-rw-r--r--tools/sk_tool_utils.h11
1 files changed, 11 insertions, 0 deletions
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<SkTypeface> create_font(const char* name, SkFontStyle);