[Title] added rotation feature
authorgiwoong.kim <giwoong.kim@samsung.com>
Sat, 17 Mar 2012 05:20:37 +0000 (14:20 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Sat, 17 Mar 2012 05:20:37 +0000 (14:20 +0900)
[Type]
[Module] Emulator
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

tizen/src/emul_state.c
tizen/src/emul_state.h
tizen/src/emulator.c
tizen/src/emulator.h
tizen/src/maru_sdl.c
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRotation.java
tizen/src/skin/maruskin_operation.c
tizen/src/skin/maruskin_operation.h [changed mode: 0755->0644]
tizen/src/skin/maruskin_server.c

index 3705222..a6e6c09 100644 (file)
@@ -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;
 }
index 4ed2fc7..c8bee0d 100644 (file)
@@ -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__ */
index cf03876..1c50b7d 100644 (file)
@@ -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");
 
index 5bdd1e7..d62a41a 100644 (file)
  *
  */
 
-/**
- * @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);
index cf6d1bc..af32767 100644 (file)
@@ -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);
index c7e9919..444ec7a 100644 (file)
@@ -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;
index 3a0bc87..b95b673 100644 (file)
@@ -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);
 }
old mode 100755 (executable)
new mode 100644 (file)
index 2e7febe..76871b4 100644 (file)
@@ -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 );