29 const int colorThreshold,
33 stream->writeText(
"<table>\n");
34 stream->writeText(
"<tr><th>");
35 stream->writeText(
"select image</th>\n<th>");
36 stream->writeDecAsText(matchCount);
37 stream->writeText(
" of ");
38 stream->writeDecAsText(differences.
size());
39 stream->writeText(
" diffs matched ");
40 if (colorThreshold == 0) {
41 stream->writeText(
"exactly");
43 stream->writeText(
"within ");
44 stream->writeDecAsText(colorThreshold);
45 stream->writeText(
" color units per component");
47 stream->writeText(
".<br>");
48 stream->writeText(
"</th>\n<th>");
49 stream->writeText(
"every different pixel shown in white");
50 stream->writeText(
"</th>\n<th>");
51 stream->writeText(
"color difference at each pixel");
52 stream->writeText(
"</th>\n<th>baseDir: ");
53 stream->writeText(baseDir.
c_str());
54 stream->writeText(
"</th>\n<th>comparisonDir: ");
55 stream->writeText(comparisonDir.
c_str());
56 stream->writeText(
"</th>\n");
57 stream->writeText(
"</tr>\n");
61 stream->writeText(
"<br>(");
65 stream->writeText(
" pixels)");
75 stream->writeText(
"<td><input type=\"checkbox\" name=\"");
77 stream->writeText(
"\" checked=\"yes\"></td>");
83 stream->writeText(
"<td><b>");
85 stream->writeText(
"</b><br>");
88 SkDEBUGFAIL(
"should not encounter DiffRecord with kEqualBits here");
91 SkDEBUGFAIL(
"should not encounter DiffRecord with kEqualPixels here");
94 stream->writeText(
"Image sizes differ</td>");
98 stream->writeText(metricBuf);
99 stream->writeText(
" of pixels differ");
100 stream->writeText(
"\n (");
102 stream->writeText(metricBuf);
103 stream->writeText(
" weighted)");
108 stream->writeText(
"<br>");
110 stream->writeText(
"<br>Average alpha channel mismatch ");
114 stream->writeText(
"<br>Max alpha channel mismatch ");
117 stream->writeText(
"<br>Total alpha channel mismatch ");
120 stream->writeText(
"<br>");
121 stream->writeText(
"<br>Average color mismatch ");
125 stream->writeText(
"<br>Max color mismatch ");
129 stream->writeText(
"</td>");
132 stream->writeText(
"Could not compare.<br>base: ");
134 stream->writeText(
"<br>comparison: ");
136 stream->writeText(
"</td>");
139 SkDEBUGFAIL(
"encountered DiffRecord with unknown result type");
145 stream->writeText(
"<td><a href=\"");
146 stream->writeText(path.c_str());
147 stream->writeText(
"\"><img src=\"");
148 stream->writeText(path.c_str());
149 stream->writeText(
"\" height=\"");
150 stream->writeDecAsText(
height);
151 stream->writeText(
"px\"></a></td>");
155 stream->writeText(
"<td><a href=\"");
156 stream->writeText(path.c_str());
157 stream->writeText(
"\">");
158 stream->writeText(
text);
159 stream->writeText(
"</a></td>");
163 const SkString& relativePath,
bool local) {
173 fullPath.
prepend(relativePath);
179 stream->writeText(
"<td>N/A</td>");
189 fullPath.
prepend(relativePath);
195 stream->writeText(
"<tr>\n");
202 stream->writeText(
"</tr>\n");
207 const int colorThreshold,
218 outputPath.
append(
"index.html");
225 bool isPathAbsolute =
false;
228 isPathAbsolute =
true;
230#ifdef SK_BUILD_FOR_WIN
233 if (outputDir.
size() > 1 &&
':' == outputDir[1]) {
234 isPathAbsolute =
true;
239 if (!isPathAbsolute) {
250 "<script type=\"text/javascript\">\n"
251 "function generateCheckedList() {\n"
252 " const boxes = document.querySelectorAll('input[type=checkbox]:checked');\n"
253 " let fileCmdLineString = '';\n"
254 " let fileMultiLineString = '';\n"
255 " for (let i = 0; i < boxes.length; i++) {\n"
256 " fileMultiLineString += boxes[i].name + '<br>';\n"
257 " fileCmdLineString += boxes[i].name + ' ';\n"
259 " const checkedList = document.querySelector('#checkedList');\n"
260 " checkedList.innerHTML = fileCmdLineString + '<br><br>' + fileMultiLineString;\n"
262 "</script>\n</head>\n<body>\n");
264 baseDir, comparisonDir);
266 for (i = 0; i < differences.
size(); i++) {
281 SkDEBUGFAIL(
"encountered DiffRecord with unknown result type");
287 "<input type=\"button\" "
288 "onclick=\"generateCheckedList()\" "
289 "value=\"Create Rebaseline List\">\n"
290 "<div id=\"checkedList\"></div>\n"
291 "</body>\n</html>\n");
292 outputStream.
flush();
#define SkDEBUGFAIL(message)
#define SkScalarRoundToInt(x)
bool startsWith(const char prefixStr[]) const
void append(const char text[])
void prepend(const char text[])
const char * c_str() const
bool writeText(const char text[])
void print_diff_page(const int matchCount, const int colorThreshold, const RecordArray &differences, const SkString &baseDir, const SkString &comparisonDir, const SkString &outputDir)
static void print_link_cell(SkFILEWStream *stream, const SkString &path, const char *text)
static void print_pixel_count(SkFILEWStream *stream, const DiffRecord &diff)
static void print_label_cell(SkFILEWStream *stream, const DiffRecord &diff)
static void print_diff_row(SkFILEWStream *stream, const DiffRecord &diff, const SkString &relativePath)
static void print_table_header(SkFILEWStream *stream, const int matchCount, const int colorThreshold, const RecordArray &differences, const SkString &baseDir, const SkString &comparisonDir)
static void print_image_cell(SkFILEWStream *stream, const SkString &path, int height)
static int compute_image_height(int height, int width)
static void print_diff_resource_cell(SkFILEWStream *stream, const DiffResource &resource, const SkString &relativePath, bool local)
static void print_checkbox_cell(SkFILEWStream *stream, const DiffRecord &diff)
Result fResult
Which category of diff result.
@ kCouldNotCompare_Result
@ kDifferentPixels_Result
float fFractionDifference
static const char * getStatusDescription(Status status)