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 SkDifferentPixelsMetric_DEFINED | 8 #ifndef SkDifferentPixelsMetric_DEFINED |
9 #define SkDifferentPixelsMetric_DEFINED | 9 #define SkDifferentPixelsMetric_DEFINED |
10 | 10 |
11 #include "SkTDArray.h" | 11 #include "SkTDArray.h" |
12 | 12 |
13 #if SK_SUPPORT_OPENCL | 13 #if SK_SUPPORT_OPENCL |
14 #include "SkCLImageDiffer.h" | 14 #include "SkCLImageDiffer.h" |
15 #else | 15 #else |
16 #include "SkImageDiffer.h" | 16 #include "SkImageDiffer.h" |
17 #endif | 17 #endif |
18 | 18 |
19 /** | 19 /** |
20 * A differ that measures the percentage of different corresponding pixels. If t
he two images are | 20 * A differ that measures the percentage of different corresponding pixels. If t
he two images are |
21 * not the same size or have no pixels, the result will always be zero. | 21 * not the same size or have no pixels, the result will always be zero. |
22 */ | 22 */ |
23 class SkDifferentPixelsMetric : | 23 class SkDifferentPixelsMetric : |
24 #if SK_SUPPORT_OPENCL | 24 #if SK_SUPPORT_OPENCL |
25 public SkCLImageDiffer { | 25 public SkCLImageDiffer { |
26 #else | 26 #else |
27 public SkImageDiffer { | 27 public SkImageDiffer { |
28 #endif | 28 #endif |
29 public: | 29 public: |
| 30 SkDifferentPixelsMetric() : fPOIAlphaMask(false) {} |
| 31 |
30 virtual const char* getName() SK_OVERRIDE; | 32 virtual const char* getName() SK_OVERRIDE; |
| 33 virtual bool enablePOIAlphaMask() SK_OVERRIDE; |
31 virtual int queueDiff(SkBitmap* baseline, SkBitmap* test) SK_OVERRIDE; | 34 virtual int queueDiff(SkBitmap* baseline, SkBitmap* test) SK_OVERRIDE; |
32 virtual void deleteDiff(int id) SK_OVERRIDE; | 35 virtual void deleteDiff(int id) SK_OVERRIDE; |
33 virtual bool isFinished(int id) SK_OVERRIDE; | 36 virtual bool isFinished(int id) SK_OVERRIDE; |
34 virtual double getResult(int id) SK_OVERRIDE; | 37 virtual double getResult(int id) SK_OVERRIDE; |
35 virtual int getPointsOfInterestCount(int id) SK_OVERRIDE; | 38 virtual int getPointsOfInterestCount(int id) SK_OVERRIDE; |
36 virtual SkIPoint* getPointsOfInterest(int id) SK_OVERRIDE; | 39 virtual SkIPoint* getPointsOfInterest(int id) SK_OVERRIDE; |
| 40 virtual SkBitmap* getPointsOfInterestAlphaMask(int id) SK_OVERRIDE; |
37 | 41 |
38 protected: | 42 protected: |
39 #if SK_SUPPORT_OPENCL | 43 #if SK_SUPPORT_OPENCL |
40 virtual bool onInit() SK_OVERRIDE; | 44 virtual bool onInit() SK_OVERRIDE; |
41 #endif | 45 #endif |
42 | 46 |
43 private: | 47 private: |
| 48 bool fPOIAlphaMask; |
| 49 |
44 struct QueuedDiff; | 50 struct QueuedDiff; |
45 | |
46 SkTDArray<QueuedDiff> fQueuedDiffs; | 51 SkTDArray<QueuedDiff> fQueuedDiffs; |
47 | 52 |
48 #if SK_SUPPORT_OPENCL | 53 #if SK_SUPPORT_OPENCL |
49 cl_kernel fKernel; | 54 cl_kernel fKernel; |
50 | 55 |
51 typedef SkCLImageDiffer INHERITED; | 56 typedef SkCLImageDiffer INHERITED; |
52 #else | 57 #else |
53 typedef SkImageDiffer INHERITED; | 58 typedef SkImageDiffer INHERITED; |
54 #endif | 59 #endif |
55 }; | 60 }; |
56 | 61 |
57 #endif | 62 #endif |
OLD | NEW |