| 298 | | |
| 299 | | if (ratio2 > ratio1) |
| 300 | | { |
| 301 | | currentExtent_.height(currentExtent_.width() / ratio1); |
| 302 | | } |
| 303 | | else if (ratio2 < ratio1) |
| 304 | | { |
| 305 | | currentExtent_.width(currentExtent_.height() * ratio1); |
| 306 | | } |
| | 302 | if (ratio1 == ratio2) return; |
| | 303 | |
| | 304 | switch(aspectFixMode_) |
| | 305 | { |
| | 306 | case ADJUST_BBOX_HEIGHT: |
| | 307 | currentExtent_.height(currentExtent_.width() / ratio1); |
| | 308 | break; |
| | 309 | case ADJUST_BBOX_WIDTH: |
| | 310 | currentExtent_.width(currentExtent_.height() * ratio1); |
| | 311 | break; |
| | 312 | case ADJUST_CANVAS_HEIGHT: |
| | 313 | height_ = int (width_ / ratio2 + 0.5); |
| | 314 | break; |
| | 315 | case ADJUST_CANVAS_WIDTH: |
| | 316 | width_ = int (height_ * ratio2 + 0.5); |
| | 317 | break; |
| | 318 | case GROW_BBOX: |
| | 319 | if (ratio2 > ratio1) |
| | 320 | currentExtent_.height(currentExtent_.width() / ratio1); |
| | 321 | else |
| | 322 | currentExtent_.width(currentExtent_.height() * ratio1); |
| | 323 | break; |
| | 324 | case SHRINK_BBOX: |
| | 325 | if (ratio2 < ratio1) |
| | 326 | currentExtent_.height(currentExtent_.width() / ratio1); |
| | 327 | else |
| | 328 | currentExtent_.width(currentExtent_.height() * ratio1); |
| | 329 | break; |
| | 330 | case GROW_CANVAS: |
| | 331 | if (ratio2 > ratio1) |
| | 332 | width_ = (int) (height_ * ratio2 + 0.5); |
| | 333 | else |
| | 334 | height_ = int (width_ / ratio2 + 0.5); |
| | 335 | break; |
| | 336 | case SHRINK_CANVAS: |
| | 337 | if (ratio2 > ratio1) |
| | 338 | height_ = int (width_ / ratio2 + 0.5); |
| | 339 | else |
| | 340 | width_ = (int) (height_ * ratio2 + 0.5); |
| | 341 | break; |
| | 342 | } |