summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Wang <jaywang@codeaurora.org>2016-06-17 11:38:12 -0700
committerSteve Kondik <steve@cyngn.com>2016-08-21 18:46:32 -0700
commita85e9c010d6f5fa66f6dd62f67f796813356464b (patch)
tree5dfce6a97f57dbf0d36c58c3a23b9c5a34779abb
parent1ebc5c3bd541256509f4eed9a085f554a8ba3ea7 (diff)
downloadandroid_packages_apps_Snap-a85e9c010d6f5fa66f6dd62f67f796813356464b.zip
android_packages_apps_Snap-a85e9c010d6f5fa66f6dd62f67f796813356464b.tar.gz
android_packages_apps_Snap-a85e9c010d6f5fa66f6dd62f67f796813356464b.tar.bz2
SnapdragonCamera: Fix slow zooming issue
Zoom range calculation didn't give enough precision and caused non-smooth zooming experience. Make the change to keep the full fractional digits. Change-Id: Ib72707e451ea7c4e375d489d183265592622ce0b CRs-Fixed: 1025788
-rw-r--r--src/com/android/camera/ui/ZoomRenderer.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/com/android/camera/ui/ZoomRenderer.java b/src/com/android/camera/ui/ZoomRenderer.java
index 67dcf34..3e436cf 100644
--- a/src/com/android/camera/ui/ZoomRenderer.java
+++ b/src/com/android/camera/ui/ZoomRenderer.java
@@ -54,7 +54,6 @@ public class ZoomRenderer extends OverlayRenderer
private Rect mTextBounds;
private int mOrientation;
private boolean mCamera2 = false;
- private float mZoomValue;
private float mZoomMinValue;
private float mZoomMaxValue;
@@ -102,8 +101,9 @@ public class ZoomRenderer extends OverlayRenderer
public void setZoom(float zoomValue) {
mCamera2 = true;
- mZoomValue = zoomValue;
- mCircleSize = (int) (mMinCircle + (mMaxCircle - mMinCircle) * (mZoomValue - mZoomMinValue) /
+ mZoomSig = (int) zoomValue;
+ mZoomFraction = (int)(zoomValue * 10) % 10;
+ mCircleSize = (int) (mMinCircle + (mMaxCircle - mMinCircle) * (zoomValue - mZoomMinValue) /
(mZoomMaxValue - mZoomMinValue));
}
@@ -142,7 +142,6 @@ public class ZoomRenderer extends OverlayRenderer
canvas.drawCircle((float) mCenterX, (float) mCenterY,
mCircleSize, mPaint);
String txt = mZoomSig+"."+mZoomFraction+"x";
- if (mCamera2) txt = "" + mZoomValue;
mTextPaint.getTextBounds(txt, 0, txt.length(), mTextBounds);
canvas.drawText(txt, mCenterX - mTextBounds.centerX(), mCenterY - mTextBounds.centerY(),
mTextPaint);
@@ -159,7 +158,6 @@ public class ZoomRenderer extends OverlayRenderer
if (mCamera2) {
float zoom = mZoomMinValue + (mZoomMaxValue - mZoomMinValue) / (mMaxCircle -
mMinCircle) * (mCircleSize - mMinCircle);
- zoom = ((int) (zoom * 10)) / 10.0f;
mListener.onZoomValueChanged(zoom);
} else {
int zoom = mMinZoom + (int) ((mCircleSize - mMinCircle) * (mMaxZoom - mMinZoom) /