Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
CommonFlagsConfig.h
Go to the documentation of this file.
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
14
16
18class SkCommandLineConfigGraphite;
20
21// SkCommandLineConfig represents a Skia rendering configuration string.
22// The string has following form:
23// tag:
24// [via-]*backend
25// where 'backend' consists of chars excluding hyphen
26// and each 'via' consists of chars excluding hyphen.
28public:
30 const SkString& backend,
31 const skia_private::TArray<SkString>& viaParts);
32 virtual ~SkCommandLineConfig();
33 virtual const SkCommandLineConfigGpu* asConfigGpu() const { return nullptr; }
34 virtual const SkCommandLineConfigGraphite* asConfigGraphite() const { return nullptr; }
35 virtual const SkCommandLineConfigSvg* asConfigSvg() const { return nullptr; }
36 const SkString& getTag() const { return fTag; }
37 const SkString& getBackend() const { return fBackend; }
38 sk_sp<SkColorSpace> refColorSpace() const { return fColorSpace; }
39 const skia_private::TArray<SkString>& getViaParts() const { return fViaParts; }
40
41private:
42 SkString fTag;
43 SkString fBackend;
44 sk_sp<SkColorSpace> fColorSpace;
46};
47
48// SkCommandLineConfigGpu is a SkCommandLineConfig that extracts information out of the backend
49// part of the tag. It is constructed tags that have:
50// * backends of form "gpu[option=value,option2=value,...]"
51// * backends that represent a shorthand of above (such as "glmsaa16" representing
52// "gpu(api=gl,samples=16)")
54public:
58
60 const skia_private::TArray<SkString>& viaParts,
61 ContextType contextType,
62 bool fakeGLESVer2,
63 uint32_t surfaceFlags,
64 int samples,
66 SkAlphaType alphaType,
67 bool useStencilBuffers,
68 int testPersistentCache,
69 bool testPrecompile,
70 bool useDDLSink,
71 bool slug,
72 bool serializedSlug,
73 bool remoteSlug,
74 bool reducedShaders,
75 SurfType);
76
77 const SkCommandLineConfigGpu* asConfigGpu() const override { return this; }
78 ContextType getContextType() const { return fContextType; }
79 ContextOverrides getContextOverrides() const { return fContextOverrides; }
80 uint32_t getSurfaceFlags() const { return fSurfaceFlags; }
81 int getSamples() const { return fSamples; }
82 SkColorType getColorType() const { return fColorType; }
83 SkAlphaType getAlphaType() const { return fAlphaType; }
84 int getTestPersistentCache() const { return fTestPersistentCache; }
85 bool getTestPrecompile() const { return fTestPrecompile; }
86 bool getUseDDLSink() const { return fUseDDLSink; }
87 bool getSlug() const { return fSlug; }
88 bool getSerializedSlug() const { return fSerializeSlug; }
89 bool getRemoteSlug() const { return fRemoteSlug; }
90 bool getReducedShaders() const { return fReducedShaders; }
91 SurfType getSurfType() const { return fSurfType; }
92
93private:
94 ContextType fContextType;
95 ContextOverrides fContextOverrides;
96 uint32_t fSurfaceFlags;
97 int fSamples;
98 SkColorType fColorType;
99 SkAlphaType fAlphaType;
100 int fTestPersistentCache;
101 bool fTestPrecompile;
102 bool fUseDDLSink;
103 bool fSlug;
104 bool fSerializeSlug;
105 bool fRemoteSlug;
106 bool fReducedShaders;
107 SurfType fSurfType;
108};
109
110#if defined(SK_GRAPHITE)
111
113
114class SkCommandLineConfigGraphite : public SkCommandLineConfig {
115public:
117
118 enum class SurfaceType {
119 // SkSurfaces::RenderTarget()
120 kDefault,
121 // BackendTexture around a WGPUTextureView passed to SkSurfaces::WrapBackendTexture()
122 kWrapTextureView,
123 };
124
125 SkCommandLineConfigGraphite(const SkString& tag,
126 const skia_private::TArray<SkString>& viaParts,
127 ContextType contextType,
128 SurfaceType surfaceType,
131 SkAlphaType alphaType,
132 bool testPrecompile)
133 : SkCommandLineConfig(tag, SkString("graphite"), viaParts)
134 , fOptions(options)
135 , fContextType(contextType)
136 , fSurfaceType(surfaceType)
138 , fAlphaType(alphaType)
139 , fTestPrecompile(testPrecompile) {
140 }
141 const SkCommandLineConfigGraphite* asConfigGraphite() const override { return this; }
142
143 const skiatest::graphite::TestOptions& getOptions() const { return fOptions; }
144 ContextType getContextType() const { return fContextType; }
145 SurfaceType getSurfaceType() const { return fSurfaceType; }
146 SkColorType getColorType() const { return fColorType; }
147 SkAlphaType getAlphaType() const { return fAlphaType; }
148 bool getTestPrecompile() const { return fTestPrecompile; }
149
150private:
152 ContextType fContextType;
153 SurfaceType fSurfaceType;
155 SkAlphaType fAlphaType;
156 bool fTestPrecompile;
157};
158
159#endif // SK_GRAPHITE
160
161// SkCommandLineConfigSvg is a SkCommandLineConfig that extracts information out of the backend
162// part of the tag. It is constructed tags that have:
163// * backends of form "svg[option=value,option2=value,...]"
165public:
166 SkCommandLineConfigSvg(const SkString& tag, const skia_private::TArray<SkString>& viaParts, int pageIndex);
167 const SkCommandLineConfigSvg* asConfigSvg() const override { return this; }
168
169 int getPageIndex() const { return fPageIndex; }
170
171private:
172 int fPageIndex;
173};
174
176void ParseConfigs(const CommandLineFlags::StringArray& configList,
177 SkCommandLineConfigArray* outResult);
178
179#endif
#define DECLARE_string(name)
const char * options
const char * backend
skia_private::TArray< std::unique_ptr< SkCommandLineConfig >, true > SkCommandLineConfigArray
void ParseConfigs(const CommandLineFlags::StringArray &configList, SkCommandLineConfigArray *outResult)
SkColorType fColorType
SkAlphaType
Definition SkAlphaType.h:26
SkColorType
Definition SkColorType.h:19
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
SurfType getSurfType() const
ContextType getContextType() const
ContextOverrides getContextOverrides() const
SkColorType getColorType() const
const SkCommandLineConfigGpu * asConfigGpu() const override
SkAlphaType getAlphaType() const
skgpu::ContextType ContextType
sk_gpu_test::GrContextFactory::ContextOverrides ContextOverrides
uint32_t getSurfaceFlags() const
const SkCommandLineConfigSvg * asConfigSvg() const override
sk_sp< SkColorSpace > refColorSpace() const
const SkString & getTag() const
virtual const SkCommandLineConfigSvg * asConfigSvg() const
const SkString & getBackend() const
const skia_private::TArray< SkString > & getViaParts() const
virtual const SkCommandLineConfigGpu * asConfigGpu() const
virtual const SkCommandLineConfigGraphite * asConfigGraphite() const