MCPcopy Create free account
hub / github.com/ALTaleX531/OpenGlass / MyID2D1DeviceContext_DrawTextLayout

Method MyID2D1DeviceContext_DrawTextLayout

OpenGlass/CaptionTextHandler.cpp:494–787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492}
493
494void 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{};

Callers

nothing calls this directly

Calls 13

CaptionCenterOffsetFunction · 0.85
DrawNineGridBitmapFunction · 0.85
putMethod · 0.80
GetColorMethod · 0.80
SetColorMethod · 0.80
getMethod · 0.80
GetXMethod · 0.80
GetWidthMethod · 0.80
GetTransformParentMethod · 0.80
GetScaleMethod · 0.80
QueryInterfaceMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected