Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / chromeos / login / screenshot_testing / SkImageDiffer.h
blob052c6fe87c227d03ac5f7b9ee1cbe524d9d97130
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // WARNING! This file is copied from third_party/skia/tools/skpdiff and slightly
6 // modified to be compilable outside Skia and suit chromium style. Some comments
7 // can make no sense.
8 // TODO(elizavetai): remove this file and reuse the original one in Skia
10 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKIMAGEDIFFER_H_
11 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKIMAGEDIFFER_H_
13 #include "base/logging.h"
14 #include "third_party/skia/include/core/SkBitmap.h"
16 /**
17 * Encapsulates an image difference metric algorithm that can be potentially run
18 * asynchronously.
20 class SkImageDiffer {
21 public:
22 SkImageDiffer();
23 virtual ~SkImageDiffer();
25 static const double RESULT_CORRECT;
26 static const double RESULT_INCORRECT;
28 struct Result {
29 double result;
30 int poiCount;
31 // TODO(djsollen): Figure out a way that the differ can report which of the
32 // optional fields it has filled in. See http://skbug.com/2712 ('allow
33 // skpdiff to report different sets of result fields for different
34 // comparison algorithms')
35 SkBitmap poiAlphaMask; // optional
36 SkBitmap rgbDiffBitmap; // optional
37 SkBitmap whiteDiffBitmap; // optional
38 int maxRedDiff; // optional
39 int maxGreenDiff; // optional
40 int maxBlueDiff; // optional
41 double timeElapsed; // optional
43 Result();
46 // A bitfield indicating which bitmap types we want a differ to create.
48 // TODO(epoger): Remove whiteDiffBitmap, because alphaMask can provide
49 // the same functionality and more.
50 // It will be a little bit tricky, because the rebaseline_server client
51 // and server side code will both need to change to use the alphaMask.
52 struct BitmapsToCreate {
53 bool alphaMask;
54 bool rgbDiff;
55 bool whiteDiff;
59 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKIMAGEDIFFER_H_