fixed some formatting in the code

This commit is contained in:
Diego Waxemberg
2013-12-13 14:32:53 -05:00
parent bc64f094ce
commit 23084fc21e

View File

@@ -84,25 +84,26 @@ public class SwingCpuDecoderRenderer implements VideoDecoderRenderer {
} catch (InterruptedException e) { } catch (InterruptedException e) {
return; return;
} }
nextFrameTime = computePresentationTimeMs(targetFps);
double widthScale = (double)frame.getWidth() / width; double widthScale = (double)frame.getWidth() / width;
double heightScale = (double)frame.getHeight() / height; double heightScale = (double)frame.getHeight() / height;
double lowerScale = Math.min(widthScale, heightScale); double lowerScale = Math.min(widthScale, heightScale);
int newWidth = (int)(width * lowerScale); int newWidth = (int)(width * lowerScale);
int newHeight = (int)(height * lowerScale); int newHeight = (int)(height * lowerScale);
nextFrameTime = computePresentationTimeMs(targetFps);
int dx1 = 0; int dx1 = 0;
int dy1 = 0; int dy1 = 0;
if (frame.getWidth() > newWidth) { if (frame.getWidth() > newWidth) {
dx1 = (frame.getWidth()-newWidth)/2; dx1 = (frame.getWidth()-newWidth)/4;
} }
if (frame.getHeight() > newHeight) { if (frame.getHeight() > newHeight) {
dy1 = (frame.getHeight()-newHeight)/2; dy1 = (frame.getHeight()-newHeight)/4;
} }
if (AvcDecoder.getRgbFrameInt(imageBuffer, imageBuffer.length)) { if (AvcDecoder.getRgbFrameInt(imageBuffer, imageBuffer.length)) {
graphics.drawImage(image, dx1, dy1, dx1+newWidth, dy1+newHeight, 0, 0, width, height, null); graphics.drawImage(image, dx1, dy1, dx1+newWidth, dy1+newHeight, 0, 0, width, height, null);
//graphics.drawImage(image, 0, 0, newWidth, newHeight, null);
} }
} }
} }