MCPcopy Create free account
hub / github.com/defold/defold / GetEncodeParamsFromArgs

Function GetEncodeParamsFromArgs

engine/tools/src/texconvert/main.cpp:147–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void GetEncodeParamsFromArgs(int argc, const char* argv[], EncodeParams& params)
148{
149 params.m_PathIn = argc > 1 ? argv[1] : 0;
150 params.m_PathOut = argc > 2 ? argv[2] : 0;
151
152 for (int i = 3; i < argc; ++i)
153 {
154 if (IsArg(argv[i]))
155 {
156 const char* actual_arg = argv[i]+2;
157 #define CMP_ARG(name) (dmStrCaseCmp(actual_arg, name) == 0)
158 #define CMP_ARG_1_OP(name) (CMP_ARG(name) && (i+1) < argc)
159
160 if (CMP_ARG("premultiply-alpha"))
161 params.m_PremultiplyAlpha = 1;
162 else if (CMP_ARG("flip-x"))
163 params.m_FlipX = 1;
164 else if (CMP_ARG("flip-y"))
165 params.m_FlipY = 1;
166 else if (CMP_ARG("verbose"))
167 params.m_Verbose = 1;
168 else if (CMP_ARG("mipmaps"))
169 params.m_MipMaps = 1;
170 else if (CMP_ARG_1_OP("color-space"))
171 params.m_ColorSpace = GetArgTypeValue(argv[++i], g_cs_lut, params.m_ColorSpace);
172 else if (CMP_ARG_1_OP("compression-type"))
173 params.m_CompressionType = GetArgTypeValue(argv[++i], g_ct_lut, params.m_CompressionType);
174 else if (CMP_ARG_1_OP("compression-level"))
175 params.m_CompressionLevel = GetArgTypeValue(argv[++i], g_cl_lut, params.m_CompressionLevel);
176
177 #undef CMP_ARG_1_OP
178 #undef CMP_ARG
179 }
180 }
181}
182
183int DoEncode(EncodeParams params)
184{

Callers 1

mainFunction · 0.85

Calls 2

IsArgFunction · 0.70
GetArgTypeValueFunction · 0.70

Tested by

no test coverage detected