Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
DiffSummary Struct Reference

Public Member Functions

 DiffSummary ()
 
void printContents (const FileArray &fileArray, const char *baseStatus, const char *comparisonStatus, bool listFilenames)
 
void printStatus (bool listFilenames, bool failOnStatusType[DiffResource::kStatusCount][DiffResource::kStatusCount])
 
void printContents (const FileArray &fileArray, const char *headerText, bool listFilenames)
 
void print (bool listFilenames, bool failOnResultType[DiffRecord::kResultCount], bool failOnStatusType[DiffResource::kStatusCount][DiffResource::kStatusCount])
 
void printfFailingBaseNames (const char separator[])
 
void add (const DiffRecord &drp)
 

Public Attributes

uint32_t fNumMatches
 
uint32_t fNumMismatches
 
uint32_t fMaxMismatchV
 
float fMaxMismatchPercent
 
FileArray fResultsOfType [DiffRecord::kResultCount]
 
FileArray fStatusOfType [DiffResource::kStatusCount][DiffResource::kStatusCount]
 
StringArray fFailedBaseNames [DiffRecord::kResultCount]
 

Detailed Description

Definition at line 64 of file skdiff_main.cpp.

Constructor & Destructor Documentation

◆ DiffSummary()

DiffSummary::DiffSummary ( )
inline

Definition at line 65 of file skdiff_main.cpp.

66 : fNumMatches(0)
68 , fMaxMismatchV(0)
69 , fMaxMismatchPercent(0) { }
uint32_t fNumMatches
Definition: skdiff_main.cpp:71
float fMaxMismatchPercent
Definition: skdiff_main.cpp:74
uint32_t fNumMismatches
Definition: skdiff_main.cpp:72
uint32_t fMaxMismatchV
Definition: skdiff_main.cpp:73

Member Function Documentation

◆ add()

void DiffSummary::add ( const DiffRecord drp)
inline

Definition at line 172 of file skdiff_main.cpp.

172 {
173 uint32_t mismatchValue;
174
177 } else {
178 SkString blame("(");
179 blame.append(drp.fBase.fFilename);
180 blame.append(", ");
181 blame.append(drp.fComparison.fFilename);
182 blame.append(")");
183 fResultsOfType[drp.fResult].push_back(std::move(blame));
184 }
185 switch (drp.fResult) {
187 fNumMatches++;
188 break;
190 fNumMatches++;
191 break;
194 break;
199 }
200 mismatchValue = MAX3(drp.fMaxMismatchR, drp.fMaxMismatchG,
201 drp.fMaxMismatchB);
202 if (mismatchValue > fMaxMismatchV) {
203 fMaxMismatchV = mismatchValue;
204 }
205 break;
209 drp.fBase.fFilename);
210 break;
212 SkDEBUGFAIL("adding uncategorized DiffRecord");
213 break;
214 default:
215 SkDEBUGFAIL("adding DiffRecord with unhandled fResult value");
216 break;
217 }
218
219 switch (drp.fResult) {
222 break;
223 default:
225 break;
226 }
227 }
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118
bool equals(const SkString &) const
Definition: SkString.cpp:324
#define MAX3(a, b, c)
Definition: skdiff.h:26
static void add_unique_basename(StringArray *array, const SkString &filename)
Definition: skdiff_main.cpp:40
DiffResource fComparison
Definition: skdiff.h:131
Result fResult
Which category of diff result.
Definition: skdiff.h:154
@ kUnknown_Result
Definition: skdiff.h:97
@ kEqualBits_Result
Definition: skdiff.h:92
@ kCouldNotCompare_Result
Definition: skdiff.h:96
@ kDifferentSizes_Result
Definition: skdiff.h:95
@ kDifferentPixels_Result
Definition: skdiff.h:94
@ kEqualPixels_Result
Definition: skdiff.h:93
DiffResource fBase
Definition: skdiff.h:130
uint32_t fMaxMismatchB
Definition: skdiff.h:151
uint32_t fMaxMismatchR
Definition: skdiff.h:149
float fFractionDifference
Definition: skdiff.h:138
uint32_t fMaxMismatchG
Definition: skdiff.h:150
Status fStatus
Definition: skdiff.h:84
SkString fFilename
Definition: skdiff.h:79
FileArray fStatusOfType[DiffResource::kStatusCount][DiffResource::kStatusCount]
Definition: skdiff_main.cpp:77
StringArray fFailedBaseNames[DiffRecord::kResultCount]
Definition: skdiff_main.cpp:79
FileArray fResultsOfType[DiffRecord::kResultCount]
Definition: skdiff_main.cpp:76

◆ print()

void DiffSummary::print ( bool  listFilenames,
bool  failOnResultType[DiffRecord::kResultCount],
bool  failOnStatusType[DiffResource::kStatusCount][DiffResource::kStatusCount] 
)
inline

Definition at line 134 of file skdiff_main.cpp.

136 {
137 printf("\ncompared %u file pairs:\n", fNumMatches + fNumMismatches);
138 for (int resultInt = 0; resultInt < DiffRecord::kResultCount; ++resultInt) {
139 DiffRecord::Result result = static_cast<DiffRecord::Result>(resultInt);
140 if (failOnResultType[result]) {
141 printf("[*] ");
142 } else {
143 printf("[_] ");
144 }
146 listFilenames);
148 printStatus(listFilenames, failOnStatusType);
149 }
150 }
151 printf("(results marked with [*] will cause nonzero return value)\n");
152 printf("\nnumber of mismatching file pairs: %u\n", fNumMismatches);
153 if (fNumMismatches > 0) {
154 printf("Maximum pixel intensity mismatch %u\n", fMaxMismatchV);
155 printf("Largest area mismatch was %.2f%% of pixels\n",fMaxMismatchPercent);
156 }
157 }
GAsyncResult * result
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: SkSLString.cpp:83
@ kResultCount
Definition: skdiff.h:99
static const char * getResultDescription(Result result)
Definition: skdiff.cpp:41
void printStatus(bool listFilenames, bool failOnStatusType[DiffResource::kStatusCount][DiffResource::kStatusCount])
Definition: skdiff_main.cpp:96
void printContents(const FileArray &fileArray, const char *baseStatus, const char *comparisonStatus, bool listFilenames)
Definition: skdiff_main.cpp:81

◆ printContents() [1/2]

void DiffSummary::printContents ( const FileArray fileArray,
const char *  baseStatus,
const char *  comparisonStatus,
bool  listFilenames 
)
inline

Definition at line 81 of file skdiff_main.cpp.

83 {
84 int n = fileArray.size();
85 printf("%d file pairs %s in baseDir and %s in comparisonDir",
86 n, baseStatus, comparisonStatus);
87 if (listFilenames) {
88 printf(": ");
89 for (int i = 0; i < n; ++i) {
90 printf("%s ", fileArray[i].c_str());
91 }
92 }
93 printf("\n");
94 }
int size() const
Definition: SkTArray.h:421

◆ printContents() [2/2]

void DiffSummary::printContents ( const FileArray fileArray,
const char *  headerText,
bool  listFilenames 
)
inline

Definition at line 122 of file skdiff_main.cpp.

122 {
123 int n = fileArray.size();
124 printf("%d file pairs %s", n, headerText);
125 if (listFilenames) {
126 printf(": ");
127 for (int i = 0; i < n; ++i) {
128 printf("%s ", fileArray[i].c_str());
129 }
130 }
131 printf("\n");
132 }

◆ printfFailingBaseNames()

void DiffSummary::printfFailingBaseNames ( const char  separator[])
inline

Definition at line 159 of file skdiff_main.cpp.

159 {
160 for (int resultInt = 0; resultInt < DiffRecord::kResultCount; ++resultInt) {
161 const StringArray& array = fFailedBaseNames[resultInt];
162 if (array.size()) {
163 printf("%s [%d]%s", DiffRecord::ResultNames[resultInt], array.size(), separator);
164 for (int j = 0; j < array.size(); ++j) {
165 printf("%s%s", array[j].c_str(), separator);
166 }
167 printf("\n");
168 }
169 }
170 }
static char const *const ResultNames[DiffRecord::kResultCount]
Definition: skdiff.h:101

◆ printStatus()

void DiffSummary::printStatus ( bool  listFilenames,
bool  failOnStatusType[DiffResource::kStatusCount][DiffResource::kStatusCount] 
)
inline

Definition at line 96 of file skdiff_main.cpp.

98 {
100
101 for (int base = 0; base < DiffResource::kStatusCount; ++base) {
102 Status baseStatus = static_cast<Status>(base);
103 for (int comparison = 0; comparison < DiffResource::kStatusCount; ++comparison) {
104 Status comparisonStatus = static_cast<Status>(comparison);
105 const FileArray& fileArray = fStatusOfType[base][comparison];
106 if (fileArray.size() > 0) {
107 if (failOnStatusType[base][comparison]) {
108 printf(" [*] ");
109 } else {
110 printf(" [_] ");
111 }
112 printContents(fileArray,
114 DiffResource::getStatusDescription(comparisonStatus),
115 listFilenames);
116 }
117 }
118 }
119 }
Task::Status Status
Definition: TaskList.cpp:15
static const char * getStatusDescription(Status status)
Definition: skdiff.cpp:86
@ kStatusCount
Definition: skdiff.h:55

Member Data Documentation

◆ fFailedBaseNames

StringArray DiffSummary::fFailedBaseNames[DiffRecord::kResultCount]

Definition at line 79 of file skdiff_main.cpp.

◆ fMaxMismatchPercent

float DiffSummary::fMaxMismatchPercent

Definition at line 74 of file skdiff_main.cpp.

◆ fMaxMismatchV

uint32_t DiffSummary::fMaxMismatchV

Definition at line 73 of file skdiff_main.cpp.

◆ fNumMatches

uint32_t DiffSummary::fNumMatches

Definition at line 71 of file skdiff_main.cpp.

◆ fNumMismatches

uint32_t DiffSummary::fNumMismatches

Definition at line 72 of file skdiff_main.cpp.

◆ fResultsOfType

FileArray DiffSummary::fResultsOfType[DiffRecord::kResultCount]

Definition at line 76 of file skdiff_main.cpp.

◆ fStatusOfType

Definition at line 77 of file skdiff_main.cpp.


The documentation for this struct was generated from the following file: