181 | | |

182 | | if (size<_minimumScale) size = _minimumScale; |

183 | | if (size>_maximumScale) size = _maximumScale; |

| 183 | |

| 184 | if (_autoScaleTransitionWidthRatio>0.0f) |

| 185 | { |

| 186 | if (_minimumScale>0.0f) |

| 187 | { |

| 188 | float j = _minimumScale; |

| 189 | float i = (_maximumScale<FLT_MAX) ? |

| 190 | _minimumScale+(_maximumScale-_minimumScale)*_autoScaleTransitionWidthRatio : |

| 191 | _minimumScale*(1.0f+_autoScaleTransitionWidthRatio); |

| 192 | float c = 1.0f/(4.0f*(i-j)); |

| 193 | float b = 1.0f - 2.0f*c*i; |

| 194 | float a = j + b*b / (4.0f*c); |

| 195 | float k = -b / (2.0f*c); |

| 196 | |

| 197 | if (size<k) size = _minimumScale; |

| 198 | else if (size<i) size = a + b*size + c*(size*size); |

| 199 | } |

| 200 | |

| 201 | if (_maximumScale<FLT_MAX) |

| 202 | { |

| 203 | float n = _maximumScale; |

| 204 | float m = (_minimumScale>0.0) ? |

| 205 | _maximumScale+(_minimumScale-_maximumScale)*_autoScaleTransitionWidthRatio : |

| 206 | _maximumScale*(1.0f-_autoScaleTransitionWidthRatio); |

| 207 | float c = 1.0f / (4.0f*(m-n)); |

| 208 | float b = 1.0f - 2.0f*c*m; |

| 209 | float a = n + b*b/(4.0f*c); |

| 210 | float p = -b / (2.0f*c); |

| 211 | |

| 212 | if (size>p) size = _maximumScale; |

| 213 | else if (size>m) size = a + b*size + c*(size*size); |

| 214 | } |

| 215 | } |