MCPcopy Create free account
hub / github.com/XCSoar/XCSoar / TextInBoxMoveInView

Function TextInBoxMoveInView

src/Renderer/TextInBox.cpp:33–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#endif
32
33static PixelPoint
34TextInBoxMoveInView(PixelRect &rc, const PixelRect &map_rc) noexcept
35{
36 PixelPoint offset(0, 0);
37
38 // If label is above maprect
39 if (map_rc.top > rc.top) {
40 // Move label down into maprect
41 unsigned d = map_rc.top - rc.top;
42 rc.top += d;
43 rc.bottom += d;
44 offset.y += d;
45 }
46
47 // If label is right of maprect
48 if (map_rc.right < rc.right) {
49 unsigned d = map_rc.right - rc.right;
50 rc.right += d;
51 rc.left += d;
52 offset.x += d;
53 }
54
55 // If label is below maprect
56 if (map_rc.bottom < rc.bottom) {
57 unsigned d = map_rc.bottom - rc.bottom;
58 rc.top += d;
59 rc.bottom += d;
60 offset.y += d;
61 }
62
63 // If label is left of maprect
64 if (map_rc.left > rc.left) {
65 unsigned d = map_rc.left - rc.left;
66 rc.right += d;
67 rc.left += d;
68 offset.x += d;
69 }
70
71 return offset;
72}
73
74static void
75RenderShadowedText(Canvas &canvas, const TCHAR *text,

Callers 1

TextInBoxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected