OSDN Git Service

Took out aspect ratio switching.
authorRuben Brunk <rubenbrunk@google.com>
Wed, 24 Oct 2012 18:05:45 +0000 (11:05 -0700)
committerRuben Brunk <rubenbrunk@google.com>
Wed, 24 Oct 2012 18:45:24 +0000 (11:45 -0700)
Bug: 7406414
Change-Id: Iba6e59d728d6f1ce81ea62b01a86dfaa355383b9

res/menu/filtershow_menu_crop.xml
res/values/filtershow_strings.xml
src/com/android/gallery3d/filtershow/PanelController.java
src/com/android/gallery3d/filtershow/imageshow/ImageCrop.java

index dc85d6f..f8ba3df 100644 (file)
@@ -6,12 +6,23 @@
             android:title="@string/aspect1to1_effect"/>
         <item
             android:id="@+id/crop_menu_4to6"
+            android:visible="false"
             android:title="@string/aspect4to6_effect"/>
         <item
+            android:id="@+id/crop_menu_4to3"
+            android:title="@string/aspect4to3_effect"/>
+        <item
+            android:id="@+id/crop_menu_3to4"
+            android:title="@string/aspect3to4_effect"/>
+        <item
             android:id="@+id/crop_menu_5to7"
             android:title="@string/aspect5to7_effect"/>
         <item
+            android:id="@+id/crop_menu_7to5"
+            android:title="@string/aspect7to5_effect"/>
+        <item
             android:id="@+id/crop_menu_9to16"
+            android:visible="false"
             android:title="@string/aspect9to16_effect"/>
         <item
             android:id="@+id/crop_menu_none"
@@ -21,4 +32,4 @@
             android:title="@string/aspectOriginal_effect"/>
     </group>
 
-</menu>
\ No newline at end of file
+</menu>
index 852ef74..b04413c 100644 (file)
     <string name="aspect">Aspect</string>
     <!--  Label for the aspect 1:1 effect [CHAR LIMIT=15] -->
     <string name="aspect1to1_effect">1:1</string>
+    <!--  Label for the aspect 4:3 effect [CHAR LIMIT=15] -->
+    <string name="aspect4to3_effect">4:3</string>
+    <!--  Label for the aspect 3:4 effect [CHAR LIMIT=15] -->
+    <string name="aspect3to4_effect">3:4</string>
     <!--  Label for the aspect 4:7 effect [CHAR LIMIT=15] -->
     <string name="aspect4to6_effect">4:6</string>
-    <!--  Label for the aspect 1:1 effect [CHAR LIMIT=15] -->
+    <!--  Label for the aspect 5:7 effect [CHAR LIMIT=15] -->
     <string name="aspect5to7_effect">5:7</string>
+    <!--  Label for the aspect 7:5 effect [CHAR LIMIT=15] -->
+    <string name="aspect7to5_effect">7:5</string>
     <!--  Label for the aspect 1:1 effect [CHAR LIMIT=15] -->
     <string name="aspect9to16_effect">16:9</string>
     <!--  Label for the aspect None effect [CHAR LIMIT=15] -->
index 9f5f265..9448b56 100644 (file)
@@ -161,19 +161,24 @@ public class PanelController implements OnClickListener {
                     imageCrop.apply(1, 1);
                     break;
                 }
-                case R.id.crop_menu_4to6: {
-                    button.setText(mContext.getString(R.string.aspect4to6_effect));
-                    imageCrop.apply(6, 4);
+                case R.id.crop_menu_4to3: {
+                    button.setText(mContext.getString(R.string.aspect4to3_effect));
+                    imageCrop.apply(4, 3);
+                    break;
+                }
+                case R.id.crop_menu_3to4: {
+                    button.setText(mContext.getString(R.string.aspect3to4_effect));
+                    imageCrop.apply(3, 4);
                     break;
                 }
                 case R.id.crop_menu_5to7: {
                     button.setText(mContext.getString(R.string.aspect5to7_effect));
-                    imageCrop.apply(7, 5);
+                    imageCrop.apply(5, 7);
                     break;
                 }
-                case R.id.crop_menu_9to16: {
-                    button.setText(mContext.getString(R.string.aspect9to16_effect));
-                    imageCrop.apply(16, 9);
+                case R.id.crop_menu_7to5: {
+                    button.setText(mContext.getString(R.string.aspect7to5_effect));
+                    imageCrop.apply(7, 5);
                     break;
                 }
                 case R.id.crop_menu_none: {
index cfeceb0..863191a 100644 (file)
@@ -430,6 +430,16 @@ public class ImageCrop extends ImageGeometry {
         float deltaY = dY / scale;
         int select = movingEdges;
         if (mFixAspectRatio && (select != MOVE_BLOCK)) {
+
+            // TODO: add in orientation change for fixed aspect
+            /*if (select == TOP_LEFT || select == TOP_RIGHT ||
+                    select == BOTTOM_LEFT || select == BOTTOM_RIGHT){
+                RectF blank = new RectF();
+                if(switchCropBounds(select, blank)){
+                    setCropBounds(blank);
+                    return;
+                }
+            }*/
             if (select == MOVE_LEFT) {
                 select |= MOVE_TOP;
             }
@@ -442,11 +452,6 @@ public class ImageCrop extends ImageGeometry {
             if (select == MOVE_BOTTOM) {
                 select |= MOVE_RIGHT;
             }
-            RectF blank = new RectF();
-            if(switchCropBounds(select, blank)){
-                setCropBounds(blank);
-                return;
-            }
         }
 
         if (select == MOVE_BLOCK) {