| 277 | } |
| 278 | |
| 279 | void CustomThemeAtlasLoader::LoadThemeAtlasLayout(LPCWSTR themeAtlasLayoutPath) |
| 280 | { |
| 281 | FILE* file{}; |
| 282 | _wfopen_s(&file, themeAtlasLayoutPath, L"r"); |
| 283 | if (!file) |
| 284 | { |
| 285 | return; |
| 286 | } |
| 287 | |
| 288 | WCHAR strideBuffer[255]{}; |
| 289 | while (!feof(file)) |
| 290 | { |
| 291 | fgetws(strideBuffer, std::size(strideBuffer), file); |
| 292 | |
| 293 | if (strideBuffer[0] != L'#') |
| 294 | { |
| 295 | MARGINS part{}; |
| 296 | MARGINS data{}; |
| 297 | WCHAR keyBuffer[64]{}; |
| 298 | if ( |
| 299 | swscanf_s( |
| 300 | strideBuffer, |
| 301 | L"%[^=]=%d,%d,%d,%d", |
| 302 | keyBuffer, |
| 303 | static_cast<unsigned int>(std::size(keyBuffer)), |
| 304 | &data.cxLeftWidth, |
| 305 | &data.cxRightWidth, |
| 306 | &data.cyTopHeight, |
| 307 | &data.cyBottomHeight |
| 308 | ) == 5 |
| 309 | ) |
| 310 | { |
| 311 | swscanf_s( |
| 312 | keyBuffer, |
| 313 | L"%d;%d;%d", |
| 314 | &part.cxLeftWidth, |
| 315 | &part.cxRightWidth, |
| 316 | &part.cyTopHeight |
| 317 | ); |
| 318 | |
| 319 | if (g_themeAtlasLayoutQuirk == CompatibilityQuirk::RS1) |
| 320 | { |
| 321 | part.cxLeftWidth = part.cxLeftWidth > 10 ? part.cxLeftWidth - 1 : part.cxLeftWidth; |
| 322 | } |
| 323 | g_themeAtlasLayoutMap.try_emplace( |
| 324 | make_theme_atlas_layout_key( |
| 325 | part.cxLeftWidth, |
| 326 | part.cxRightWidth, |
| 327 | part.cyTopHeight |
| 328 | ), |
| 329 | data |
| 330 | ); |
| 331 | } |
| 332 | else if ( |
| 333 | DWORD value{}; |
| 334 | swscanf_s( |
| 335 | strideBuffer, |
| 336 | L"%[^=]=%d", |
nothing calls this directly
no test coverage detected