From 9284ccd8bc4e3dfed83485d9fa94ebd69c4b9741 Mon Sep 17 00:00:00 2001 From: "epoger@google.com" Date: Wed, 18 Apr 2012 13:36:54 +0000 Subject: Make gm tool able to read and write image files in the same run BUG=http://code.google.com/p/skia/issues/detail?id=571 Review URL: https://codereview.appspot.com/6052050 git-svn-id: http://skia.googlecode.com/svn/trunk@3717 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gm/gmmain.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'gm') diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp index 31e807491c..7d47bbe26d 100644 --- a/gm/gmmain.cpp +++ b/gm/gmmain.cpp @@ -462,23 +462,25 @@ static ErrorBitfield handle_test_results(GM* gm, SkDynamicMemoryWStream* pdf, const SkBitmap* comparisonBitmap) { SkString name = make_name(gm->shortName(), gRec.fName); + ErrorBitfield retval = ERROR_NONE; - if (writePath) { - return write_reference_image(gRec, writePath, renderModeDescriptor, - name, bitmap, pdf); - } else if (readPath && ( + if (readPath && ( gRec.fBackend == kRaster_Backend || gRec.fBackend == kGPU_Backend || (gRec.fBackend == kPDF_Backend && CAN_IMAGE_PDF))) { - return compare_to_reference_image(readPath, name, bitmap, - diffPath, renderModeDescriptor); - } else if (comparisonBitmap) { - return compare_to_reference_image(name, bitmap, - *comparisonBitmap, diffPath, - renderModeDescriptor); - } else { - return ERROR_NONE; + retval |= compare_to_reference_image(readPath, name, bitmap, + diffPath, renderModeDescriptor); } + if (writePath) { + retval |= write_reference_image(gRec, writePath, renderModeDescriptor, + name, bitmap, pdf); + } + if (comparisonBitmap) { + retval |= compare_to_reference_image(name, bitmap, + *comparisonBitmap, diffPath, + renderModeDescriptor); + } + return retval; } static SkPicture* generate_new_picture(GM* gm) { @@ -816,7 +818,8 @@ int main(int argc, char * const argv[]) { if (readPath) { fprintf(stderr, "reading from %s\n", readPath); - } else if (writePath) { + } + if (writePath) { fprintf(stderr, "writing to %s\n", writePath); } -- cgit v1.2.3