| 149 | } |
| 150 | |
| 151 | void PiuRectangleScaleToFill(PiuRectangle r0, PiuRectangle r1, PiuRectangle r2) |
| 152 | { |
| 153 | PiuRectangleRecord r; |
| 154 | |
| 155 | if ((0 == r1->height) || (0 == r1->width)) { |
| 156 | PiuRectangleEmpty(r0); |
| 157 | return; |
| 158 | } |
| 159 | |
| 160 | r.width = r2->width; |
| 161 | r.height = (r1->height * r2->width) / r1->width; |
| 162 | if (r.height < r2->height) { |
| 163 | r.height = r2->height; |
| 164 | r.width = (r1->width * r2->height) / r1->height; |
| 165 | } |
| 166 | |
| 167 | r.x = (r2->width - r.width) / 2; |
| 168 | r.y = (r2->height - r.height) / 2; |
| 169 | PiuRectangleOffset(&r, r2->x, r2->y); |
| 170 | |
| 171 | *r0 = r; |
| 172 | } |
| 173 | |
| 174 | void PiuRectangleScaleToFit(PiuRectangle r0, PiuRectangle r1, PiuRectangle r2) |
| 175 | { |
no test coverage detected