blob: 5963c2f33ca48257a99ae572d844bd9fa1c6e117 [file] [log] [blame]
zachr@google.comc0a75a82013-06-28 15:34:56 +00001/*
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.com572b54d2013-06-28 16:27:33 +000011#include "SkTArray.h"
zachr@google.comc0a75a82013-06-28 15:34:56 +000012#include "SkTDArray.h"
13
14#include "SkImageDiffer.h"
15
16/**
17 * An image differ that uses the pdiff image metric to compare images.
18 */
19class SkPMetric : public SkImageDiffer {
20public:
21 virtual const char* getName() SK_OVERRIDE;
22 virtual int queueDiff(SkBitmap* baseline, SkBitmap* test) SK_OVERRIDE;
zachr@google.com572b54d2013-06-28 16:27:33 +000023 virtual void deleteDiff(int id) SK_OVERRIDE;
zachr@google.comc0a75a82013-06-28 15:34:56 +000024 virtual bool isFinished(int id) SK_OVERRIDE;
25 virtual double getResult(int id) SK_OVERRIDE;
zachr@google.com572b54d2013-06-28 16:27:33 +000026 virtual int getPointsOfInterestCount(int id) SK_OVERRIDE;
27 virtual SkIPoint* getPointsOfInterest(int id) SK_OVERRIDE;
zachr@google.comc0a75a82013-06-28 15:34:56 +000028
29private:
30 struct QueuedDiff {
31 bool finished;
32 double result;
zachr@google.com572b54d2013-06-28 16:27:33 +000033 SkTDArray<SkIPoint> poi;
zachr@google.comc0a75a82013-06-28 15:34:56 +000034 };
35
zachr@google.com572b54d2013-06-28 16:27:33 +000036 SkTArray<QueuedDiff> fQueuedDiffs;
zachr@google.comc0a75a82013-06-28 15:34:56 +000037
38 typedef SkImageDiffer INHERITED;
39};
40
41
42#endif