+
+ // Casts are safe because x and y are supposed to be less than the display
+ // size, so there is no danger of overflow.
+ DWORD scaledx = static_cast<DWORD>(ceil(x * 65535.0 / (displayx-1)));
+ DWORD scaledy = static_cast<DWORD>(ceil(y * 65535.0 / (displayy-1)));