Keep bottom-right corner of camera on-map.
Keep bottom-right corner of camera on-map.

Here's a crazy diagram to help illustrate:

A---------I---B   L
|             |
| map         |
|             |
|   E---F     |
|   |cam|     |
|   G---H     |
|             |
J         K   |
|             |
C-------------D

M                 N

Rect ABCD lays out the corners of the map's actual bounds
Rect EFGH lays out the corners of the camera's view
Rect AIJK lays out a rectangle internal to the map
Rect ALMN lays out a rectangle overlapping the map, with some outside

The earlier code clamped corner E into ABCD, which results in EFGH
being clamped into ALMN, which is one camera-width wider and one
camera-height taller than ABCD. Because E can go as far right as B,
and as far down as C, F can go as far right as L, and G can go as far
down as M. This results in the camera drawing past the edge of the
map, and very ugly rendering artifacts fill that non-space.

The new code clamps corner E into AIJK, where I is a camera-width
less than B, and J is a camera-height less than C, so that EFGH is
properly clamped into ABCD, and no rendering is done off-map, but
the whole map is visible.

Should have been this way from the start.

wcarss/creek,wcarss/creek