| 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 * |
| 11 * If you make changes to this, re-run the self-tests at gm/tests/run.sh | 11 * If you make changes to this, re-run the self-tests at gm/tests/run.sh |
| 12 * to make sure they still pass... you may need to change the expected | 12 * to make sure they still pass... you may need to change the expected |
| 13 * results of the self-test. | 13 * results of the self-test. |
| 14 */ | 14 */ |
| 15 | 15 |
| 16 #include "gm.h" | 16 #include "gm.h" |
| 17 #include "gm_expectations.h" | 17 #include "gm_expectations.h" |
| 18 #include "system_preferences.h" | 18 #include "system_preferences.h" |
| 19 #include "SkBitmap.h" | 19 #include "SkBitmap.h" |
| 20 #include "SkBitmapChecksummer.h" | 20 #include "SkBitmapChecksummer.h" |
| 21 #include "SkColorPriv.h" | 21 #include "SkColorPriv.h" |
| 22 #include "SkCommandLineFlags.h" |
| 22 #include "SkData.h" | 23 #include "SkData.h" |
| 23 #include "SkDeferredCanvas.h" | 24 #include "SkDeferredCanvas.h" |
| 24 #include "SkDevice.h" | 25 #include "SkDevice.h" |
| 25 #include "SkDrawFilter.h" | 26 #include "SkDrawFilter.h" |
| 26 #include "SkFlags.h" | |
| 27 #include "SkGPipe.h" | 27 #include "SkGPipe.h" |
| 28 #include "SkGraphics.h" | 28 #include "SkGraphics.h" |
| 29 #include "SkImageDecoder.h" | 29 #include "SkImageDecoder.h" |
| 30 #include "SkImageEncoder.h" | 30 #include "SkImageEncoder.h" |
| 31 #include "SkOSFile.h" | 31 #include "SkOSFile.h" |
| 32 #include "SkPicture.h" | 32 #include "SkPicture.h" |
| 33 #include "SkRefCnt.h" | 33 #include "SkRefCnt.h" |
| 34 #include "SkStream.h" | 34 #include "SkStream.h" |
| 35 #include "SkTArray.h" | 35 #include "SkTArray.h" |
| 36 #include "SkTileGridPicture.h" | 36 #include "SkTileGridPicture.h" |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 GMMain gmmain; | 1155 GMMain gmmain; |
| 1156 | 1156 |
| 1157 SkTDArray<size_t> configs; | 1157 SkTDArray<size_t> configs; |
| 1158 SkTDArray<size_t> excludeConfigs; | 1158 SkTDArray<size_t> excludeConfigs; |
| 1159 SkTDArray<SkScalar> tileGridReplayScales; | 1159 SkTDArray<SkScalar> tileGridReplayScales; |
| 1160 *tileGridReplayScales.append() = SK_Scalar1; // By default only test at scal
e 1.0 | 1160 *tileGridReplayScales.append() = SK_Scalar1; // By default only test at scal
e 1.0 |
| 1161 bool userConfig = false; | 1161 bool userConfig = false; |
| 1162 | 1162 |
| 1163 SkString usage; | 1163 SkString usage; |
| 1164 usage.printf("Run the golden master tests.\n"); | 1164 usage.printf("Run the golden master tests.\n"); |
| 1165 SkFlags::SetUsage(usage.c_str()); | 1165 SkCommandLineFlags::SetUsage(usage.c_str()); |
| 1166 SkFlags::ParseCommandLine(argc, argv); | 1166 SkCommandLineFlags::Parse(argc, argv); |
| 1167 | 1167 |
| 1168 #if SK_SUPPORT_GPU | 1168 #if SK_SUPPORT_GPU |
| 1169 struct { | 1169 struct { |
| 1170 int fBytes; | 1170 int fBytes; |
| 1171 int fCount; | 1171 int fCount; |
| 1172 } gpuCacheSize = { -1, -1 }; // -1s mean use the default | 1172 } gpuCacheSize = { -1, -1 }; // -1s mean use the default |
| 1173 | 1173 |
| 1174 if (FLAGS_gpuCacheSize.count() > 0) { | 1174 if (FLAGS_gpuCacheSize.count() > 0) { |
| 1175 if (FLAGS_gpuCacheSize.count() != 2) { | 1175 if (FLAGS_gpuCacheSize.count() != 2) { |
| 1176 gm_fprintf(stderr, "--gpuCacheSize requires two arguments\n"); | 1176 gm_fprintf(stderr, "--gpuCacheSize requires two arguments\n"); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 if (FLAGS_forceBWtext) { | 1638 if (FLAGS_forceBWtext) { |
| 1639 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 1639 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
| 1640 } | 1640 } |
| 1641 } | 1641 } |
| 1642 | 1642 |
| 1643 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 1643 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 1644 int main(int argc, char * const argv[]) { | 1644 int main(int argc, char * const argv[]) { |
| 1645 return tool_main(argc, (char**) argv); | 1645 return tool_main(argc, (char**) argv); |
| 1646 } | 1646 } |
| 1647 #endif | 1647 #endif |
| OLD | NEW |