multitouch: rearrange finger image when rotate
authormunkyu.im <munkyu.im@samsung.com>
Thu, 29 Nov 2012 05:49:10 +0000 (14:49 +0900)
committermunkyu.im <munkyu.im@samsung.com>
Thu, 29 Nov 2012 05:49:10 +0000 (14:49 +0900)
fix finger image position when rotate emulator

Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
package/changelog
package/pkginfo.manifest
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorFingers.java
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java

index a7e67ba..172ddf7 100644 (file)
@@ -1,3 +1,6 @@
+* 1.4.15
+- rearrange finger image when rotate
+== Munkyu In <munkyu.im@samsung.com> 2012-11-29
 * 1.4.14
 - remove unnecessary double quotation mark
 == Munkyu In <munkyu.im@samsung.com> 2012-11-29
index 7ca5f76..68cf337 100644 (file)
@@ -1,4 +1,4 @@
-Version: 1.4.14
+Version: 1.4.15
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
 Source: emulator
 
index 3463e28..93f80cf 100644 (file)
@@ -180,6 +180,9 @@ public class EmulatorFingers {
                for(int i=0; i < this.fingerCnt; i++) {
                        this.fingerSlot = this.getFingerPointFromSlot(i);       
                        e.gc.setAlpha(0x7E);
+               //      logger.info("OriginX: "+ this.fingerSlot.originX + ",OriginY: " + (this.fingerSlot.originY));
+               //      logger.info("x: "+ this.fingerSlot.x + ",y: " + (this.fingerSlot.y));
+                       
                        e.gc.drawImage(this.fingerSlotimage, 
                                        this.fingerSlot.originX - fingerPointSizeHalf - 2,
                                        this.fingerSlot.originY - fingerPointSizeHalf - 2);
@@ -199,7 +202,7 @@ public class EmulatorFingers {
                        finger.x = x;
                        finger.y = y;
                        if (finger.id != 0) {
-                               //logger.info(String.format("id %d finger multi-touch dragging = (%d, %d)", this.grabFingerID, x, y));
+                               logger.info(String.format("id %d finger multi-touch dragging = (%d, %d)", this.grabFingerID, x, y));
                                mouseEventData = new MouseEventData(
                                                                MouseButtonType.LEFT.value(), MouseEventType.PRESS.value(),
                                                                originX, originY, x, y, grabFingerID -1);
@@ -362,26 +365,35 @@ public class EmulatorFingers {
            
                int pointX, pointY, rotatedPointX, rotatedPointY, flag;
            flag = 0;
-
+//         logger.info("ScaledLcdWitdh:"+ScaledLcdWitdh+" ScaledLcdHeight:"+ScaledLcdHeight+ " scaleFactor:"+ scaleFactor+" rotationType:"+rotationType);
            rotatedPointX = pointX = (int)(finger.x * scaleFactor);
            rotatedPointY = pointY = (int)(finger.y * scaleFactor);
-
+//         logger.info("rotatedPointX:"+rotatedPointX+" rotatedPointY:"+rotatedPointY);
            if (rotationType == RotationInfo.LANDSCAPE.id()) {
+               logger.info("LANDSCAPE");
                rotatedPointX = pointY;
                rotatedPointY = ScaledLcdWitdh - pointX;
            } else if (rotationType == RotationInfo.REVERSE_PORTRAIT.id()) {
+               logger.info("REVERSE_PORTRAIT");
                rotatedPointX = ScaledLcdWitdh - pointX;
                rotatedPointY = ScaledLcdHeight - pointY;
            } else if (rotationType == RotationInfo.REVERSE_LANDSCAPE.id()) {
+               logger.info("REVERSE_LANDSCAPE");
                rotatedPointX = ScaledLcdHeight - pointY;
                rotatedPointY = pointX;
+           } else {
+               logger.info("PORTRAITE");
+               
            }
+               
 
            if (finger.originX != rotatedPointX) {
+               logger.info("finger.originX: " +finger.originX);
                finger.originX = rotatedPointX;
                flag = 1;
            }
            if (finger.originY != rotatedPointY) {
+               logger.info("finger.originY: " +finger.originY);
                finger.originY = rotatedPointY;
                flag = 1;
            }
@@ -401,7 +413,7 @@ public class EmulatorFingers {
            if (this.multiTouchEnable == 0) {                                            
                return 0;                                                                 
            }                                                                             
-                                                                                         
+           scaleFactor = scaleFactor/100;                                                                              
            lcdWidth *= scaleFactor;                                                        
            lcdHeight *= scaleFactor;                                                        
                                                                                          
index b3dbc7d..647e4bd 100644 (file)
@@ -176,11 +176,18 @@ public class EmulatorShmSkin extends EmulatorSkin {
                                                        0, 0, pollThread.lcdWidth, pollThread.lcdHeight,
                                                        0, 0, x, y);
                                        
+                                       if (finger.getMultiTouchEnable() == 1) {
+                                               finger.rearrangeFingerPoints(currentState.getCurrentResolutionWidth(), 
+                                                               currentState.getCurrentResolutionHeight(), 
+                                                               currentState.getCurrentScale(), 
+                                                               currentState.getCurrentRotationId());
+                                       }
                     finger.drawImage(e, currentState.getCurrentAngle());
                                        return;
                                }
 
                                Transform transform = new Transform(lcdCanvas.getDisplay());
+                               Transform oldtransform = new Transform(lcdCanvas.getDisplay());
                                transform.rotate(currentState.getCurrentAngle());
 
                                if (currentState.getCurrentAngle() == 90) { /* reverse landscape */
@@ -198,22 +205,29 @@ public class EmulatorShmSkin extends EmulatorSkin {
                                        y = temp;
                                        transform.translate(x * -1, 0);
                                }
-
+                               
+                               //draw finger image
+                               //for when rotate while use multi touch
+                               if (finger.getMultiTouchEnable() == 1) {
+                                       finger.rearrangeFingerPoints(currentState.getCurrentResolutionWidth(), 
+                                                       currentState.getCurrentResolutionHeight(), 
+                                                       currentState.getCurrentScale(), 
+                                                       currentState.getCurrentRotationId());
+                               }       
+                               //save current transform as "oldtransform" 
+                               e.gc.getTransform(oldtransform);
+                               //set to new transfrom
                                e.gc.setTransform(transform);
                                e.gc.drawImage(pollThread.framebuffer,
                                                0, 0, pollThread.lcdWidth, pollThread.lcdHeight,
                                                0, 0, x, y);
-                               finger.drawImage(e, currentState.getCurrentAngle());
+                               //back to old transform
+                               e.gc.setTransform(oldtransform);
+                               
                                transform.dispose();
+                               finger.drawImage(e, currentState.getCurrentAngle());
                        }
                });
-
-               if (finger.getMultiTouchEnable() == -1) {
-                       finger.rearrangeFingerPoints(currentState.getCurrentResolutionWidth(), 
-                                       currentState.getCurrentResolutionHeight(), 
-                                       currentState.getCurrentScale(), 
-                                       currentState.getCurrentRotationId());
-               }
         
         pollThread.start();