| 134 | | float maxw = w; |
| 135 | | float maxh = h; |
| 136 | | w = template.getWidth() * scale; |
| 137 | | h = template.getWidth() * scale; |
| 138 | | float scalew = w / maxw; |
| 139 | | float scaleh = h / maxh; |
| 140 | | float maxscale = Math.max(scalew, scaleh); |
| 141 | | if (maxscale > 1f) { |
| 142 | | w /= maxscale; |
| 143 | | h /= maxscale; |
| | 134 | if (scale == 0f) { |
| | 135 | h = w / template.getWidth() * template.getHeight(); |
| | 136 | } |
| | 137 | else { |
| | 138 | float maxw = w; |
| | 139 | float maxh = h; |
| | 140 | w = template.getWidth() * scale; |
| | 141 | h = template.getWidth() * scale; |
| | 142 | float scalew = w / maxw; |
| | 143 | float scaleh = h / maxh; |
| | 144 | float maxscale = Math.max(scalew, scaleh); |
| | 145 | if (maxscale > 1f) { |
| | 146 | w /= maxscale; |
| | 147 | h /= maxscale; |
| | 148 | } |