| 492 | } |
| 493 | |
| 494 | void CaptionTextHandler::MyID2D1DeviceContext_DrawTextLayout( |
| 495 | ID2D1DeviceContext* This, |
| 496 | D2D1_POINT_2F origin, |
| 497 | IDWriteTextLayout* textLayout, |
| 498 | ID2D1Brush* defaultFillBrush, |
| 499 | D2D1_DRAW_TEXT_OPTIONS options |
| 500 | ) |
| 501 | { |
| 502 | if (!g_dwriteTextVisual) |
| 503 | { |
| 504 | return g_ID2D1DeviceContext_DrawTextLayout_Org( |
| 505 | This, |
| 506 | origin, |
| 507 | textLayout, |
| 508 | defaultFillBrush, |
| 509 | options |
| 510 | ); |
| 511 | } |
| 512 | |
| 513 | winrt::com_ptr<ID2D1SolidColorBrush> solidColorBrush{}; |
| 514 | if (FAILED(defaultFillBrush->QueryInterface(solidColorBrush.put()))) |
| 515 | { |
| 516 | return g_ID2D1DeviceContext_DrawTextLayout_Org( |
| 517 | This, |
| 518 | origin, |
| 519 | textLayout, |
| 520 | defaultFillBrush, |
| 521 | options |
| 522 | ); |
| 523 | } |
| 524 | const auto color = solidColorBrush->GetColor(); |
| 525 | const auto cleanup = wil::scope_exit([&] |
| 526 | { |
| 527 | solidColorBrush->SetColor(color); |
| 528 | }); |
| 529 | |
| 530 | const auto& windowState = g_textVisualStateMap[g_dwriteTextVisual]; |
| 531 | const auto textColorOverride = windowState.active ? (windowState.maximized ? g_captionActiveColorMaximized : g_captionActiveColor) : (windowState.maximized ? g_captionInactiveColorMaximized : g_captionInactiveColor); |
| 532 | if (textColorOverride != 0xFFFFFFFF) |
| 533 | { |
| 534 | solidColorBrush->SetColor(Color::FromAbgr(textColorOverride)); |
| 535 | } |
| 536 | |
| 537 | if (!g_textGlowSize) |
| 538 | { |
| 539 | return g_ID2D1DeviceContext_DrawTextLayout_Org( |
| 540 | This, |
| 541 | origin, |
| 542 | textLayout, |
| 543 | defaultFillBrush, |
| 544 | options |
| 545 | ); |
| 546 | } |
| 547 | |
| 548 | origin.x += g_textGlowSize; |
| 549 | origin.y += g_textGlowSize; |
| 550 | |
| 551 | DWRITE_TEXT_METRICS metrics{}; |
nothing calls this directly
no test coverage detected