(byte[] unitType, float v, int orientation)
| 2248 | } |
| 2249 | |
| 2250 | private int convertUnit(byte[] unitType, float v, int orientation) { |
| 2251 | if (unitType != null) { |
| 2252 | switch (unitType[orientation]) { |
| 2253 | case UNIT_TYPE_REM: |
| 2254 | return Math.round(v * Font.getDefaultFont().getHeight()); |
| 2255 | case UNIT_TYPE_VH: |
| 2256 | return Math.round(v / 100f * CN.getDisplayHeight()); |
| 2257 | case UNIT_TYPE_VW: |
| 2258 | return Math.round(v / 100f * CN.getDisplayWidth()); |
| 2259 | case UNIT_TYPE_VMIN: |
| 2260 | return Math.round(v / 100f * Math.min(CN.getDisplayWidth(), CN.getDisplayHeight())); |
| 2261 | case UNIT_TYPE_VMAX: |
| 2262 | return Math.round(v / 100f * Math.max(CN.getDisplayWidth(), CN.getDisplayHeight())); |
| 2263 | case UNIT_TYPE_DIPS: |
| 2264 | return Display.getInstance().convertToPixels(v); |
| 2265 | case UNIT_TYPE_SCREEN_PERCENTAGE: |
| 2266 | if (orientation == Component.TOP || orientation == Component.BOTTOM) { |
| 2267 | float h = Display.getInstance().getDisplayHeight(); |
| 2268 | h = h / 100.0f * v; |
| 2269 | return (int) h; |
| 2270 | } else { |
| 2271 | float w = Display.getInstance().getDisplayWidth(); |
| 2272 | w = w / 100.0f * v; |
| 2273 | return (int) w; |
| 2274 | } |
| 2275 | default: |
| 2276 | return (int) v; |
| 2277 | } |
| 2278 | } |
| 2279 | return (int) v; |
| 2280 | } |
| 2281 | |
| 2282 | /// Returns the Padding |
| 2283 | /// |
no test coverage detected