int dst_x = 0; int dst_y = 0;
int dst_w = 0; int dst_h = 0;
- if (current_scale_factor != 1.0) {
+ unsigned int screen_width =
+ get_emul_resolution_width() * current_scale_factor;
+ unsigned int screen_height =
+ get_emul_resolution_height() * current_scale_factor;
+
+ int margin_w = screen_width - guide->w;
+ int margin_h = screen_height - guide->h;
+
+ if (margin_w < 0 || margin_h < 0) {
/* guide image scaling */
+ int margin = (margin_w < margin_h)? margin_w : margin_h;
+ dst_w = guide->w + margin;
+ dst_h = guide->h + margin;
+
SDL_Surface *scaled_guide = SDL_CreateRGBSurface(
- SDL_SWSURFACE,
- guide->w * current_scale_factor,
- guide->h * current_scale_factor,
- get_emul_sdl_bpp(),
+ SDL_SWSURFACE, dst_w, dst_h, get_emul_sdl_bpp(),
guide->format->Rmask, guide->format->Gmask,
guide->format->Bmask, guide->format->Amask);
scaled_guide = maru_do_pixman_scale(guide, scaled_guide);
- dst_w = scaled_guide->w;
- dst_h = scaled_guide->h;
dst_x = (surface_screen->w - dst_w) / 2;
dst_y = (surface_screen->h - dst_h) / 2;
SDL_Rect dst_rect = { dst_x, dst_y, dst_w, dst_h };
logger.info("Advanced graphics not supported");
} */
- int ww = lcdCanvas.getSize().x;
- int hh = lcdCanvas.getSize().y;
+ final int screen_width = lcdCanvas.getSize().x;
+ final int screen_height = lcdCanvas.getSize().y;
/* if (pollThread.getWaitIntervalTime() == 0) {
logger.info("draw black screen");
if (currentState.getCurrentAngle() == 0) { /* portrait */
e.gc.drawImage(pollThread.imageFramebuffer,
0, 0, pollThread.widthFB, pollThread.heightFB,
- 0, 0, ww, hh);
+ 0, 0, screen_width, screen_height);
} else { /* non-portrait */
Transform newTransform = new Transform(lcdCanvas.getDisplay());
Transform oldTransform = new Transform(lcdCanvas.getDisplay());
newTransform.rotate(currentState.getCurrentAngle());
+ int frame_width = 0, frame_height = 0;
if (currentState.getCurrentAngle() == 90) { /* reverse landscape */
- int temp = ww;
- ww = hh;
- hh = temp;
- newTransform.translate(0, hh * -1);
+ frame_width = screen_height;
+ frame_height = screen_width;
+ newTransform.translate(0, frame_height * -1);
} else if (currentState.getCurrentAngle() == 180) { /* reverse portrait */
- newTransform.translate(ww * -1, hh * -1);
+ frame_width = screen_width;
+ frame_height = screen_height;
+ newTransform.translate(frame_width * -1, frame_height * -1);
} else if (currentState.getCurrentAngle() == -90) { /* landscape */
- int temp = ww;
- ww = hh;
- hh = temp;
- newTransform.translate(ww * -1, 0);
+ frame_width = screen_height;
+ frame_height = screen_width;
+ newTransform.translate(frame_width * -1, 0);
}
/* save current transform as oldTransform */
e.gc.setTransform(newTransform);
e.gc.drawImage(pollThread.imageFramebuffer,
0, 0, pollThread.widthFB, pollThread.heightFB,
- 0, 0, ww, hh);
+ 0, 0, frame_width, frame_height);
/* back to old transform */
e.gc.setTransform(oldTransform);
if (imageGuide != null) {
logger.info("draw blank guide");
- float convertedScale = SkinUtil.convertScale(
- currentState.getCurrentScale());
-
int widthImage = imageGuide.getImageData().width;
int heightImage = imageGuide.getImageData().height;
- int scaledWidthImage = (int)(widthImage * convertedScale);
- int scaledHeightImage = (int)(heightImage * convertedScale);
+ int margin_w = screen_width - widthImage;
+ int margin_h = screen_height - heightImage;
+ int margin = Math.min(margin_w, margin_h);
+
+ int scaledWidthImage = widthImage;
+ int scaledHeightImage = heightImage;
+ if (margin < 0) {
+ scaledWidthImage += margin;
+ scaledHeightImage += margin;
+ }
e.gc.drawImage(imageGuide, 0, 0,
widthImage, heightImage,
- (lcdCanvas.getSize().x - scaledWidthImage) / 2,
- (lcdCanvas.getSize().y - scaledHeightImage) / 2,
+ (screen_width - scaledWidthImage) / 2,
+ (screen_height - scaledHeightImage) / 2,
scaledWidthImage, scaledHeightImage);
imageGuide = null;