summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/RotateImageView.java
diff options
context:
space:
mode:
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);