xref: /aosp_15_r20/external/skia/tools/flags/CommonFlags.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 #pragma once
8 
9 #include "include/core/SkString.h"
10 #include "include/private/base/SkTArray.h"
11 #include "tools/flags/CommandLineFlags.h"
12 
13 namespace CommonFlags {
14 /**
15  *  Helper to assist in collecting image paths from |dir| specified through a command line
16  * flag.
17  *
18  *  Populates |output|, an array of strings with paths to images to test.
19  *
20  *  Returns true if each argument to the images flag is meaningful:
21  *  - If the file/directory does not exist, return false.
22  *  - If |dir| does not have any supported images (based on file type), return false.
23  *  - If |dir| is a single file, assume the user is deliberately testing this image,
24  *    regardless of file type.
25  */
26 bool CollectImages(const CommandLineFlags::StringArray& dir,
27                    skia_private::TArray<SkString>* output);
28 
29 }  // namespace CommonFlags
30