MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / RenderTextClippedWithShadow

Method RenderTextClippedWithShadow

pcsx2/ImGui/ImGuiFullscreen.cpp:1180–1201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1178}
1179
1180void ImGuiFullscreen::RenderTextClippedWithShadow(const ImVec2& pos_min, const ImVec2& pos_max, const char* text,
1181 const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align, const ImRect* clip_rect)
1182{
1183 ImFont* font = ImGui::GetFont();
1184 const float font_size = ImGui::GetFontSize();
1185 ImDrawList* dl = ImGui::GetWindowDrawList();
1186 const ImVec2 text_size = text_size_if_known ? *text_size_if_known :
1187 font->CalcTextSizeA(font_size, FLT_MAX, 0.0f, text, text_end);
1188
1189 ImVec2 pos = pos_min;
1190 if (align.x > 0.0f)
1191 pos.x = ImMax(pos.x, pos_min.x + (pos_max.x - pos_min.x - text_size.x) * align.x);
1192 if (align.y > 0.0f)
1193 pos.y = ImMax(pos.y, pos_min.y + (pos_max.y - pos_min.y - text_size.y) * align.y);
1194
1195 const ImVec2& clip_min = clip_rect ? clip_rect->Min : pos_min;
1196 const ImVec2& clip_max = clip_rect ? clip_rect->Max : pos_max;
1197 dl->PushClipRect(clip_min, clip_max, true);
1198 AddTextWithShadow(dl, std::pair<ImFont*, float>(font, font_size), pos, ImGui::GetColorU32(ImGuiCol_Text), text, text_end, 0.0f, nullptr,
1199 IM_COL32(0, 0, 0, 64), true);
1200 dl->PopClipRect();
1201}
1202
1203void ImGuiFullscreen::DrawWindowTitle(const char* title)
1204{

Callers

nothing calls this directly

Calls 4

ImMaxFunction · 0.85
CalcTextSizeAMethod · 0.80
PushClipRectMethod · 0.45
PopClipRectMethod · 0.45

Tested by

no test coverage detected