}
if (surface_qemu != NULL) {
- int i = 0;
-
maru_do_pixman_dpy_surface(dpy_surface->image);
+
set_maru_screenshot(dpy_surface);
if (current_scale_factor != 1.0) {
/* draw multi-touch finger points */
MultiTouchState *mts = get_emul_multi_touch_state();
if (mts->multitouch_enable != 0 && mts->finger_point_surface != NULL) {
+ int i = 0;
FingerPoint *finger = NULL;
int finger_point_size_half = mts->finger_point_size / 2;
SDL_Rect rect;
#include "emul_state.h"
#include "maruskin_keymap.h"
#include "maruskin_server.h"
+#include "maru_display.h"
#include "hw/maru_pm.h"
#include "ecs/ecs.h"
pthread_mutex_unlock(&mutex_screenshot);
}
-QemuSurfaceInfo *get_screenshot_info(void)
+QemuSurfaceInfo *request_screenshot(void)
{
- QemuSurfaceInfo *info =
- (QemuSurfaceInfo *)g_malloc0(sizeof(QemuSurfaceInfo));
- if (!info) {
- ERR("Fail to malloc for QemuSurfaceInfo.\n");
+ const int length = get_emul_resolution_width() * get_emul_resolution_height() * 4;
+ INFO("screenshot data length : %d\n", length);
+
+ if (0 >= length) {
return NULL;
}
- int length = get_emul_resolution_width() * get_emul_resolution_height() * 4;
- INFO("screenshot data length:%d\n", length);
-
- if (0 >= length) {
- g_free(info);
- ERR("screenshot data ( 0 >=length ). length:%d\n", length);
+ QemuSurfaceInfo *info = (QemuSurfaceInfo *)g_malloc0(sizeof(QemuSurfaceInfo));
+ if (!info) {
+ ERR("Fail to malloc for QemuSurfaceInfo.\n");
return NULL;
}
return NULL;
}
- /* If the LCD is turned off, return empty buffer.
+ /* If display has been turned off, return empty buffer.
Because the empty buffer is seen as a black. */
- if (brightness_off) {
- info->pixel_data_length = length;
- return info;
- }
+ if (brightness_off == 0) {
+ pthread_mutex_lock(&mutex_screenshot);
- pthread_mutex_lock(&mutex_screenshot);
- MaruScreenshot* maru_screenshot = get_maru_screenshot();
- if (!maru_screenshot || maru_screenshot->isReady != 1) {
- ERR("maru screenshot is NULL or not ready.\n");
- memset(info->pixel_data, 0x00, length);
- } else {
- maru_screenshot->pixel_data = info->pixel_data;
- maru_screenshot->request_screenshot = 1;
- pthread_cond_wait(&cond_screenshot, &mutex_screenshot);
+ MaruScreenshot* maru_screenshot = get_maru_screenshot();
+ if (!maru_screenshot || maru_screenshot->isReady != 1) {
+ ERR("maru screenshot is NULL or not ready.\n");
+ memset(info->pixel_data, 0x00, length);
+ } else {
+ maru_screenshot->pixel_data = info->pixel_data;
+ maru_screenshot->request_screenshot = 1;
+ maru_display_update();
+
+ // TODO : do not wait on communication thread
+ pthread_cond_wait(&cond_screenshot, &mutex_screenshot);
+ }
+
+ pthread_mutex_unlock(&mutex_screenshot);
}
- pthread_mutex_unlock(&mutex_screenshot);
info->pixel_data_length = length;
extern int ret_hax_init;
-struct QemuSurfaceInfo {
+typedef struct ScreenShot {
unsigned char* pixel_data;
int pixel_data_length;
-};
-typedef struct QemuSurfaceInfo QemuSurfaceInfo;
+} QemuSurfaceInfo;
-struct DetailInfo {
+typedef struct DetailInfo {
char* data;
int data_length;
-};
-typedef struct DetailInfo DetailInfo;
+} DetailInfo;
void start_display(uint64 handle_id,
unsigned int display_width, unsigned int display_height,
void do_scale_event(double scale_factor);
void do_rotation_event(int rotation_type);
-QemuSurfaceInfo *get_screenshot_info(void);
+QemuSurfaceInfo *request_screenshot(void);
DetailInfo *get_detail_info(int qemu_argc, char **qemu_argv);
void free_detail_info(DetailInfo *detail_info);
void free_screenshot_info(QemuSurfaceInfo *);
log_cnt += sprintf(log_buf + log_cnt, "RECV_SCREENSHOT_REQ ==\n");
TRACE(log_buf);
- QemuSurfaceInfo* info = get_screenshot_info();
+ QemuSurfaceInfo* screenshot = request_screenshot();
- if (info) {
+ if (screenshot != NULL) {
send_skin_data(client_sock, SEND_SCREENSHOT_DATA,
- info->pixel_data, info->pixel_data_length, 1);
- free_screenshot_info(info);
+ screenshot->pixel_data, screenshot->pixel_data_length, 1);
+
+ free_screenshot_info(screenshot);
} else {
ERR("Fail to get screen shot data\n");
}