| 31 | #endif |
| 32 | |
| 33 | static PixelPoint |
| 34 | TextInBoxMoveInView(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 | |
| 74 | static void |
| 75 | RenderShadowedText(Canvas &canvas, const TCHAR *text, |