MCPcopy Create free account
hub / github.com/Tencent/libpag / WriteCommonConfig

Function WriteCommonConfig

exporter/src/config/ConfigFile.cpp:111–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111static void WriteCommonConfig(XMLElement* root, ConfigParam* configParam) {
112 XMLDocument* doc = root->GetDocument();
113 XMLElement* common = doc->NewElement("common");
114 root->InsertEndChild(common);
115
116 XMLElement* tagLevel = doc->NewElement("tag-level");
117 common->InsertEndChild(tagLevel);
118
119 XMLElement* mode = doc->NewElement("mode");
120 switch (configParam->tagMode) {
121 case TagMode::Beta:
122 mode->SetText("beta");
123 break;
124 case TagMode::Custom:
125 mode->SetText("custom");
126 break;
127 default:
128 mode->SetText("stable");
129 break;
130 }
131 tagLevel->InsertEndChild(mode);
132
133 XMLElement* customLevel = doc->NewElement("custom-level");
134 customLevel->SetText(std::to_string(configParam->exportTagLevel).c_str());
135 tagLevel->InsertEndChild(customLevel);
136
137 AddElement(common, "image-quality", std::to_string(configParam->imageQuality));
138 AddElement(common, "image-pixel-ratio", FormatFloat(configParam->imagePixelRatio, 1));
139 AddElement(common, "enable-compression-panel", std::to_string(1));
140 AddElement(common, "enable-layer-name", std::to_string(configParam->exportLayerName ? 1 : 0));
141 AddElement(common, "enable-font-file", std::to_string(configParam->exportFontFile ? 1 : 0));
142 AddElement(common, "export-scense", std::to_string(static_cast<int>(configParam->scenes)));
143 AddElement(common, "export-language", std::to_string(static_cast<int>(configParam->language)));
144}
145
146static void WriteBitmapConfig(XMLElement* root, ConfigParam* configParam) {
147 XMLDocument* doc = root->GetDocument();

Callers 2

WriteDefaultConfigFileFunction · 0.85
WriteConfigFileFunction · 0.85

Calls 2

AddElementFunction · 0.85
FormatFloatFunction · 0.85

Tested by

no test coverage detected