OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 /* | 8 /* |
9 * Code for the "gm" (Golden Master) rendering comparison tool. | 9 * Code for the "gm" (Golden Master) rendering comparison tool. |
10 * | 10 * |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
894 | 894 |
895 ErrorBitfield test_pipe_playback(GM* gm, | 895 ErrorBitfield test_pipe_playback(GM* gm, |
896 const ConfigData& gRec, | 896 const ConfigData& gRec, |
897 const SkBitmap& referenceBitmap) { | 897 const SkBitmap& referenceBitmap) { |
898 ErrorBitfield errors = kEmptyErrorBitfield; | 898 ErrorBitfield errors = kEmptyErrorBitfield; |
899 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { | 899 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { |
900 SkBitmap bitmap; | 900 SkBitmap bitmap; |
901 SkISize size = gm->getISize(); | 901 SkISize size = gm->getISize(); |
902 setup_bitmap(gRec, size, &bitmap); | 902 setup_bitmap(gRec, size, &bitmap); |
903 SkCanvas canvas(bitmap); | 903 SkCanvas canvas(bitmap); |
904 installFilter(&canvas); | |
epoger
2013/03/15 15:27:16
As discussed in https://codereview.chromium.org/12
| |
904 PipeController pipeController(&canvas); | 905 PipeController pipeController(&canvas); |
905 SkGPipeWriter writer; | 906 SkGPipeWriter writer; |
906 SkCanvas* pipeCanvas = writer.startRecording( | 907 SkCanvas* pipeCanvas = writer.startRecording( |
907 &pipeController, gPipeWritingFlagCombos[i].flags); | 908 &pipeController, gPipeWritingFlagCombos[i].flags); |
908 invokeGM(gm, pipeCanvas, false, false); | 909 invokeGM(gm, pipeCanvas, false, false); |
909 complete_bitmap(&bitmap); | 910 complete_bitmap(&bitmap); |
910 writer.endRecording(); | 911 writer.endRecording(); |
911 SkString string("-pipe"); | 912 SkString string("-pipe"); |
912 string.append(gPipeWritingFlagCombos[i].name); | 913 string.append(gPipeWritingFlagCombos[i].name); |
913 errors |= compare_test_results_to_reference_bitmap( | 914 errors |= compare_test_results_to_reference_bitmap( |
914 gm, gRec, string.c_str(), bitmap, &referenceBitmap); | 915 gm, gRec, string.c_str(), bitmap, &referenceBitmap); |
915 if (errors != kEmptyErrorBitfield) { | 916 if (errors != kEmptyErrorBitfield) { |
916 break; | 917 break; |
917 } | 918 } |
918 } | 919 } |
919 return errors; | 920 return errors; |
920 } | 921 } |
921 | 922 |
922 ErrorBitfield test_tiled_pipe_playback( | 923 ErrorBitfield test_tiled_pipe_playback( |
923 GM* gm, const ConfigData& gRec, const SkBitmap& referenceBitmap) { | 924 GM* gm, const ConfigData& gRec, const SkBitmap& referenceBitmap) { |
924 ErrorBitfield errors = kEmptyErrorBitfield; | 925 ErrorBitfield errors = kEmptyErrorBitfield; |
925 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { | 926 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { |
926 SkBitmap bitmap; | 927 SkBitmap bitmap; |
927 SkISize size = gm->getISize(); | 928 SkISize size = gm->getISize(); |
928 setup_bitmap(gRec, size, &bitmap); | 929 setup_bitmap(gRec, size, &bitmap); |
929 SkCanvas canvas(bitmap); | 930 SkCanvas canvas(bitmap); |
931 installFilter(&canvas); | |
930 TiledPipeController pipeController(bitmap); | 932 TiledPipeController pipeController(bitmap); |
931 SkGPipeWriter writer; | 933 SkGPipeWriter writer; |
932 SkCanvas* pipeCanvas = writer.startRecording( | 934 SkCanvas* pipeCanvas = writer.startRecording( |
933 &pipeController, gPipeWritingFlagCombos[i].flags); | 935 &pipeController, gPipeWritingFlagCombos[i].flags); |
934 invokeGM(gm, pipeCanvas, false, false); | 936 invokeGM(gm, pipeCanvas, false, false); |
935 complete_bitmap(&bitmap); | 937 complete_bitmap(&bitmap); |
936 writer.endRecording(); | 938 writer.endRecording(); |
937 SkString string("-tiled pipe"); | 939 SkString string("-tiled pipe"); |
938 string.append(gPipeWritingFlagCombos[i].name); | 940 string.append(gPipeWritingFlagCombos[i].name); |
939 errors |= compare_test_results_to_reference_bitmap( | 941 errors |= compare_test_results_to_reference_bitmap( |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1720 SkGraphics::Term(); | 1722 SkGraphics::Term(); |
1721 | 1723 |
1722 return (0 == testsFailed) ? 0 : -1; | 1724 return (0 == testsFailed) ? 0 : -1; |
1723 } | 1725 } |
1724 | 1726 |
1725 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 1727 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
1726 int main(int argc, char * const argv[]) { | 1728 int main(int argc, char * const argv[]) { |
1727 return tool_main(argc, (char**) argv); | 1729 return tool_main(argc, (char**) argv); |
1728 } | 1730 } |
1729 #endif | 1731 #endif |
OLD | NEW |