2013-07-17 19:29:19 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2013 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkDifferentPixelsMetric_DEFINED
|
|
|
|
#define SkDifferentPixelsMetric_DEFINED
|
|
|
|
|
|
|
|
#include "SkTDArray.h"
|
|
|
|
|
|
|
|
#if SK_SUPPORT_OPENCL
|
|
|
|
#include "SkCLImageDiffer.h"
|
|
|
|
#else
|
|
|
|
#include "SkImageDiffer.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A differ that measures the percentage of different corresponding pixels. If the two images are
|
|
|
|
* not the same size or have no pixels, the result will always be zero.
|
|
|
|
*/
|
|
|
|
class SkDifferentPixelsMetric :
|
|
|
|
#if SK_SUPPORT_OPENCL
|
|
|
|
public SkCLImageDiffer {
|
|
|
|
#else
|
|
|
|
public SkImageDiffer {
|
|
|
|
#endif
|
|
|
|
public:
|
2015-01-09 18:06:39 +00:00
|
|
|
const char* getName() const SK_OVERRIDE;
|
2014-07-02 14:43:04 +00:00
|
|
|
virtual bool diff(SkBitmap* baseline, SkBitmap* test,
|
|
|
|
const BitmapsToCreate& bitmapsToCreate,
|
2013-11-12 18:29:17 +00:00
|
|
|
Result* result) const SK_OVERRIDE;
|
2013-07-17 19:29:19 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
#if SK_SUPPORT_OPENCL
|
2015-01-09 18:06:39 +00:00
|
|
|
bool onInit() SK_OVERRIDE;
|
2013-07-17 19:29:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
private:
|
|
|
|
#if SK_SUPPORT_OPENCL
|
|
|
|
cl_kernel fKernel;
|
|
|
|
|
|
|
|
typedef SkCLImageDiffer INHERITED;
|
|
|
|
#else
|
|
|
|
typedef SkImageDiffer INHERITED;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|