| 81 | } |
| 82 | |
| 83 | ScreenBase const ShrinkInto(ScreenBase const & screen, m2::RectD const & boundRect) |
| 84 | { |
| 85 | ScreenBase res = screen; |
| 86 | |
| 87 | m2::RectD clipRect = res.ClipRect(); |
| 88 | if (clipRect.minX() < boundRect.minX()) |
| 89 | clipRect.Offset(boundRect.minX() - clipRect.minX(), 0); |
| 90 | if (clipRect.maxX() > boundRect.maxX()) |
| 91 | clipRect.Offset(boundRect.maxX() - clipRect.maxX(), 0); |
| 92 | if (clipRect.minY() < boundRect.minY()) |
| 93 | clipRect.Offset(0, boundRect.minY() - clipRect.minY()); |
| 94 | if (clipRect.maxY() > boundRect.maxY()) |
| 95 | clipRect.Offset(0, boundRect.maxY() - clipRect.maxY()); |
| 96 | |
| 97 | res.SetOrg(clipRect.Center()); |
| 98 | |
| 99 | // This assert fails near x = 180 (Philipines). |
| 100 | // ASSERT ( boundRect.IsRectInside(res.ClipRect()), (clipRect, res.ClipRect()) ); |
| 101 | return res; |
| 102 | } |
| 103 | |
| 104 | ScreenBase const ScaleInto(ScreenBase const & screen, m2::RectD const & boundRect) |
| 105 | { |