|
@@ -355,7 +355,7 @@ public class OperationPresenter extends BasePresenter<IOperationView> {
|
|
|
boolean isPortraitPhoto = BigDecimal.valueOf(heightD).compareTo(BigDecimal.valueOf(widthD)) > 0;
|
|
boolean isPortraitPhoto = BigDecimal.valueOf(heightD).compareTo(BigDecimal.valueOf(widthD)) > 0;
|
|
|
if (isPortraitPhoto) {
|
|
if (isPortraitPhoto) {
|
|
|
// 高的倍距大,以高为基准
|
|
// 高的倍距大,以高为基准
|
|
|
- if (widthD > 1) {
|
|
|
|
|
|
|
+ if (heightD > 1) {
|
|
|
// 图片宽要缩小到屏幕宽
|
|
// 图片宽要缩小到屏幕宽
|
|
|
float pivot = 1.0f * rawBitmapHeight / mHeight;
|
|
float pivot = 1.0f * rawBitmapHeight / mHeight;
|
|
|
realLeft = (int) (mLeft * pivot);
|
|
realLeft = (int) (mLeft * pivot);
|
|
@@ -372,21 +372,22 @@ public class OperationPresenter extends BasePresenter<IOperationView> {
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
// 宽的倍距大,以宽为基准
|
|
// 宽的倍距大,以宽为基准
|
|
|
- if (heightD > 1) {
|
|
|
|
|
- // 图片高要缩小到屏幕高
|
|
|
|
|
- float pivot = 1.0f * rawBitmapWidth / mWidth;
|
|
|
|
|
- realLeft = (int) (mLeft * pivot);
|
|
|
|
|
- realTop = (int) (mTop * pivot);
|
|
|
|
|
- croppedBitmapWidth = (int) ((mRight - mLeft) * pivot);
|
|
|
|
|
- croppedBitmapHeight = (int) ((mBottom - mTop) * pivot);
|
|
|
|
|
- } else {
|
|
|
|
|
- // 屏幕宽要缩小到图片宽
|
|
|
|
|
- float pivot = 1.0f * mWidth / rawBitmapWidth;
|
|
|
|
|
- realLeft = (int) (mLeft/pivot);
|
|
|
|
|
- realTop = (int) (mTop/pivot);
|
|
|
|
|
- croppedBitmapWidth = (int) (1.0f * (mRight - mLeft)/pivot);
|
|
|
|
|
- croppedBitmapHeight = (int) (1.0f * (mBottom - mTop)/pivot);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if (widthD > 1) {
|
|
|
|
|
+// // 图片高要缩小到屏幕高
|
|
|
|
|
+// float pivot = 1.0f * rawBitmapWidth / mWidth;
|
|
|
|
|
+// realLeft = (int) (mLeft * pivot);
|
|
|
|
|
+// realTop = (int) (mTop * pivot);
|
|
|
|
|
+// croppedBitmapWidth = (int) ((mRight - mLeft) * pivot);
|
|
|
|
|
+// croppedBitmapHeight = (int) ((mBottom - mTop) * pivot);
|
|
|
|
|
+// } else {
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+ // 屏幕宽要缩小到图片宽
|
|
|
|
|
+ float pivot = 1.0f * mWidth / rawBitmapWidth;
|
|
|
|
|
+ realLeft = (int) (mLeft/pivot);
|
|
|
|
|
+ realTop = (int) (mTop/pivot);
|
|
|
|
|
+ croppedBitmapWidth = (int) (1.0f * (mRight - mLeft)/pivot);
|
|
|
|
|
+ croppedBitmapHeight = (int) (1.0f * (mBottom - mTop)/pivot);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|