summaryrefslogtreecommitdiff
path: root/tizen
diff options
context:
space:
mode:
authorGiWoong Kim <giwoong.kim@samsung.com>2014-04-24 17:05:46 +0900
committerGiWoong Kim <giwoong.kim@samsung.com>2014-04-28 22:10:35 -0700
commitc6fe128539ee7744589c323c720b285941b024a1 (patch)
tree2f91e9e06a5d7774b64970fa1e6c1d48193346e1 /tizen
parent35b6643e2993cef40d765e37d6d8d8006279c320 (diff)
downloadqemu-c6fe128539ee7744589c323c720b285941b024a1.tar.gz
qemu-c6fe128539ee7744589c323c720b285941b024a1.tar.bz2
qemu-c6fe128539ee7744589c323c720b285941b024a1.zip
display: add draw_image to maru_sdl
On Windows, the display off guide image can be rubbed out from display surface when emulator window comes from outside of host monitor bounds by dragging. So, to prevent this, display should not stop the updating while window dragging. Change-Id: If7de4b484014a9ac2b3476e2f548954117a15b8f Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com> (cherry picked from commit 924bba3123c788a034578b691cfd8f25e85798e9)
Diffstat (limited to 'tizen')
-rw-r--r--tizen/src/maru_sdl.c122
1 files changed, 65 insertions, 57 deletions
diff --git a/tizen/src/maru_sdl.c b/tizen/src/maru_sdl.c
index 7405981bc9..ed02c0fbb3 100644
--- a/tizen/src/maru_sdl.c
+++ b/tizen/src/maru_sdl.c
@@ -466,6 +466,57 @@ static SDL_Surface *get_blank_guide_image(void)
return surface_guide;
}
+static void draw_image(SDL_Surface *image)
+{
+ if (image == NULL || get_emul_skin_enable() == 0) {
+ return;
+ }
+
+ int dst_x = 0; int dst_y = 0;
+ int dst_w = 0; int dst_h = 0;
+
+ const unsigned int screen_width =
+ get_emul_resolution_width() * current_scale_factor;
+ const unsigned int screen_height =
+ get_emul_resolution_height() * current_scale_factor;
+
+ int margin_w = screen_width - image->w;
+ int margin_h = screen_height - image->h;
+
+ if (margin_w < 0 || margin_h < 0) {
+ /* guide image scaling */
+ int margin = (margin_w < margin_h)? margin_w : margin_h;
+ dst_w = image->w + margin;
+ dst_h = image->h + margin;
+
+ SDL_Surface *scaled_image = SDL_CreateRGBSurface(
+ SDL_SWSURFACE, dst_w, dst_h, get_emul_sdl_bpp(),
+ image->format->Rmask, image->format->Gmask,
+ image->format->Bmask, image->format->Amask);
+
+ scaled_image = maru_do_pixman_scale(
+ image, scaled_image, PIXMAN_FILTER_BEST);
+
+ 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 };
+
+ SDL_BlitSurface(scaled_image, NULL, surface_screen, &dst_rect);
+ SDL_UpdateRect(surface_screen, 0, 0, 0, 0);
+
+ SDL_FreeSurface(scaled_image);
+ } else {
+ dst_w = image->w;
+ dst_h = image->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 };
+
+ SDL_BlitSurface(image, NULL, surface_screen, &dst_rect);
+ SDL_UpdateRect(surface_screen, 0, 0, 0, 0);
+ }
+}
+
static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl)
{
if (sdl_alteration == 1) {
@@ -474,67 +525,25 @@ static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl)
sdl_skip_count = 0;
}
- /* If the display is turned off,
- the screen does not update until the display is turned on */
+ /* draw cover image */
if (sdl_skip_update && brightness_off) {
if (blank_cnt > MAX_BLANK_FRAME_CNT) {
- /* do nothing */
+#ifdef CONFIG_WIN32
+ if (sdl_invalidate) {
+ draw_image(get_blank_guide_image());
+ }
+#endif
+
return;
} else if (blank_cnt == MAX_BLANK_FRAME_CNT) {
if (blank_guide_enable == true) {
INFO("draw a blank guide image\n");
- SDL_Surface *guide = get_blank_guide_image();
- if (guide != NULL && get_emul_skin_enable() == 1) {
- /* draw guide image */
- int dst_x = 0; int dst_y = 0;
- int dst_w = 0; int dst_h = 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, 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, PIXMAN_FILTER_BEST);
-
- 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 };
-
- SDL_BlitSurface(scaled_guide, NULL,
- surface_screen, &dst_rect);
- SDL_UpdateRect(surface_screen, 0, 0, 0, 0);
-
- SDL_FreeSurface(scaled_guide);
- } else {
- dst_w = guide->w;
- dst_h = 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 };
-
- SDL_BlitSurface(guide, NULL,
- surface_screen, &dst_rect);
- SDL_UpdateRect(surface_screen, 0, 0, 0, 0);
- }
- }
+ draw_image(get_blank_guide_image());
}
} else if (blank_cnt == 0) {
+ /* If the display is turned off,
+ the screen does not update until the display is turned on */
INFO("skipping of the display updating is started\n");
}
@@ -548,6 +557,7 @@ static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl)
}
}
+ /* draw framebuffer */
if (sdl_invalidate) {
graphic_hw_invalidate(NULL);
}
@@ -790,8 +800,6 @@ static void maru_sdl_resize_bh(void *opaque)
static void maru_sdl_init_bh(void *opaque)
{
- SDL_SysWMinfo info;
-
INFO("SDL_Init\n");
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
@@ -799,7 +807,8 @@ static void maru_sdl_init_bh(void *opaque)
// TODO:
}
-#ifndef _WIN32
+#ifndef CONFIG_WIN32
+ SDL_SysWMinfo info;
SDL_VERSION(&info.version);
SDL_GetWMInfo(&info);
#endif
@@ -813,8 +822,7 @@ static void maru_sdl_init_bh(void *opaque)
INFO("sdl update thread create\n");
pthread_t thread_id;
- if (pthread_create(
- &thread_id, NULL, run_qemu_update, NULL) != 0) {
+ if (pthread_create(&thread_id, NULL, run_qemu_update, NULL) != 0) {
ERR("pthread_create fail\n");
return;
}