| 361 | // ---------------------------------------------------------------------------------------- |
| 362 | |
| 363 | inline const rectangle centered_rect ( |
| 364 | long x, |
| 365 | long y, |
| 366 | unsigned long width, |
| 367 | unsigned long height |
| 368 | ) |
| 369 | { |
| 370 | rectangle result; |
| 371 | result.set_left ( x - static_cast<long>(width) / 2 ); |
| 372 | result.set_top ( y - static_cast<long>(height) / 2 ); |
| 373 | result.set_right ( result.left() + width - 1 ); |
| 374 | result.set_bottom ( result.top() + height - 1 ); |
| 375 | return result; |
| 376 | } |
| 377 | |
| 378 | // ---------------------------------------------------------------------------------------- |
| 379 | |