Fixed a problem about displayed useless line on screenshot
authorsungmin ha <sungmin82.ha@samsung.com>
Wed, 16 Jan 2013 05:48:31 +0000 (14:48 +0900)
committersungmin ha <sungmin82.ha@samsung.com>
Wed, 16 Jan 2013 05:48:31 +0000 (14:48 +0900)
package/changelog
package/pkginfo.manifest
tizen/src/hw/maru_vga.c
tizen/src/maru_display.c
tizen/src/maru_display.h
tizen/src/skin/maruskin_operation.c
tizen/src/skin/maruskin_server.c

index 09e73b3..f5ee4d1 100644 (file)
@@ -1,3 +1,6 @@
+* 1.4.60
+- Fixed a problem about displayed useless line on screenshot
+== Sungmin Ha <sungmin82.ha@samsung.com> 2013-01-16
 * 1.4.59
 - removed setFocus on mac
 == GiWoong Kim <giwoong.kim@samsung.com> 2013-01-16
index 12e77e1..c9d09bb 100644 (file)
@@ -1,4 +1,4 @@
-Version: 1.4.59
+Version: 1.4.60
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
 Source: emulator
 
index c52f8ec..687ee4c 100644 (file)
 #include "maru_vga_int.h"
 #include "maru_brightness.h"
 #include "maru_overlay.h"
+#include "maru_display.h"
 #include "emul_state.h"
 #include "debug_ch.h"
+#include <pthread.h>
 
 #ifdef USE_SHM
 #include "emulator.h"
@@ -66,6 +68,8 @@ void *shared_memory = (void*)0;
 
 MULTI_DEBUG_CHANNEL(qemu, maru_vga);
 
+extern pthread_mutex_t mutex_screenshot;
+extern pthread_cond_t cond_screenshot;
 
 //#define DEBUG_VGA
 //#define DEBUG_VGA_MEM
@@ -1495,6 +1499,22 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
             addr1 = 0;
         d += linesize;
     }
+
+    /* for screenshot */
+    pthread_mutex_lock(&mutex_screenshot);
+    MaruScreenshot* maru_screenshot = get_maru_screenshot();
+    if ( !maru_screenshot ) {
+        ERR( "maru screenshot is NULL.\n" );
+    } else {
+        if (maru_screenshot->request_screenshot == 1) {
+            memcpy(maru_screenshot->pixel_data, s->ds->surface->data, 
+                s->ds->surface->linesize * s->ds->surface->height);
+            maru_screenshot->request_screenshot = 0;
+            pthread_cond_signal(&cond_screenshot);
+        }
+    }
+    pthread_mutex_unlock(&mutex_screenshot);
+
     if (y_start >= 0) {
         /* flush to display */
         dpy_update(s->ds, 0, y_start,
index 99358cd..3f4e1fd 100644 (file)
@@ -46,6 +46,7 @@
 
 MULTI_DEBUG_CHANNEL(tizen, display);
 
+MaruScreenshot* maru_screenshot = NULL;
 
 //TODO: interface
 void maru_display_init(DisplayState *ds)
@@ -69,12 +70,16 @@ void maru_display_init(DisplayState *ds)
 #endif
 
     register_displaychangelistener(ds, dcl);
+
+    maru_screenshot = g_malloc0(sizeof(MaruScreenshot));
+    maru_screenshot->pixel_data = NULL;
+    maru_screenshot->request_screenshot = 0;
 }
 
 void maru_display_fini(void)
 {
     INFO("fini qemu display\n");
-
+    g_free(maru_screenshot);
 #ifndef USE_SHM
     maruskin_sdl_quit();
 #else
@@ -101,3 +106,13 @@ DisplaySurface* get_qemu_display_surface(void) {
     return NULL;
 }
 
+MaruScreenshot* get_maru_screenshot(void) {
+#ifndef USE_SHM
+    return maru_screenshot;
+#else
+    //TODO:
+#endif
+
+    return NULL;
+}
+
index d0d3c31..617330b 100644 (file)
 
 #include "console.h"
 
+typedef struct MaruScreenshot {
+    unsigned char *pixel_data;
+    int request_screenshot;
+} MaruScreenshot;
 
 void maru_display_init(DisplayState *ds);
 void maru_display_fini(void);
 void maruskin_init(uint64 swt_handle, int lcd_size_width, int lcd_size_height, bool is_resize);
 DisplaySurface* get_qemu_display_surface(void);
+MaruScreenshot* get_maru_screenshot(void);
 
 #endif /* MARU_DISPLAY_H_ */
index ffc7e3a..5e66caa 100644 (file)
@@ -61,7 +61,6 @@
 
 MULTI_DEBUG_CHANNEL(qemu, skin_operation);
 
-
 #define RESUME_KEY_SEND_INTERVAL 500 // milli-seconds
 #define CLOSE_POWER_KEY_INTERVAL 1200 // milli-seconds
 #define DATA_DELIMITER "#" // in detail info data
@@ -74,6 +73,8 @@ static int guest_x, guest_y;
 static int pressing_x = -1, pressing_y = -1;
 static int pressing_origin_x = -1, pressing_origin_y = -1;
 
+extern pthread_mutex_t mutex_screenshot;
+extern pthread_cond_t cond_screenshot;
 
 static void* run_timed_shutdown_thread(void* args);
 static void send_to_emuld(const char* request_type, int request_size, const char* send_buf, int buf_size);
@@ -356,11 +357,20 @@ QemuSurfaceInfo* get_screenshot_info(void)
         return NULL;
     }
 
-    memcpy( info->pixel_data, qemu_display_surface->data, length );
+    pthread_mutex_lock(&mutex_screenshot);
+    MaruScreenshot* maru_screenshot = get_maru_screenshot();
+    if ( !maru_screenshot ) {
+        ERR( "maru screenshot is NULL.\n" );
+        return NULL;
+    }
+    maru_screenshot->pixel_data = info->pixel_data;
+    maru_screenshot->request_screenshot = 1;
+    pthread_cond_wait(&cond_screenshot, &mutex_screenshot);
+    pthread_mutex_unlock(&mutex_screenshot);
+
     info->pixel_data_length = length;
 
     return info;
-
 }
 
 void free_screenshot_info(QemuSurfaceInfo* info)
index 569c6ea..ba07207 100644 (file)
@@ -74,7 +74,6 @@
 
 MULTI_DEBUG_CHANNEL(qemu, skin_server);
 
-
 #define MAX_REQ_ID 0x7fffffff
 #define RECV_BUF_SIZE 32
 #define RECV_HEADER_SIZE 12
@@ -133,6 +132,9 @@ enum {
     SEND_SHUTDOWN = 999,
 };
 
+pthread_mutex_t mutex_screenshot = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t cond_screenshot = PTHREAD_COND_INITIALIZER;
+
 static int seq_req_id = 0;
 
 static uint16_t svr_port = 0;
@@ -245,6 +247,9 @@ void shutdown_skin_server(void)
         }
     }
 
+    pthread_cond_destroy(&cond_screenshot);
+    pthread_mutex_destroy(&mutex_screenshot);
+
     stop_server = 1;
     is_force_close_client = 1;