If skdiff encounters image size mismatch, do not display diff images

Currently, if skdiff encounters images whose expected and actual dimensions do not match, it will attempt (incorrectly) to display diffs.  Better to not display the diffs at all than to display misleading diffs...
Review URL: https://codereview.appspot.com/6015049

git-svn-id: http://skia.googlecode.com/svn/trunk@3662 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
epoger@google.com 2012-04-12 16:32:04 +00:00
Родитель a707f60874
Коммит 01f78702f1
1 изменённых файлов: 19 добавлений и 4 удалений

Просмотреть файл

@ -809,6 +809,14 @@ static void print_image_cell (SkFILEWStream* stream,
stream->writeText("px\"></a></td>"); stream->writeText("px\"></a></td>");
} }
static void print_text_cell (SkFILEWStream* stream, const char* text) {
stream->writeText("<td align=center>");
if (NULL != text) {
stream->writeText(text);
}
stream->writeText("</td>");
}
static void print_diff_with_missing_file(SkFILEWStream* stream, static void print_diff_with_missing_file(SkFILEWStream* stream,
DiffRecord& diff, DiffRecord& diff,
const SkString& relativePath) { const SkString& relativePath) {
@ -894,10 +902,17 @@ static void print_diff_page (const int matchCount,
int height = compute_image_height(diff->fBaseHeight, diff->fBaseWidth); int height = compute_image_height(diff->fBaseHeight, diff->fBaseWidth);
outputStream.writeText("<tr>\n"); outputStream.writeText("<tr>\n");
print_label_cell(&outputStream, *diff); print_label_cell(&outputStream, *diff);
print_image_cell(&outputStream, if (diff->fDoImageSizesMismatch) {
filename_to_white_filename(diff->fFilename), height); print_text_cell(&outputStream,
print_image_cell(&outputStream, "[image size mismatch, so no diff to display]");
filename_to_diff_filename(diff->fFilename), height); print_text_cell(&outputStream,
"[image size mismatch, so no diff to display]");
} else {
print_image_cell(&outputStream,
filename_to_white_filename(diff->fFilename), height);
print_image_cell(&outputStream,
filename_to_diff_filename(diff->fFilename), height);
}
print_image_cell(&outputStream, diff->fBasePath, height); print_image_cell(&outputStream, diff->fBasePath, height);
print_image_cell(&outputStream, diff->fComparisonPath, height); print_image_cell(&outputStream, diff->fComparisonPath, height);
outputStream.writeText("</tr>\n"); outputStream.writeText("</tr>\n");