diff options
author | jinwu <jinwu@codeaurora.org> | 2017-06-01 13:26:57 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-06-02 00:28:24 -0700 |
commit | 87fa6e8341e295fb4146f6544a6ea2ff01100488 (patch) | |
tree | 18de8782d30db489c5e657529706d9db73c928fb | |
parent | c2397851c80bc1aaad1cec854847d57c266110eb (diff) | |
download | android_packages_apps_Gallery2-87fa6e8341e295fb4146f6544a6ea2ff01100488.tar.gz android_packages_apps_Gallery2-87fa6e8341e295fb4146f6544a6ea2ff01100488.tar.bz2 android_packages_apps_Gallery2-87fa6e8341e295fb4146f6544a6ea2ff01100488.zip |
[O Upgrade]Fix picture cannot be seen when set a picture taken by Camera as contact photo
remove verifying the return value of mapRect().
Change-Id: I6c0bec8216c12e22a1cb1c831d7947c6081c06c4
CRs-Fixed: 2054950
3 files changed, 32 insertions, 40 deletions
diff --git a/src/com/android/gallery3d/filtershow/crop/CropDrawingUtils.java b/src/com/android/gallery3d/filtershow/crop/CropDrawingUtils.java index 5937c789a..0430de611 100644 --- a/src/com/android/gallery3d/filtershow/crop/CropDrawingUtils.java +++ b/src/com/android/gallery3d/filtershow/crop/CropDrawingUtils.java @@ -207,10 +207,7 @@ public abstract class CropDrawingUtils { RectF screen, int rotation) { RectF rotatedImage = new RectF(); dst.setRotate(rotation, image.centerX(), image.centerY()); - if (!dst.mapRect(rotatedImage, image)) { - return false; // fails for rotations that are not multiples of 90 - // degrees - } + dst.mapRect(rotatedImage, image); boolean rToR = dst.setRectToRect(rotatedImage, screen, Matrix.ScaleToFit.CENTER); boolean rot = dst.preRotate(rotation, image.centerX(), image.centerY()); return rToR && rot; diff --git a/src/com/android/gallery3d/filtershow/crop/CropMath.java b/src/com/android/gallery3d/filtershow/crop/CropMath.java index 02c65310e..1faf26343 100644 --- a/src/com/android/gallery3d/filtershow/crop/CropMath.java +++ b/src/com/android/gallery3d/filtershow/crop/CropMath.java @@ -219,9 +219,7 @@ public class CropMath { Matrix m = new Matrix(); m.setRectToRect(photoBounds, displayBounds, Matrix.ScaleToFit.FILL); RectF trueCrop = new RectF(cropBounds); - if (!m.mapRect(trueCrop)) { - return null; - } + m.mapRect(trueCrop); return trueCrop; } diff --git a/src/com/android/gallery3d/filtershow/crop/CropView.java b/src/com/android/gallery3d/filtershow/crop/CropView.java index d51d79983..175fb82ce 100644 --- a/src/com/android/gallery3d/filtershow/crop/CropView.java +++ b/src/com/android/gallery3d/filtershow/crop/CropView.java @@ -331,14 +331,13 @@ public class CropView extends View { mScreenImageBounds.set(mImageBounds); // Draw background shadow - if (mDisplayMatrix.mapRect(mScreenImageBounds)) { - int margin = (int) mDisplayMatrix.mapRadius(mShadowMargin); - mScreenImageBounds.roundOut(mShadowBounds); - mShadowBounds.set(mShadowBounds.left - margin, mShadowBounds.top - - margin, mShadowBounds.right + margin, mShadowBounds.bottom + margin); - mShadow.setBounds(mShadowBounds); - mShadow.draw(canvas); - } + mDisplayMatrix.mapRect(mScreenImageBounds); + int margin = (int) mDisplayMatrix.mapRadius(mShadowMargin); + mScreenImageBounds.roundOut(mShadowBounds); + mShadowBounds.set(mShadowBounds.left - margin, mShadowBounds.top - + margin, mShadowBounds.right + margin, mShadowBounds.bottom + margin); + mShadow.setBounds(mShadowBounds); + mShadow.draw(canvas); mPaint.setAntiAlias(true); mPaint.setFilterBitmap(true); @@ -346,31 +345,29 @@ public class CropView extends View { canvas.drawBitmap(mBitmap, mDisplayMatrix, mPaint); mCropObj.getInnerBounds(mScreenCropBounds); - - if (mDisplayMatrix.mapRect(mScreenCropBounds)) { - - // Draw overlay shadows - Paint p = new Paint(); - p.setColor(mOverlayShadowColor); - p.setStyle(Paint.Style.FILL); - CropDrawingUtils.drawShadows(canvas, p, mScreenCropBounds, mScreenImageBounds); - - // Draw crop rect and markers - CropDrawingUtils.drawCropRect(canvas, mScreenCropBounds, getContext()); - CropDrawingUtils.drawCorner(canvas, mScreenCropBounds, getContext()); - if (!mDoSpot) { - CropDrawingUtils.drawRuleOfThird(canvas, mScreenCropBounds, getContext()); - } else { - Paint wpPaint = new Paint(); - wpPaint.setColor(mWPMarkerColor); - wpPaint.setStrokeWidth(3); - wpPaint.setStyle(Paint.Style.STROKE); - wpPaint.setPathEffect(new DashPathEffect(new float[] - {mDashOnLength, mDashOnLength + mDashOffLength}, 0)); - p.setColor(mOverlayWPShadowColor); - CropDrawingUtils.drawWallpaperSelectionFrame(canvas, mScreenCropBounds, - mSpotX, mSpotY, wpPaint, p); - } + mDisplayMatrix.mapRect(mScreenCropBounds); + + // Draw overlay shadows + Paint p = new Paint(); + p.setColor(mOverlayShadowColor); + p.setStyle(Paint.Style.FILL); + CropDrawingUtils.drawShadows(canvas, p, mScreenCropBounds, mScreenImageBounds); + + // Draw crop rect and markers + CropDrawingUtils.drawCropRect(canvas, mScreenCropBounds, getContext()); + CropDrawingUtils.drawCorner(canvas, mScreenCropBounds, getContext()); + if (!mDoSpot) { + CropDrawingUtils.drawRuleOfThird(canvas, mScreenCropBounds, getContext()); + } else { + Paint wpPaint = new Paint(); + wpPaint.setColor(mWPMarkerColor); + wpPaint.setStrokeWidth(3); + wpPaint.setStyle(Paint.Style.STROKE); + wpPaint.setPathEffect(new DashPathEffect(new float[] + {mDashOnLength, mDashOnLength + mDashOffLength}, 0)); + p.setColor(mOverlayWPShadowColor); + CropDrawingUtils.drawWallpaperSelectionFrame(canvas, mScreenCropBounds, + mSpotX, mSpotY, wpPaint, p); } } |