From: giwoong.kim Date: Sat, 17 Mar 2012 05:20:37 +0000 (+0900) Subject: [Title] added rotation feature X-Git-Tag: TizenStudio_2.0_p2.3~1661 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a0c0550013f11626a98042d591b3f68d1a0b573;p=sdk%2Femulator%2Fqemu.git [Title] added rotation feature [Type] [Module] Emulator [Priority] [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 3705222..a6e6c09 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -71,13 +71,13 @@ int get_emul_win_scale(void) } /* emulator rotation */ -void set_emul_rotation(int rotation) +void set_emul_rotation(short rotation) { _emul_state.rotation = rotation; INFO("emulator rotation = %d\n", _emul_state.rotation); } -int get_emul_rotation(void) +short get_emul_rotation(void) { return _emul_state.rotation; } diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index 4ed2fc7..c8bee0d 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -42,7 +42,7 @@ typedef struct emulator_config_info { typedef struct emulator_config_state { int scale; - int rotation; + short rotation; //TODO: } emulator_config_state; @@ -50,13 +50,13 @@ typedef struct emulator_config_state { /* setter */ void set_emul_lcd_size(int width, int height); void set_emul_win_scale(int scale); -void set_emul_rotation(int scale); +void set_emul_rotation(short scale); /* getter */ int get_emul_lcd_width(void); int get_emul_lcd_height(void); int get_emul_win_scale(void); -int get_emul_rotation(void); +short get_emul_rotation(void); #endif /* __EMUL_STATE_H__ */ diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index cf03876..1c50b7d 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -207,7 +207,7 @@ void extract_info(int qemu_argc, char** qemu_argv) static int skin_argc = 0; static char** skin_argv = NULL; -void prepare_maru() +void prepare_maru(void) { INFO("Prepare maru specified feature\n"); diff --git a/tizen/src/emulator.h b/tizen/src/emulator.h index 5bdd1e7..d62a41a 100644 --- a/tizen/src/emulator.h +++ b/tizen/src/emulator.h @@ -29,14 +29,19 @@ * */ -/** - * @file emulator.h - * @brief - header of file these are config struecture and defines in emulator - */ #ifndef __EMULATOR_H__ #define __EMULATOR_H__ + +enum { + ROTATION_PORTRAIT = 0, + ROTATION_LANDSCAPE = 1, + ROTATION_REVERSE_PORTRAIT = 2, + ROTATION_REVERSE_LANDSCAPE = 3, +}; + + int get_emulator_condition(void); void set_emulator_condition(int state); void exit_emulator(void); diff --git a/tizen/src/maru_sdl.c b/tizen/src/maru_sdl.c index cf6d1bc..af32767 100644 --- a/tizen/src/maru_sdl.c +++ b/tizen/src/maru_sdl.c @@ -53,9 +53,20 @@ static void qemu_update(void) #ifndef SDL_THREAD pthread_mutex_lock(&sdl_mutex); #endif - SDL_Surface *processing_screen; - processing_screen = rotozoomSurface(surface_qemu, 0.0, ((double)get_emul_win_scale()) / 100, 1); + double angle = 0.0; + +//TODO: convert type define to angle value + short rotaton_type = get_emul_rotation(); + if (rotaton_type == 1) { + angle = 90.0; + } else if (rotaton_type == 2) { + angle = 180.0; + } else if (rotaton_type == 3) { + angle = 270.0; + } + + processing_screen = rotozoomSurface(surface_qemu, angle, ((double)get_emul_win_scale()) / 100, 1); SDL_BlitSurface(processing_screen, NULL, surface_screen, NULL); SDL_UpdateRect(surface_screen, 0, 0, 0, 0); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRotation.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRotation.java index c7e9919..444ec7a 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRotation.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRotation.java @@ -48,8 +48,8 @@ public class SkinRotation { public enum RotationInfo { PORTRAIT( RotationNameType.PORTRAIT.value(), (short)0, 0 ), - REVERSE_PORTRAIT( RotationNameType.REVERSE_PORTRAIT.value(), (short)1, 180 ), - LANDSCAPE( RotationNameType.LANDSCAPE.value(), (short)2, -90 ), + LANDSCAPE( RotationNameType.LANDSCAPE.value(), (short)1, -90 ), + REVERSE_PORTRAIT( RotationNameType.REVERSE_PORTRAIT.value(), (short)2, 180 ), REVERSE_LANDSCAPE( RotationNameType.REVERSE_LANDSCAPE.value(), (short)3, 90 ); private String value; diff --git a/tizen/src/skin/maruskin_operation.c b/tizen/src/skin/maruskin_operation.c index 3a0bc87..b95b673 100644 --- a/tizen/src/skin/maruskin_operation.c +++ b/tizen/src/skin/maruskin_operation.c @@ -144,9 +144,8 @@ void do_hardkey_event( int event_type, int keycode ) { void do_scale_event( int event_type) { INFO( "do_scale_event event_type:%d", event_type); - //double scale_factor = event_type / 100; //TODO: define - //TODO: + //TODO: qemu refresh set_emul_win_scale(event_type); } diff --git a/tizen/src/skin/maruskin_operation.h b/tizen/src/skin/maruskin_operation.h old mode 100755 new mode 100644 diff --git a/tizen/src/skin/maruskin_server.c b/tizen/src/skin/maruskin_server.c index 2e7febe..76871b4 100644 --- a/tizen/src/skin/maruskin_server.c +++ b/tizen/src/skin/maruskin_server.c @@ -438,7 +438,7 @@ static void* run_skin_server( void* args ) { } int scale = 0; - int rotation = 0; + short rotation = 0; char* p = readbuf; memcpy( &scale, p, sizeof( scale ) ); @@ -446,7 +446,7 @@ static void* run_skin_server( void* args ) { memcpy( &rotation, p, sizeof( rotation ) ); scale = ntohl( scale ); - rotation = ntohl( rotation ); + rotation = ntohs( rotation ); if ( get_emul_win_scale() != scale ) { do_scale_event( scale );