diff options
author | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-28 15:41:32 +0000 |
---|---|---|
committer | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-28 15:41:32 +0000 |
commit | 565254bc9343d0befdfbbb97a3dc6d44c6e18658 (patch) | |
tree | 4cad02846e3619d293810dfb4de652ecdb47f05c /gm | |
parent | dbc936dff3357f74fc60e124d912a2179b909b0d (diff) |
Fix SkGPipe drawing, and turn it on by default.
A recent change broke SkGPipe. Fix it, and turn on pipe drawing
in GM by default so we will catch these in the future.
We already had a bug where SkGPipeWriter had to use its Cross Process
flag to work, so for a quick fix, force the reader to use the Cross
Process flag as well. The bug to allow both cross and non cross process
is http://code.google.com/p/skia/issues/detail?id=663
Review URL: https://codereview.appspot.com/6333071
git-svn-id: http://skia.googlecode.com/svn/trunk@4384 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r-- | gm/gmmain.cpp | 87 |
1 files changed, 59 insertions, 28 deletions
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp index 8483dae245..e79831a0ff 100644 --- a/gm/gmmain.cpp +++ b/gm/gmmain.cpp @@ -620,6 +620,18 @@ static ErrorBitfield test_picture_serialization(GM* gm, } } +struct PipeFlagComboData { + const char* name; + uint32_t flags; +}; + +static PipeFlagComboData gPipeWritingFlagCombos[] = { + { "", 0 }, + { " cross-process", SkGPipeWriter::kCrossProcess_Flag }, + { " cross-process, shared adress", SkGPipeWriter::kCrossProcess_Flag + | SkGPipeWriter::kSharedAddressSpace_SkGPipeFlag } +}; + static ErrorBitfield test_pipe_playback(GM* gm, const ConfigData& gRec, const SkBitmap& comparisonBitmap, @@ -628,18 +640,27 @@ static ErrorBitfield test_pipe_playback(GM* gm, if (kRaster_Backend != gRec.fBackend) { return ERROR_NONE; } - SkBitmap bitmap; - SkISize size = gm->getISize(); - setup_bitmap(gRec, size, &bitmap); - SkCanvas canvas(bitmap); - PipeController pipeController(&canvas); - SkGPipeWriter writer; - SkCanvas* pipeCanvas = writer.startRecording(&pipeController, - SkGPipeWriter::kCrossProcess_Flag); - invokeGM(gm, pipeCanvas); - writer.endRecording(); - return handle_test_results(gm, gRec, NULL, NULL, diffPath, - "-pipe", bitmap, NULL, &comparisonBitmap); + ErrorBitfield errors = ERROR_NONE; + for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { + SkBitmap bitmap; + SkISize size = gm->getISize(); + setup_bitmap(gRec, size, &bitmap); + SkCanvas canvas(bitmap); + PipeController pipeController(&canvas); + SkGPipeWriter writer; + SkCanvas* pipeCanvas = writer.startRecording(&pipeController, + gPipeWritingFlagCombos[i].flags); + invokeGM(gm, pipeCanvas); + writer.endRecording(); + SkString string("-pipe"); + string.append(gPipeWritingFlagCombos[i].name); + errors |= handle_test_results(gm, gRec, NULL, NULL, diffPath, + string.c_str(), bitmap, NULL, &comparisonBitmap); + if (errors != ERROR_NONE) { + break; + } + } + return errors; } static ErrorBitfield test_tiled_pipe_playback(GM* gm, @@ -650,17 +671,27 @@ static ErrorBitfield test_tiled_pipe_playback(GM* gm, if (kRaster_Backend != gRec.fBackend) { return ERROR_NONE; } - SkBitmap bitmap; - SkISize size = gm->getISize(); - setup_bitmap(gRec, size, &bitmap); - TiledPipeController pipeController(bitmap); - SkGPipeWriter writer; - SkCanvas* pipeCanvas = writer.startRecording(&pipeController, - SkGPipeWriter::kCrossProcess_Flag); - invokeGM(gm, pipeCanvas); - writer.endRecording(); - return handle_test_results(gm, gRec, NULL, NULL, diffPath, - "-tiled pipe", bitmap, NULL, &comparisonBitmap); + ErrorBitfield errors = ERROR_NONE; + for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { + SkBitmap bitmap; + SkISize size = gm->getISize(); + setup_bitmap(gRec, size, &bitmap); + SkCanvas canvas(bitmap); + TiledPipeController pipeController(bitmap); + SkGPipeWriter writer; + SkCanvas* pipeCanvas = writer.startRecording(&pipeController, + gPipeWritingFlagCombos[i].flags); + invokeGM(gm, pipeCanvas); + writer.endRecording(); + SkString string("-pipe"); + string.append(gPipeWritingFlagCombos[i].name); + errors |= handle_test_results(gm, gRec, NULL, NULL, diffPath, + string.c_str(), bitmap, NULL, &comparisonBitmap); + if (errors != ERROR_NONE) { + break; + } + } + return errors; } static void write_picture_serialization(GM* gm, const ConfigData& rec, @@ -725,7 +756,7 @@ static void usage(const char * argv0) { SkDebugf(gRec[i].fName); } SkDebugf(" ]\n"); - SkDebugf(" [--noreplay] [--pipe] [--serialize] [--forceBWtext] [--nopdf] \n" + SkDebugf(" [--noreplay] [--nopipe] [--serialize] [--forceBWtext] [--nopdf] \n" " [--tiledPipe] \n" " [--nodeferred] [--match substring] [--notexturecache]\n" " [-h|--help]\n" @@ -737,7 +768,7 @@ static void usage(const char * argv0) { SkDebugf(" diffPath: directory to write difference images in.\n"); SkDebugf(" resourcePath: directory that stores image resources.\n"); SkDebugf(" --noreplay: do not exercise SkPicture replay.\n"); - SkDebugf(" --pipe: Exercise SkGPipe replay.\n"); + SkDebugf(" --nopipe: Skip SkGPipe replay.\n"); SkDebugf(" --tiledPipe: Exercise tiled SkGPipe replay.\n"); SkDebugf( " --serialize: exercise SkPicture serialization & deserialization.\n"); @@ -831,7 +862,7 @@ int main(int argc, char * const argv[]) { bool doPDF = true; bool doReplay = true; - bool doPipe = false; + bool doPipe = true; bool doTiledPipe = false; bool doSerialize = false; bool doDeferred = true; @@ -871,8 +902,8 @@ int main(int argc, char * const argv[]) { } } else if (strcmp(*argv, "--forceBWtext") == 0) { gForceBWtext = true; - } else if (strcmp(*argv, "--pipe") == 0) { - doPipe = true; + } else if (strcmp(*argv, "--nopipe") == 0) { + doPipe = false; } else if (strcmp(*argv, "--tiledPipe") == 0) { doTiledPipe = true; } else if (strcmp(*argv, "--noreplay") == 0) { |