#endif
}
+void maru_display_interpolation(bool on)
+{
+#ifndef CONFIG_USE_SHM
+ maruskin_sdl_interpolation(on);
+#else
+ /* do nothing */
+#endif
+}
+
void maruskin_init(uint64 swt_handle,
unsigned int display_width, unsigned int display_height,
bool blank_guide)
void maru_display_init(DisplayState *ds);
void maru_display_fini(void);
+void maru_display_interpolation(bool on);
void maruskin_init(uint64 swt_handle,
unsigned int display_width, unsigned int display_height,
bool blank_guide);
static double current_scale_factor = 1.0;
static double current_screen_degree;
+static pixman_filter_t sdl_pixman_filter;
static int sdl_alteration;
}
static SDL_Surface *maru_do_pixman_scale(SDL_Surface *rz_src,
- SDL_Surface *rz_dst)
+ SDL_Surface *rz_dst,
+ pixman_filter_t filter)
{
pixman_image_t *src = NULL;
pixman_image_t *dst = NULL;
pixman_f_transform_scale(&matrix_f, NULL, sx, sy);
pixman_transform_from_pixman_f_transform(&matrix, &matrix_f);
pixman_image_set_transform(src, &matrix);
- pixman_image_set_filter(src, PIXMAN_FILTER_BILINEAR, NULL, 0);
+ pixman_image_set_filter(src, filter, NULL, 0);
pixman_image_composite(PIXMAN_OP_SRC, src, NULL, dst,
0, 0, 0, 0, 0, 0,
rz_dst->w, rz_dst->h);
}
pixman_transform_from_pixman_f_transform(&matrix, &matrix_f);
pixman_image_set_transform(src, &matrix);
- pixman_image_set_filter(src, PIXMAN_FILTER_BILINEAR, NULL, 0);
+ //pixman_image_set_filter(src, PIXMAN_FILTER_BILINEAR, NULL, 0);
pixman_image_composite(PIXMAN_OP_SRC, src, NULL, dst,
0, 0, 0, 0, 0, 0,
rz_dst->w, rz_dst->h);
guide->format->Rmask, guide->format->Gmask,
guide->format->Bmask, guide->format->Amask);
- scaled_guide = maru_do_pixman_scale(guide, scaled_guide);
+ scaled_guide = maru_do_pixman_scale(
+ guide, scaled_guide, PIXMAN_FILTER_BEST);
dst_x = (surface_screen->w - dst_w) / 2;
dst_y = (surface_screen->h - dst_h) / 2;
.dpy_refresh = qemu_ds_sdl_refresh,
};
+void maruskin_sdl_interpolation(bool on)
+{
+ if (on == true) {
+ INFO("set PIXMAN_FILTER_BEST filter for image processing\n");
+
+ /* PIXMAN_FILTER_BILINEAR */
+ sdl_pixman_filter = PIXMAN_FILTER_BEST;
+ } else {
+ INFO("set PIXMAN_FILTER_FAST filter for image processing\n");
+
+ /* PIXMAN_FILTER_NEAREST */
+ sdl_pixman_filter = PIXMAN_FILTER_FAST;
+ }
+}
+
static void qemu_update(void)
{
if (sdl_alteration == -1) {
surface_qemu, rotated_screen,
(int)current_screen_degree);
scaled_screen = maru_do_pixman_scale(
- rotated_screen, scaled_screen);
+ rotated_screen, scaled_screen, sdl_pixman_filter);
SDL_BlitSurface(scaled_screen, NULL, surface_screen, NULL);
}
set_emul_resolution(display_width, display_height);
set_emul_sdl_bpp(SDL_BPP);
+ maruskin_sdl_interpolation(true);
init_multi_touch_state();
if (blank_guide_enable == true) {
unsigned int display_width, unsigned int display_height,
bool blank_guide);
void maruskin_sdl_resize(void);
+void maruskin_sdl_interpolation(bool on);
void maruskin_sdl_quit(void);
#endif /* MARU_SDL_H_ */
return;
}*/
+ if (isOnInterpolation == false) {
+ /* Mac - NSImageInterpolationNone */
+ e.gc.setInterpolation(SWT.NONE);
+ } else {
+ /* Mac - NSImageInterpolationHigh */
+ e.gc.setInterpolation(SWT.HIGH);
+ }
+
if (currentState.getCurrentAngle() == 0) { /* portrait */
e.gc.drawImage(pollThread.imageFramebuffer,
0, 0, pollThread.widthFB, pollThread.heightFB,
protected Point shellGrabPosition;
protected boolean isShutdownRequested;
public boolean isOnTop;
+ public boolean isOnInterpolation;
public boolean isKeyWindow;
public boolean isOnKbd;
private PopupMenu popupMenu;
this.pressedKeyEventList = new LinkedList<KeyEventData>();
this.isOnTop = isOnTop;
+ this.isOnInterpolation = true;
this.isOnKbd = false;
this.isKeyWindow = false;
getShell().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
- getPopupMenu().kbdOnItem.setSelection(isOnKbd);
- getPopupMenu().kbdOffItem.setSelection(!isOnKbd);
+ getPopupMenu().hostKbdOnItem.setSelection(isOnKbd);
+ getPopupMenu().hostKbdOffItem.setSelection(!isOnKbd);
}
});
}
return listener;
}
+ public SelectionAdapter createInterpolationMenuListener() {
+ SelectionAdapter listener = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ MenuItem item = (MenuItem) e.getSource();
+ if (item.getSelection()) {
+ boolean on = item.equals(popupMenu.interpolationHighItem);
+ isOnInterpolation = on;
+ logger.info("Scale interpolation : " + isOnInterpolation);
+
+ communicator.sendToQEMU(SendCommand.SEND_INTERPOLATION_STATE,
+ new BooleanData(on, SendCommand.SEND_INTERPOLATION_STATE.toString()),
+ false);
+ }
+ }
+ };
+
+ return listener;
+ }
+
public SelectionAdapter createKeyWindowMenuListener() {
SelectionAdapter listener = new SelectionAdapter() {
@Override
return listener;
}
- public SelectionAdapter createHostKeyboardMenuListener() {
+ public SelectionAdapter createHostKbdMenuListener() {
SelectionAdapter listener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
"Host Keyboard is not ready.\n"
+ "Please wait until the emulator is completely boot up.",
SWT.ICON_WARNING, config);
- popupMenu.kbdOnItem.setSelection(isOnKbd);
- popupMenu.kbdOffItem.setSelection(!isOnKbd);
+ popupMenu.hostKbdOnItem.setSelection(isOnKbd);
+ popupMenu.hostKbdOffItem.setSelection(!isOnKbd);
return;
}
MenuItem item = (MenuItem) e.getSource();
if (item.getSelection()) {
- boolean on = item.equals(popupMenu.kbdOnItem);
+ boolean on = item.equals(popupMenu.hostKbdOnItem);
isOnKbd = on;
- logger.info("Host Keyboard " + isOnKbd);
+ logger.info("Host Keyboard : " + isOnKbd);
communicator.sendToQEMU(SendCommand.SEND_HOST_KBD_STATE,
new BooleanData(on, SendCommand.SEND_HOST_KBD_STATE.toString()), false);
SEND_RAM_DUMP((short) 18),
SEND_GUEST_DUMP((short) 19),
SEND_ECP_PORT_REQ((short) 20),
+ SEND_INTERPOLATION_STATE((short) 21),
RESPONSE_HEART_BEAT((short) 900),
RESPONSE_DRAW_FRAME((short) 901),
ADVANCED("advanced.png"),
CLOSE("close.png"),
SCREENSHOT("screenshot.png"),
- USB_KEYBOARD("usb_keyboard.png"),
- HOST_KEYBOARD("host_keyboard.png"),
+ HOST_KBD("host_keyboard.png"),
DIAGNOSIS("diagnosis.png"),
FORCE_CLOSE("force_close.png"),
ABOUT("about.png"),
public static final String TOPMOST_MENUITEM_NAME = "&Always On Top";
public static final String ROTATE_MENUITEM_NAME = "&Rotate";
public static final String SCALE_MENUITEM_NAME = "&Scale";
+ public static final String INTERPOLATION_MENUITEM_NAME = "&Interpolation";
public static final String KEYWINDOW_MENUITEM_NAME = "&Key Window";
public static final String ADVANCED_MENUITEM_NAME = "Ad&vanced";
public static final String SCREENSHOT_MENUITEM_NAME = "&Screen Shot";
- public static final String HOSTKEYBOARD_MENUITEM_NAME = "&Host Keyboard";
+ public static final String HOSTKBD_MENUITEM_NAME = "&Host Keyboard";
public static final String DIAGNOSIS_MENUITEM_NAME = "&Diagnosis";
public static final String RAMDUMP_MENUITEM_NAME = "&Ram Dump";
public static final String ABOUT_MENUITEM_NAME = "&About";
public MenuItem onTopItem;
public MenuItem rotateItem;
public MenuItem scaleItem;
+ public MenuItem interpolationItem;
+ public MenuItem interpolationHighItem;
+ public MenuItem interpolationLowItem;
public MenuItem keyWindowItem; /* key window menu */
public MenuItem advancedItem; /* advanced menu */
public MenuItem screenshotItem;
- public MenuItem hostKeyboardItem;
- public MenuItem kbdOnItem;
- public MenuItem kbdOffItem;
+ public MenuItem hostKbdItem;
+ public MenuItem hostKbdOnItem;
+ public MenuItem hostKbdOffItem;
public MenuItem diagnosisItem;
public MenuItem ramdumpItem;
public MenuItem aboutItem;
/* VirtIO Keyboard menu */
if (itemProperties == null || itemProperties.getHostKeyboardItem() == null) {
- createHostKeyboardItem(advancedSubMenu, HOSTKEYBOARD_MENUITEM_NAME);
+ createHostKbdItem(advancedSubMenu, HOSTKBD_MENUITEM_NAME);
} else {
- MenuItemType hostKeyboardMenuType = itemProperties.getHostKeyboardItem();
- if (hostKeyboardMenuType.isVisible() == true) {
- createHostKeyboardItem(advancedSubMenu,
- (hostKeyboardMenuType.getItemName().isEmpty()) ?
- HOSTKEYBOARD_MENUITEM_NAME : hostKeyboardMenuType.getItemName());
+ MenuItemType hostKbdMenuType = itemProperties.getHostKeyboardItem();
+ if (hostKbdMenuType.isVisible() == true) {
+ createHostKbdItem(advancedSubMenu,
+ (hostKbdMenuType.getItemName().isEmpty()) ?
+ HOSTKBD_MENUITEM_NAME : hostKbdMenuType.getItemName());
}
}
}
matchedItem.setSelection(true);
+
+ /* interpolation menu */
+ createInterpolationItem(scaleSubMenu, INTERPOLATION_MENUITEM_NAME);
}
scaleItem.setMenu(scaleSubMenu);
}
+ private void createInterpolationItem(Menu menu, String name) {
+ interpolationItem = new MenuItem(menu, SWT.CASCADE);
+ interpolationItem.setText(name);
+
+ Menu interpolationSubMenu = new Menu(menu.getShell(), SWT.DROP_DOWN);
+ {
+ createInterpolationHighLowItem(interpolationSubMenu);
+ }
+ interpolationItem.setMenu(interpolationSubMenu);
+ }
+
+ private void createInterpolationHighLowItem(Menu menu) {
+ interpolationHighItem = new MenuItem(menu, SWT.RADIO);
+ interpolationHighItem.setText("High");
+ interpolationHighItem.setSelection(skin.isOnInterpolation);
+
+ interpolationLowItem = new MenuItem(menu, SWT.RADIO);
+ interpolationLowItem.setText("Low");
+ interpolationLowItem.setSelection(!skin.isOnInterpolation);
+
+ SelectionAdapter interpolationListener = skin.createInterpolationMenuListener();
+ interpolationHighItem.addSelectionListener(interpolationListener);
+ interpolationLowItem.addSelectionListener(interpolationListener);
+ }
+
private void createKeyWindowItem(Menu menu, String name) {
/* load Key Window layout */
SelectionAdapter keyWindowListener = skin.createKeyWindowMenuListener();
screenshotItem.addSelectionListener(screenshotListener);
}
- private void createHostKeyboardItem(Menu menu, String name) {
- hostKeyboardItem = new MenuItem(menu, SWT.CASCADE);
- hostKeyboardItem.setText(name);
- hostKeyboardItem.setImage(imageRegistry.getIcon(IconName.HOST_KEYBOARD));
+ private void createHostKbdItem(Menu menu, String name) {
+ hostKbdItem = new MenuItem(menu, SWT.CASCADE);
+ hostKbdItem.setText(name);
+ hostKbdItem.setImage(imageRegistry.getIcon(IconName.HOST_KBD));
- Menu hostKeyboardSubMenu = new Menu(menu.getShell(), SWT.DROP_DOWN);
+ Menu hostKbdSubMenu = new Menu(menu.getShell(), SWT.DROP_DOWN);
{
- createKeyboardOnOffItem(hostKeyboardSubMenu);
+ createKbdOnOffItem(hostKbdSubMenu);
}
- hostKeyboardItem.setMenu(hostKeyboardSubMenu);
+ hostKbdItem.setMenu(hostKbdSubMenu);
}
- private void createKeyboardOnOffItem(Menu menu) {
- kbdOnItem = new MenuItem(menu, SWT.RADIO);
- kbdOnItem.setText("On");
- kbdOnItem.setSelection(skin.isOnKbd);
+ private void createKbdOnOffItem(Menu menu) {
+ hostKbdOnItem = new MenuItem(menu, SWT.RADIO);
+ hostKbdOnItem.setText("On");
+ hostKbdOnItem.setSelection(skin.isOnKbd);
- kbdOffItem = new MenuItem(menu, SWT.RADIO);
- kbdOffItem.setText("Off");
- kbdOffItem.setSelection(!skin.isOnKbd);
+ hostKbdOffItem = new MenuItem(menu, SWT.RADIO);
+ hostKbdOffItem.setText("Off");
+ hostKbdOffItem.setSelection(!skin.isOnKbd);
- SelectionAdapter hostKeyboardListener = skin.createHostKeyboardMenuListener();
- kbdOnItem.addSelectionListener(hostKeyboardListener);
- kbdOffItem.addSelectionListener(hostKeyboardListener);
+ SelectionAdapter hostKbdListener = skin.createHostKbdMenuListener();
+ hostKbdOnItem.addSelectionListener(hostKbdListener);
+ hostKbdOffItem.addSelectionListener(hostKbdListener);
}
private void createRamDumpItem(Menu menu, String name) {
#endif
}
+void do_interpolation_enable(bool on)
+{
+ INFO("interpolation enable : %d\n", on);
+
+ maru_display_interpolation(on);
+}
+
void do_ram_dump(void)
{
INFO("dump ram!\n");
void do_open_shell(void);
void do_host_kbd_enable(bool on);
+void do_interpolation_enable(bool on);
void do_ram_dump(void);
void do_guestmemory_dump(void);
RECV_RAM_DUMP = 18,
RECV_GUESTMEMORY_DUMP = 19,
RECV_ECP_PORT_REQ = 20,
+ RECV_INTERPOLATION_STATE = 21,
RECV_RESPONSE_HEART_BEAT = 900,
RECV_RESPONSE_DRAW_FRAME = 901,
}
break;
}
+ case RECV_INTERPOLATION_STATE: {
+ char on = 0;
+
+ log_cnt += sprintf(log_buf + log_cnt, "RECV_INTERPOLATION_STATE ==\n");
+ TRACE(log_buf);
+
+ if (length <= 0) {
+ INFO("there is no data looking at 0 length.\n");
+ continue;
+ }
+
+ memcpy(&on, recvbuf, sizeof(on));
+
+ if (on == 0) {
+ do_interpolation_enable(false);
+ } else {
+ do_interpolation_enable(true);
+ }
+
+ break;
+ }
case RECV_RESPONSE_DRAW_FRAME: {
pthread_mutex_lock(&mutex_draw_display);
draw_display_state = 0; /* framebuffer has been drawn */