OSDN Git Service

This fixes Bitmap.createBitmap offset bug in L, not sure why.
authorAndy Huibers <andyhuibers@google.com>
Tue, 9 Sep 2014 19:52:29 +0000 (12:52 -0700)
committerAndy Huibers <andyhuibers@google.com>
Tue, 9 Sep 2014 20:00:30 +0000 (13:00 -0700)
Bug: 17145703
Change-Id: I18a673a5cac4400a2d6e80a851b1fb12381dc995

src/com/android/camera/PhotoModule.java

index 5f606eb..1a87f4d 100644 (file)
@@ -999,6 +999,18 @@ public class PhotoModule
         int xOffset = (originalWidth - newWidth)/2;
         int yOffset = (originalHeight - newHeight)/2;
 
+        // For some reason L needs this to work.
+        // This code is only run on the Nexus 5.
+        // TODO: Determine why this is needed.
+        if (Build.VERSION.SDK_INT >= 21 || Build.VERSION.CODENAME.equals("L")) {
+            Log.v(TAG,"xOffset = " + xOffset);
+            Log.v(TAG,"yOffset = " + yOffset);
+            xOffset *= 2;
+            yOffset = 0;
+            Log.v(TAG,"new xOffset = " + xOffset);
+            Log.v(TAG,"new yOffset = " + yOffset);
+        }
+
         if (xOffset < 0 || yOffset < 0) {
             return dataBundle;
         }