Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 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_CONFIG_H | |
| 9 #define SK_COMMON_FLAGS_CONFIG_H | |
| 10 | |
| 11 #include "SkCommandLineFlags.h" | |
| 12 | |
| 13 DECLARE_string(config); | |
| 14 | |
| 15 class SkCommandLineConfigGpu; | |
|
scroggo
2015/12/03 19:02:59
Should this be in #if SK_SUPPORT_GPU?
Kimmo Kinnunen
2015/12/04 14:26:19
Done.
| |
| 16 // SkCommandLineConfig represents a Skia rendering configuration string. | |
|
scroggo
2015/12/03 19:02:59
nit: newline before comment block
Kimmo Kinnunen
2015/12/04 14:26:19
Done.
| |
| 17 // The string has following form: | |
| 18 // [via-]*tag | |
| 19 // where 'tag' consists of chars excluding hyphen or "angle-gl" | |
| 20 // and each 'via' consists of chars excluding hyphen. | |
| 21 class SkCommandLineConfig { | |
| 22 public: | |
| 23 SkCommandLineConfig(const SkString& tag, const SkTArray<SkString>& viaParts) ; | |
| 24 virtual ~SkCommandLineConfig(); | |
| 25 #if SK_SUPPORT_GPU | |
| 26 virtual const SkCommandLineConfigGpu* asConfigGpu() const { return nullptr; } | |
| 27 #endif | |
| 28 const SkString& getTag() const { return fTag; } | |
| 29 const SkTArray<SkString>& getViaParts() const { return fViaParts; } | |
| 30 private: | |
| 31 SkString fTag; | |
| 32 SkTArray<SkString> fViaParts; | |
| 33 }; | |
| 34 | |
| 35 #if SK_SUPPORT_GPU | |
| 36 // SkCommandLineConfigGpu is a SkCommandLineConfig that extracts information out of the tag. It is | |
| 37 // constructed configs that have: | |
| 38 // * tags of form "gpu(option=value,option2=value,...)" | |
| 39 // * tags that represent a shorthand of above (such as "msaa16" representing "gp u(samples=16)") | |
| 40 class SkCommandLineConfigGpu : public SkCommandLineConfig { | |
| 41 public: | |
| 42 enum API { | |
| 43 kNative_API, | |
| 44 kGL_API, | |
| 45 kGLES_API, | |
| 46 #if SK_ANGLE | |
| 47 #if SK_BUILD_FOR_WIN | |
| 48 kANGLE_API, | |
| 49 #endif | |
| 50 kANGLE_GL_API, | |
| 51 #endif | |
| 52 #if SK_COMMAND_BUFFER | |
| 53 kCommandBuffer_API, | |
| 54 #endif | |
| 55 #if SK_MESA | |
| 56 kMESA_API, | |
| 57 #endif | |
| 58 kDebug_API, | |
| 59 kNull_API | |
| 60 }; | |
| 61 | |
| 62 SkCommandLineConfigGpu(const SkString& tag, const SkTArray<SkString>& viaPar ts, API api, bool useNVPR, bool useDIText, int samples); | |
|
scroggo
2015/12/03 19:02:59
100 chars
Kimmo Kinnunen
2015/12/04 14:26:19
Done.
| |
| 63 const SkCommandLineConfigGpu* asConfigGpu() const override { return this; } | |
| 64 API getAPI() const { return fAPI; } | |
| 65 bool getUseNVPR() const { return fUseNVPR; } | |
| 66 bool getUseDIText() const { return fUseDIText; } | |
| 67 int getSamples() const { return fSamples; } | |
| 68 | |
| 69 private: | |
| 70 API fAPI; | |
| 71 bool fUseNVPR; | |
| 72 bool fUseDIText; | |
| 73 int fSamples; | |
| 74 }; | |
| 75 #endif | |
| 76 | |
| 77 typedef SkTArray<SkAutoTDelete<SkCommandLineConfig>, true> SkCommandLineConfigAr ray; | |
| 78 void ParseConfigs(const SkCommandLineFlags::StringArray& configList, SkCommandLi neConfigArray* outResult); | |
|
scroggo
2015/12/03 19:02:59
100 chars
Kimmo Kinnunen
2015/12/04 14:26:19
Done.
| |
| 79 | |
| 80 #endif | |
| OLD | NEW |