OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkPMetric_DEFINED | 8 #ifndef SkPMetric_DEFINED |
9 #define SkPMetric_DEFINED | 9 #define SkPMetric_DEFINED |
10 | 10 |
11 #include "SkTArray.h" | 11 #include "SkTArray.h" |
12 #include "SkTDArray.h" | 12 #include "SkTDArray.h" |
13 | 13 |
14 #include "SkImageDiffer.h" | 14 #include "SkImageDiffer.h" |
15 | 15 |
16 /** | 16 /** |
17 * An image differ that uses the pdiff image metric to compare images. | 17 * An image differ that uses the pdiff image metric to compare images. |
18 */ | 18 */ |
19 class SkPMetric : public SkImageDiffer { | 19 class SkPMetric : public SkImageDiffer { |
20 public: | 20 public: |
21 virtual const char* getName() SK_OVERRIDE; | 21 virtual const char* getName() const SK_OVERRIDE { return "perceptual"; } |
22 virtual int queueDiff(SkBitmap* baseline, SkBitmap* test) SK_OVERRIDE; | 22 virtual bool diff(SkBitmap* baseline, SkBitmap* test, bool computeMask, |
23 virtual void deleteDiff(int id) SK_OVERRIDE; | 23 Result* result) const SK_OVERRIDE; |
24 virtual bool isFinished(int id) SK_OVERRIDE; | |
25 virtual double getResult(int id) SK_OVERRIDE; | |
26 virtual int getPointsOfInterestCount(int id) SK_OVERRIDE; | |
27 virtual SkIPoint* getPointsOfInterest(int id) SK_OVERRIDE; | |
28 | 24 |
29 private: | 25 private: |
30 struct QueuedDiff { | |
31 bool finished; | |
32 double result; | |
33 SkTDArray<SkIPoint> poi; | |
34 }; | |
35 | |
36 SkTArray<QueuedDiff> fQueuedDiffs; | |
37 | |
38 typedef SkImageDiffer INHERITED; | 26 typedef SkImageDiffer INHERITED; |
39 }; | 27 }; |
40 | 28 |
41 | 29 |
42 #endif | 30 #endif |
OLD | NEW |