AspectModeManager { public RectangleF doMeasure(VideoInfo info, RectangleF uiSize, float uiAR) { if (info.size.width <= 0) return uiSize.copy(); RectangleF ui = uiSize.copy(); if (!AspectHelper.is_ar_equals(uiAR, uiSize.getAR())) { ui.height = ui.width / uiAR; } RectangleF vid = null; if ("Stretch".equalsIgnoreCase(info.aspectMode)) { vid = doMeasureStretch(info, ui); } else if ("Zoom".equalsIgnoreCase(info.aspectMode)) { vid = doMeasureZoom(info, ui); } else { vid = doMeasureSource(info, ui); } RectangleF vidFinal = vid.copy(); if (!AspectHelper.is_ar_equals(uiAR, uiSize.getAR())) { vidFinal.translate(ui, uiSize); } return vidFinal; }  RectangleF doMeasure(VideoInfo info, RectangleF uiSize, float uiAR); String[] getARModes(); static String DEFAULT_ASPECT_MODE; static String ASPECT_MODES; }
@Test public void testMeasureSource16_9_in_wide_2_35() { RectangleF ui = new RectangleF(0,0,1920, 1920f / AspectHelper.ar_16_9); RectangleF vid = new RectangleF(0,0,1920, 1920f / AspectHelper.ar_16_9); System.out.println("UI: " + ui); System.out.println("VID: " + vid); assertTrue(AspectHelper.is_16_9(ui.getAR())); assertTrue(AspectHelper.is_16_9(vid.getAR())); VideoInfo vi = new VideoInfo(); vi.update(vid.asIntRect().width, vid.asIntRect().height, vid.getAR()); vi.updateARMode("Source"); AspectModeManager amm = new AspectModeManager(); Rectangle destVid = amm.doMeasure(vi, ui, 2.4f).asIntRect(); System.out.println("DESTVID: " + destVid); assertEquals(new Rectangle(249, 0, 1422, 1080), destVid); }