33 "contain exactly the same bits",
34 "contain the same pixel values, but not the same bits",
35 "have identical dimensions but some differing pixels",
36 "have differing dimensions",
37 "could not be compared",
72 "could not be decoded",
99 if (!strcmp(selector,
"any")) {
100 for (
int statusIndex = 0; statusIndex <
kStatusCount; ++statusIndex) {
101 statuses[statusIndex] =
true;
106 for (
int statusIndex = 0; statusIndex <
kStatusCount; ++statusIndex) {
107 statuses[statusIndex] =
false;
110 static const char kDelimiterChar =
',';
111 bool understood =
true;
113 char* delimiterPtr = strchr(selector, kDelimiterChar);
116 *delimiterPtr =
'\0';
119 if (!strcmp(selector,
"failed")) {
120 for (
int statusIndex = 0; statusIndex <
kStatusCount; ++statusIndex) {
129 statuses[status] =
true;
137 *delimiterPtr = kDelimiterChar;
138 selector = delimiterPtr + 1;
159 const int w =
dr->fComparison.fBitmap.width();
160 const int h =
dr->fComparison.fBitmap.height();
161 if (
w !=
dr->fBase.fBitmap.width() ||
h !=
dr->fBase.fBitmap.height()) {
166 int mismatchedPixels = 0;
167 int totalMismatchA = 0;
168 int totalMismatchR = 0;
169 int totalMismatchG = 0;
170 int totalMismatchB = 0;
174 dr->fWeightedFraction = 0;
175 for (
int y = 0;
y <
h;
y++) {
176 for (
int x = 0;
x <
w;
x++) {
179 SkPMColor outputDifference = diffFunction(c0, c1);
184 totalMismatchA += thisA;
185 totalMismatchR += thisR;
186 totalMismatchG += thisG;
187 totalMismatchB += thisB;
191 if (thisA >
dr->fMaxMismatchA) {
192 dr->fMaxMismatchA = thisA;
194 if (thisR >
dr->fMaxMismatchR) {
195 dr->fMaxMismatchR = thisR;
197 if (thisG >
dr->fMaxMismatchG) {
198 dr->fMaxMismatchG = thisG;
200 if (thisB >
dr->fMaxMismatchB) {
201 dr->fMaxMismatchB = thisB;
205 *
dr->fDifference.fBitmap.getAddr32(
x,
y) = outputDifference;
208 *
dr->fDifference.fBitmap.getAddr32(
x,
y) = 0;
213 if (0 == mismatchedPixels) {
218 int pixelCount =
w *
h;
219 dr->fFractionDifference = ((
float) mismatchedPixels) / pixelCount;
220 dr->fWeightedFraction /= pixelCount;
221 dr->fTotalMismatchA = totalMismatchA;
222 dr->fAverageMismatchA = ((
float) totalMismatchA) / pixelCount;
223 dr->fAverageMismatchR = ((
float) totalMismatchR) / pixelCount;
224 dr->fAverageMismatchG = ((
float) totalMismatchG) / pixelCount;
225 dr->fAverageMismatchB = ((
float) totalMismatchB) / pixelCount;
#define SkGetPackedB32(packed)
#define SkGetPackedR32(packed)
#define SkGetPackedA32(packed)
#define SkGetPackedG32(packed)
SK_API SkPMColor SkPreMultiplyColor(SkColor c)
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorWHITE
static int32_t SkAbs32(int32_t value)
DEF_SWITCHES_START aot vmservice shared library name
static char const *const ResultDescriptions[DiffRecord::kResultCount]
static bool colors_match_thresholded(SkPMColor c0, SkPMColor c1, const int threshold)
const SkPMColor PMCOLOR_BLACK
void compute_diff(DiffRecord *dr, DiffMetricProc diffFunction, const int colorThreshold)
static char const *const StatusDescriptions[DiffResource::kStatusCount]
const SkPMColor PMCOLOR_WHITE
SkPMColor(* DiffMetricProc)(SkPMColor, SkPMColor)
Parameterized routine to compute the color of a pixel in a difference image.
static char const *const ResultNames[DiffRecord::kResultCount]
static Result getResultByName(const char *name)
@ kDifferentPixels_Result
static const char * getResultDescription(Result result)
static char const *const StatusNames[DiffResource::kStatusCount]
static Status getStatusByName(const char *name)
static const char * getStatusDescription(Status status)
static bool isStatusFailed(Status status)
static bool getMatchingStatuses(char *selector, bool statuses[kStatusCount])