Flutter Engine
The Flutter Engine
Classes | Typedefs | Functions
CommonFlagsConfig.h File Reference
#include "include/core/SkColorSpace.h"
#include "tools/flags/CommandLineFlags.h"
#include "tools/gpu/GrContextFactory.h"

Go to the source code of this file.

Classes

class  SkCommandLineConfig
 
class  SkCommandLineConfigGpu
 
class  SkCommandLineConfigSvg
 

Typedefs

typedef skia_private::TArray< std::unique_ptr< SkCommandLineConfig >, trueSkCommandLineConfigArray
 

Functions

 DECLARE_string (config)
 
void ParseConfigs (const CommandLineFlags::StringArray &configList, SkCommandLineConfigArray *outResult)
 

Typedef Documentation

◆ SkCommandLineConfigArray

Definition at line 175 of file CommonFlagsConfig.h.

Function Documentation

◆ DECLARE_string()

DECLARE_string ( config  )

◆ ParseConfigs()

void ParseConfigs ( const CommandLineFlags::StringArray configList,
SkCommandLineConfigArray outResult 
)

Definition at line 759 of file CommonFlagsConfig.cpp.

760 {
761 outResult->clear();
762 for (int i = 0; i < configs.size(); ++i) {
763 SkString extendedBackend;
764 SkString extendedOptions;
765 SkString simpleBackend;
766 TArray<SkString> vias;
767
768 SkString tag(configs[i]);
770 SkStrSplit(tag.c_str(), "[", kStrict_SkStrSplitMode, &parts);
771 if (parts.size() == 2) {
772 TArray<SkString> parts2;
773 SkStrSplit(parts[1].c_str(), "]", kStrict_SkStrSplitMode, &parts2);
774 if (parts2.size() == 2 && parts2[1].isEmpty()) {
775 SkStrSplit(parts[0].c_str(), "-", kStrict_SkStrSplitMode, &vias);
776 if (vias.size()) {
777 extendedBackend = vias[vias.size() - 1];
778 vias.pop_back();
779 } else {
780 extendedBackend = parts[0];
781 }
782 extendedOptions = parts2[0];
783 simpleBackend.printf("%s[%s]", extendedBackend.c_str(), extendedOptions.c_str());
784 }
785 }
786
787 if (extendedBackend.isEmpty()) {
788 simpleBackend = tag;
789 SkStrSplit(tag.c_str(), "-", kStrict_SkStrSplitMode, &vias);
790 if (vias.size()) {
791 simpleBackend = vias[vias.size() - 1];
792 vias.pop_back();
793 }
795 if (simpleBackend.equals(predefinedConfig.predefinedConfig)) {
796 extendedBackend = predefinedConfig.backend;
797 extendedOptions = predefinedConfig.options;
798 break;
799 }
800 }
801 }
802 SkCommandLineConfig* parsedConfig = nullptr;
803 if (extendedBackend.equals("gpu")) {
804 parsedConfig = parse_command_line_config_gpu(tag, vias, extendedOptions);
805 }
806#if defined(SK_GRAPHITE)
807 if (extendedBackend.equals("graphite")) {
808 parsedConfig = parse_command_line_config_graphite(tag, vias, extendedOptions);
809 }
810#endif
811 if (extendedBackend.equals("svg")) {
812 parsedConfig = parse_command_line_config_svg(tag, vias, extendedOptions);
813 }
814 if (!parsedConfig) {
815 parsedConfig = new SkCommandLineConfig(tag, simpleBackend, vias);
816 }
817 outResult->emplace_back(parsedConfig);
818 }
819}
SkCommandLineConfigGpu * parse_command_line_config_gpu(const SkString &tag, const TArray< SkString > &vias, const SkString &options)
const char * predefinedConfig
SkCommandLineConfigSvg * parse_command_line_config_svg(const SkString &tag, const TArray< SkString > &vias, const SkString &options)
static const struct @440 gPredefinedConfigs[]
void SkStrSplit(const char *str, const char *delimiters, SkStrSplitMode splitMode, TArray< SkString > *out)
@ kStrict_SkStrSplitMode
Definition: SkStringUtils.h:47
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
bool equals(const SkString &) const
Definition: SkString.cpp:324
bool isEmpty() const
Definition: SkString.h:130
const char * c_str() const
Definition: SkString.h:133
int size() const
Definition: SkTArray.h:421
T & emplace_back(Args &&... args)
Definition: SkTArray.h:248