Adjust the scale before calculating wallpaper cropRect

This way we calculate the rectangle taking into account the extra
size needed for zoom, which means the center is now correct and
we can get rid of the hack for one-screen sized wallpapers.

https://screenshot.googleplex.com/cHhHu85597R.png

Fixes: 160865927
Change-Id: I6a5f2fd6217cf40caca434af6ff58000422417a3
diff --git a/src/com/android/wallpaper/picker/ImagePreviewFragment.java b/src/com/android/wallpaper/picker/ImagePreviewFragment.java
index 184e1de..b1153bb 100755
--- a/src/com/android/wallpaper/picker/ImagePreviewFragment.java
+++ b/src/com/android/wallpaper/picker/ImagePreviewFragment.java
@@ -411,17 +411,15 @@
         int minCrop = Math.min(cropWidth, cropHeight);
         Point hostViewSize = new Point(cropWidth, cropHeight);
 
-        // Workaround for now to force wallpapers designed to fit one screen size to not adjust for
-        // parallax scrolling (with an extra 1 pixel to account for rounding)
-        // TODO (santie): implement a better solution
-        boolean shouldForceScreenSize = mRawWallpaperSize.x - mScreenSize.x <= 1;
         Resources res = context.getResources();
-        Point cropSurfaceSize = shouldForceScreenSize ? hostViewSize :
-                WallpaperCropUtils.calculateCropSurfaceSize(res, maxCrop, minCrop);
+        Point cropSurfaceSize = WallpaperCropUtils.calculateCropSurfaceSize(res, maxCrop, minCrop);
+        WallpaperCropUtils.scaleSize(context, hostViewSize);
+        WallpaperCropUtils.scaleSize(context, cropSurfaceSize);
+
+        WallpaperCropUtils.adjustCropRect(context, visibleFileRect, false);
 
         Rect cropRect = WallpaperCropUtils.calculateCropRect(context, hostViewSize,
                 cropSurfaceSize, mRawWallpaperSize, visibleFileRect, wallpaperZoom);
-        WallpaperCropUtils.adjustCropRect(context, cropRect, false /* zoomIn */);
         return cropRect;
     }