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