summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java
index d5f3a5b40..eb89de036 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java
@@ -30,7 +30,7 @@ public class FilterRotateRepresentation extends FilterRepresentation {
public static final String SERIALIZATION_ROTATE_VALUE = "value";
private static final String TAG = FilterRotateRepresentation.class.getSimpleName();
- Rotation mRotation = Rotation.ZERO;
+ Rotation mRotation;
public enum Rotation {
ZERO(0), NINETY(90), ONE_EIGHTY(180), TWO_SEVENTY(270);
@@ -76,13 +76,30 @@ public class FilterRotateRepresentation extends FilterRepresentation {
}
public FilterRotateRepresentation() {
- this(Rotation.ZERO);
+ this(getNil());
}
public Rotation getRotation() {
return mRotation;
}
+ public void rotateCW() {
+ switch(mRotation) {
+ case ZERO:
+ mRotation = Rotation.NINETY;
+ break;
+ case NINETY:
+ mRotation = Rotation.ONE_EIGHTY;
+ break;
+ case ONE_EIGHTY:
+ mRotation = Rotation.TWO_SEVENTY;
+ break;
+ case TWO_SEVENTY:
+ mRotation = Rotation.ZERO;
+ break;
+ }
+ }
+
public void set(FilterRotateRepresentation r) {
mRotation = r.mRotation;
}
@@ -123,7 +140,11 @@ public class FilterRotateRepresentation extends FilterRepresentation {
@Override
public boolean isNil() {
- return mRotation == Rotation.ZERO;
+ return mRotation == getNil();
+ }
+
+ public static Rotation getNil() {
+ return Rotation.ZERO;
}
@Override