summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/RotateImageView.java
diff options
context:
space:
mode:
authorChung-yih Wang <cywang@google.com>2011-08-05 01:14:35 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-05 01:14:35 -0700
commit0980ef20897b2b83ee1ddce300044c121192f599 (patch)
treecd0396f2a3d76b94db114627742b66146bf31410 /src/com/android/camera/ui/RotateImageView.java
parent141cf9386c6053e655ef054f499230cfafba3ff6 (diff)
parentb5c569214281e11dc7e8ffc313fbb27e5ff6e5c5 (diff)
downloadLegacyCamera-0980ef20897b2b83ee1ddce300044c121192f599.zip
LegacyCamera-0980ef20897b2b83ee1ddce300044c121192f599.tar.gz
LegacyCamera-0980ef20897b2b83ee1ddce300044c121192f599.tar.bz2
Merge "Add the CameraPicker for PhoneUI."
Diffstat (limited to 'src/com/android/camera/ui/RotateImageView.java')
-rw-r--r--src/com/android/camera/ui/RotateImageView.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/android/camera/ui/RotateImageView.java b/src/com/android/camera/ui/RotateImageView.java
index 4085bb2..80752a2 100644
--- a/src/com/android/camera/ui/RotateImageView.java
+++ b/src/com/android/camera/ui/RotateImageView.java
@@ -121,6 +121,13 @@ public class RotateImageView extends ImageView {
int height = getHeight() - top - bottom;
int saveCount = canvas.getSaveCount();
+
+ // Scale down the image first if required.
+ if ((getScaleType() == ImageView.ScaleType.FIT_CENTER) &&
+ ((width < w) || (height < h))) {
+ float ratio = Math.min((float) width / w, (float) height / h);
+ canvas.scale(ratio, ratio, width / 2.0f, height / 2.0f);
+ }
canvas.translate(left + width / 2, top + height / 2);
canvas.rotate(-mCurrentDegree);
canvas.translate(-w / 2, -h / 2);