mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-06-15 21:31:12 +00:00
graphics are now drawn in the center of the frame regardless of frame size and scaling
This commit is contained in:
@@ -91,8 +91,18 @@ public class SwingCpuDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
int newHeight = (int)(height * lowerScale);
|
int newHeight = (int)(height * lowerScale);
|
||||||
|
|
||||||
nextFrameTime = computePresentationTimeMs(targetFps);
|
nextFrameTime = computePresentationTimeMs(targetFps);
|
||||||
|
int dx1 = 0;
|
||||||
|
int dy1 = 0;
|
||||||
|
if (frame.getWidth() > newWidth) {
|
||||||
|
dx1 = (frame.getWidth()-newWidth)/2;
|
||||||
|
}
|
||||||
|
if (frame.getHeight() > newHeight) {
|
||||||
|
dy1 = (frame.getHeight()-newHeight)/2;
|
||||||
|
}
|
||||||
|
|
||||||
if (AvcDecoder.getRgbFrameInt(imageBuffer, imageBuffer.length)) {
|
if (AvcDecoder.getRgbFrameInt(imageBuffer, imageBuffer.length)) {
|
||||||
graphics.drawImage(image, 0, 0, newWidth, newHeight, null);
|
graphics.drawImage(image, dx1, dy1, dx1+newWidth, dy1+newHeight, 0, 0, width, height, null);
|
||||||
|
//graphics.drawImage(image, 0, 0, newWidth, newHeight, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user