display : modified the screenshot process
authorjinhyung.jo <jinhyung.jo@samsung.com>
Thu, 11 Jul 2013 07:48:38 +0000 (16:48 +0900)
committerjinhyung.jo <jinhyung.jo@samsung.com>
Thu, 11 Jul 2013 07:48:38 +0000 (16:48 +0900)
The brightness level and the overlay area are applied to the screenshot
Remove unnecessary code

Change-Id: I7635acdc7b5b96203e766ca388f6c956aeb55209
Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com>
tizen/src/maru_display.c
tizen/src/maru_display.h
tizen/src/maru_sdl.c
tizen/src/maru_sdl.h
tizen/src/maru_shm.c
tizen/src/skin/maruskin_operation.c

index ae5c4bee75dc35637e80a5c54ec648ecd38417c5..827a7316b82eff5af3475107dffcc9153470b6ab 100644 (file)
@@ -88,17 +88,8 @@ void maruskin_init(uint64 swt_handle,
 #endif
 }
 
-DisplaySurface* get_qemu_display_surface(void) {
-#ifndef CONFIG_USE_SHM
-    return maruskin_sdl_get_display();
-#else
-    //TODO:
-#endif
-
-    return NULL;
-}
-
-MaruScreenshot* get_maru_screenshot(void) {
+MaruScreenshot *get_maru_screenshot(void)
+{
     return maru_screenshot;
 }
-
+/* set_maru_screenshot() implemented in maruskin_operation.c */
index 595ffa8b7b49135336bc4faeb1bc2cc797f532a5..75760b46793b5c11531d58c7a17884cf5a7fdbb8 100644 (file)
@@ -41,8 +41,10 @@ typedef struct 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);
+void maruskin_init(uint64 swt_handle, int lcd_size_width,
+                   int lcd_size_height, bool is_resize);
+
+MaruScreenshot *get_maru_screenshot(void);
+void set_maru_screenshot(DisplaySurface *surface);
 
 #endif /* __MARU_DISPLAY_H__ */
index 7925c67460f4c9f38ed4a501c37195a1f5c576ad..4e300c1bcdb5eec32118c904e30095e716a6e403 100644 (file)
@@ -44,7 +44,7 @@
 
 MULTI_DEBUG_CHANNEL(tizen, maru_sdl);
 
-DisplaySurface *qemu_display_surface = NULL;
+static DisplaySurface *dpy_surface;
 
 static SDL_Surface *surface_screen;
 static SDL_Surface *surface_qemu;
@@ -75,14 +75,11 @@ static pthread_cond_t sdl_cond = PTHREAD_COND_INITIALIZER;
 static int sdl_thread_initialized;
 #endif
 
-extern pthread_mutex_t mutex_screenshot;
-extern pthread_cond_t cond_screenshot;
-
 #define SDL_FLAGS (SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_NOFRAME)
 #define SDL_BPP 32
 
 /* Image processing functions using the pixman library */
-static void maru_do_pixman_sdl(pixman_image_t *dst_image)
+static void maru_do_pixman_dpy_surface(pixman_image_t *dst_image)
 {
     /* overlay0 */
     if (overlay0_power) {
@@ -218,26 +215,6 @@ static void qemu_ds_sdl_update(DisplayChangeListener *dcl,
 #else
     qemu_update();
 #endif
-
-    /* for screenshot */
-    pthread_mutex_lock(&mutex_screenshot);
-
-    MaruScreenshot* maru_screenshot = get_maru_screenshot();
-    if (maru_screenshot) {
-        maru_screenshot->isReady = 1;
-
-        if (maru_screenshot->request_screenshot == 1) {
-            memcpy(maru_screenshot->pixel_data,
-                   surface_data(qemu_display_surface),
-                   surface_stride(qemu_display_surface) *
-                   surface_height(qemu_display_surface));
-            maru_screenshot->request_screenshot = 0;
-
-            pthread_cond_signal(&cond_screenshot);
-        }
-    }
-
-    pthread_mutex_unlock(&mutex_screenshot);
 }
 
 static void qemu_ds_sdl_switch(DisplayChangeListener *dcl,
@@ -250,7 +227,7 @@ static void qemu_ds_sdl_switch(DisplayChangeListener *dcl,
         return;
     }
 
-    qemu_display_surface = new_surface;
+    dpy_surface = new_surface;
     w = surface_width(new_surface);
     h = surface_height(new_surface);
 
@@ -270,19 +247,19 @@ static void qemu_ds_sdl_switch(DisplayChangeListener *dcl,
         INFO("create SDL screen = (%d, %d)\n",
              get_emul_lcd_width(), get_emul_lcd_height());
         surface_qemu = SDL_CreateRGBSurfaceFrom(
-            surface_data(qemu_display_surface),
+            surface_data(dpy_surface),
             w, h,
-            surface_bits_per_pixel(qemu_display_surface),
-            surface_stride(qemu_display_surface),
-            qemu_display_surface->pf.rmask,
-            qemu_display_surface->pf.gmask,
-            qemu_display_surface->pf.bmask,
-            qemu_display_surface->pf.amask);
+            surface_bits_per_pixel(dpy_surface),
+            surface_stride(dpy_surface),
+            dpy_surface->pf.rmask,
+            dpy_surface->pf.gmask,
+            dpy_surface->pf.bmask,
+            dpy_surface->pf.amask);
     } else {
         INFO("create blank screen = (%d, %d)\n",
              get_emul_lcd_width(), get_emul_lcd_height());
         surface_qemu = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
-            surface_bits_per_pixel(qemu_display_surface), 0, 0, 0, 0);
+            surface_bits_per_pixel(dpy_surface), 0, 0, 0, 0);
     }
 
 #ifdef SDL_THREAD
@@ -617,7 +594,8 @@ static void qemu_update(void)
         else
         { //sdl surface
 #endif
-            maru_do_pixman_sdl(qemu_display_surface->image);
+            maru_do_pixman_dpy_surface(dpy_surface->image);
+            set_maru_screenshot(dpy_surface);
             if (current_scale_factor != 1.0) {
                 rotated_screen = maru_do_pixman_rotate(
                     surface_qemu, rotated_screen,
@@ -767,8 +745,3 @@ void maruskin_sdl_resize(void)
     and can be called from other threads safely. */
     SDL_PushEvent(&ev);
 }
-
-DisplaySurface *maruskin_sdl_get_display(void) {
-    return qemu_display_surface;
-}
-
index d2d8f8f85c9646f7065661cbb01764062ab65e57..ac86875660570448a1cff15a3650cb292dbb992e 100644 (file)
@@ -42,6 +42,4 @@ void maruskin_sdl_init(uint64 swt_handle, int lcd_size_width, int lcd_size_heigh
 void maruskin_sdl_resize(void);
 void maruskin_sdl_quit(void);
 
-DisplaySurface* maruskin_sdl_get_display(void);
-
 #endif /* MARU_SDL_H_ */
index 406a035044e2e1841e8d77c34b99021995d193be..64293c8f97a20d8b01fac03759fe75cbcac794ee 100644 (file)
@@ -42,8 +42,8 @@
 
 MULTI_DEBUG_CHANNEL(tizen, maru_shm);
 
-static DisplaySurface *shm_surface;
-static void *shared_memory = (void*) 0;
+static DisplaySurface *dpy_surface;
+static void *shared_memory = (void *) 0;
 static int skin_shmid;
 
 static int shm_skip_update;
@@ -57,29 +57,30 @@ static unsigned int draw_frame;
 static unsigned int drop_frame;
 #endif
 
-static void maru_do_pixman_shm(void)
+/* Image processing functions using the pixman library */
+static void maru_do_pixman_dpy_surface(pixman_image_t *dst_image)
 {
     /* overlay0 */
     if (overlay0_power) {
         pixman_image_composite(PIXMAN_OP_OVER,
-                               overlay0_image, NULL, shm_surface->image,
+                               overlay0_image, NULL, dst_image,
                                0, 0, 0, 0, overlay0_left, overlay0_top,
                                overlay0_width, overlay0_height);
     }
     /* overlay1 */
     if (overlay1_power) {
         pixman_image_composite(PIXMAN_OP_OVER,
-                               overlay1_image, NULL, shm_surface->image,
+                               overlay1_image, NULL, dst_image,
                                0, 0, 0, 0, overlay1_left, overlay1_top,
                                overlay1_width, overlay1_height);
     }
     /* apply the brightness level */
     if (brightness_level < BRIGHTNESS_MAX) {
         pixman_image_composite(PIXMAN_OP_OVER,
-                               brightness_image, NULL, shm_surface->image,
+                               brightness_image, NULL, dst_image,
                                0, 0, 0, 0, 0, 0,
-                               surface_width(shm_surface),
-                               surface_height(shm_surface));
+                               pixman_image_get_width(dst_image),
+                               pixman_image_get_height(dst_image));
     }
 }
 
@@ -92,11 +93,11 @@ static void qemu_ds_shm_update(DisplayChangeListener *dcl,
         if (draw_display_state == 0) {
             draw_display_state = 1;
             pthread_mutex_unlock(&mutex_draw_display);
-            maru_do_pixman_shm();
+            maru_do_pixman_dpy_surface(dpy_surface->image);
             memcpy(shared_memory,
-                   surface_data(shm_surface),
-                   surface_stride(shm_surface) *
-                   surface_height(shm_surface));
+                   surface_data(dpy_surface),
+                   surface_stride(dpy_surface) *
+                   surface_height(dpy_surface));
 #ifdef INFO_FRAME_DROP_RATE
             draw_frame++;
 #endif
@@ -120,7 +121,7 @@ static void qemu_ds_shm_switch(DisplayChangeListener *dcl,
     TRACE("qemu_ds_shm_switch\n");
 
     if (new_surface) {
-        shm_surface = new_surface;
+        dpy_surface = new_surface;
     }
 
     shm_skip_update = 0;
index 8aaf53545697ff63480d251db544a707a84396e6..8a8aae02ded2b6e23903f972ffb896919feb1cef 100644 (file)
@@ -335,35 +335,47 @@ void send_rotation_event(int rotation_type)
     send_to_emuld( "sensor\n\n\n\n", 10, send_buf, 32 );
 }
 
-QemuSurfaceInfo* get_screenshot_info(void)
+void set_maru_screenshot(DisplaySurface *surface)
 {
-#if 0
-    DisplaySurface* qemu_display_surface = get_qemu_display_surface();
+    pthread_mutex_lock(&mutex_screenshot);
 
-    if ( !qemu_display_surface ) {
-        ERR( "qemu surface is NULL.\n" );
-        return NULL;
+    MaruScreenshot *maru_screenshot = get_maru_screenshot();
+    if (maru_screenshot) {
+        maru_screenshot->isReady = 1;
+        if (maru_screenshot->request_screenshot == 1) {
+            memcpy(maru_screenshot->pixel_data,
+                   surface_data(surface),
+                   surface_stride(surface) *
+                   surface_height(surface));
+            maru_screenshot->request_screenshot = 0;
+
+            pthread_cond_signal(&cond_screenshot);
+        }
     }
-#endif
+    pthread_mutex_unlock(&mutex_screenshot);
+}
 
-    QemuSurfaceInfo* info = (QemuSurfaceInfo*) g_malloc0( sizeof(QemuSurfaceInfo) );
-    if ( !info ) {
-        ERR( "Fail to malloc for QemuSurfaceInfo.\n");
+QemuSurfaceInfo *get_screenshot_info(void)
+{
+    QemuSurfaceInfo *info =
+            (QemuSurfaceInfo *)g_malloc0(sizeof(QemuSurfaceInfo));
+    if (!info) {
+        ERR("Fail to malloc for QemuSurfaceInfo.\n");
         return NULL;
     }
 
     int length = get_emul_lcd_width() * get_emul_lcd_height() * 4;
-    INFO( "screenshot data length:%d\n", length );
+    INFO("screenshot data length:%d\n", length);
 
-    if ( 0 >= length ) {
-        g_free( info );
-        ERR( "screenshot data ( 0 >=length ). length:%d\n", length );
+    if (0 >= length) {
+        g_free(info);
+        ERR("screenshot data ( 0 >=length ). length:%d\n", length);
         return NULL;
     }
 
-    info->pixel_data = (unsigned char*) g_malloc0( length );
-    if ( !info->pixel_data ) {
-        g_free( info );
+    info->pixel_data = (unsigned char *)g_malloc0(length);
+    if (!info->pixel_data) {
+        g_free(info);
         ERR("Fail to malloc for pixel data.\n");
         return NULL;
     }
@@ -392,7 +404,7 @@ QemuSurfaceInfo* get_screenshot_info(void)
     return info;
 }
 
-void free_screenshot_info(QemuSurfaceInfoinfo)
+void free_screenshot_info(QemuSurfaceInfo *info)
 {
     if (info) {
         if(info->pixel_data) {