caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SK_COMMON_FLAGS_H |
| 9 | #define SK_COMMON_FLAGS_H |
| 10 | |
bungeman | bf521ff | 2016-02-17 13:13:44 -0800 | [diff] [blame] | 11 | #include "../private/SkTArray.h" |
caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 12 | #include "SkCommandLineFlags.h" |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 13 | #include "SkString.h" |
caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 14 | |
caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 15 | DECLARE_bool(cpu); |
| 16 | DECLARE_bool(dryRun); |
| 17 | DECLARE_bool(gpu); |
msarett | 95f192d | 2015-02-13 09:05:41 -0800 | [diff] [blame] | 18 | DECLARE_string(images); |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 19 | DECLARE_string(colorImages); |
msarett | db197a5 | 2016-06-21 09:44:29 -0700 | [diff] [blame] | 20 | DECLARE_bool(simpleCodec); |
caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 21 | DECLARE_string(match); |
| 22 | DECLARE_bool(quiet); |
joshualitt | 5f5a8d7 | 2015-02-25 14:09:45 -0800 | [diff] [blame] | 23 | DECLARE_bool(preAbandonGpuContext); |
bsalomon | 2354f84 | 2014-07-28 13:48:36 -0700 | [diff] [blame] | 24 | DECLARE_bool(abandonGpuContext); |
bsalomon | 6e2aad4 | 2016-04-01 11:54:31 -0700 | [diff] [blame] | 25 | DECLARE_bool(releaseAndAbandonGpuContext); |
mtklein | 9200758 | 2014-08-01 07:46:52 -0700 | [diff] [blame] | 26 | DECLARE_string(skps); |
Robert Phillips | ad8a43f | 2017-08-30 12:06:35 -0400 | [diff] [blame] | 27 | DECLARE_bool(ddl); |
Ben Wagner | 483c772 | 2018-02-20 17:06:07 -0500 | [diff] [blame] | 28 | DECLARE_string(jpgs); |
Florin Malita | fc043dc | 2017-12-31 11:08:42 -0500 | [diff] [blame] | 29 | DECLARE_string(jsons); |
fmalita | 95573e4 | 2016-09-14 09:05:43 -0700 | [diff] [blame] | 30 | DECLARE_string(svgs); |
Ben Wagner | 483c772 | 2018-02-20 17:06:07 -0500 | [diff] [blame] | 31 | DECLARE_bool(nativeFonts); |
caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 32 | DECLARE_int32(threads); |
| 33 | DECLARE_string(resourcePath); |
| 34 | DECLARE_bool(verbose); |
| 35 | DECLARE_bool(veryVerbose); |
mtklein | b511042 | 2014-08-07 15:20:02 -0700 | [diff] [blame] | 36 | DECLARE_string(writePath); |
benjaminwagner | 8d61f0d | 2016-01-25 13:02:40 -0800 | [diff] [blame] | 37 | DECLARE_bool(pre_log); |
liyuqian | 38911a7 | 2016-10-04 11:23:22 -0700 | [diff] [blame] | 38 | DECLARE_bool(analyticAA); |
Yuqian Li | 550148b | 2017-01-13 10:13:13 -0500 | [diff] [blame] | 39 | DECLARE_bool(forceAnalyticAA); |
Yuqian Li | df60e36 | 2017-07-25 11:26:31 -0400 | [diff] [blame] | 40 | DECLARE_bool(deltaAA); |
| 41 | DECLARE_bool(forceDeltaAA); |
mtklein | ea65bfa | 2014-09-09 07:59:46 -0700 | [diff] [blame] | 42 | DECLARE_string(key); |
| 43 | DECLARE_string(properties); |
Yuqian Li | b8b6253 | 2018-02-23 14:13:36 +0800 | [diff] [blame^] | 44 | DECLARE_int32(backendTiles); |
| 45 | DECLARE_int32(backendThreads) |
mtklein | ea65bfa | 2014-09-09 07:59:46 -0700 | [diff] [blame] | 46 | |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 47 | /** |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 48 | * Helper to assist in collecting image paths from |dir| specified through a command line flag. |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 49 | * |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 50 | * Populates |output|, an array of strings with paths to images to test. |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 51 | * |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 52 | * Returns true if each argument to the images flag is meaningful: |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 53 | * - If the file/directory does not exist, return false. |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 54 | * - If |dir| does not have any supported images (based on file type), return false. |
| 55 | * - If |dir| is a single file, assume the user is deliberately testing this image, |
| 56 | * regardless of file type. |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 57 | */ |
msarett | 69deca8 | 2016-04-29 09:38:40 -0700 | [diff] [blame] | 58 | bool CollectImages(SkCommandLineFlags::StringArray dir, SkTArray<SkString>* output); |
scroggo | 8673714 | 2016-02-03 12:19:11 -0800 | [diff] [blame] | 59 | |
caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 60 | #endif |