diff options
author | Owen Lin <owenlin@google.com> | 2012-10-26 18:55:49 +0800 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2012-10-26 19:36:57 +0800 |
commit | 4663598408ac2ca40c9d2009de1a74c5adbbe85f (patch) | |
tree | 3de04af08733ecb68992075da813ca8626dff2ba /src/com/android/gallery3d/ui | |
parent | a4f31025a49ef4a8e1ebf8ab6d1e7134f37556d5 (diff) | |
download | android_packages_apps_Snap-4663598408ac2ca40c9d2009de1a74c5adbbe85f.tar.gz android_packages_apps_Snap-4663598408ac2ca40c9d2009de1a74c5adbbe85f.tar.bz2 android_packages_apps_Snap-4663598408ac2ca40c9d2009de1a74c5adbbe85f.zip |
Fix the black lines near edge of thumbnails
1. Correct the positions of right and bottom borders
2. Turn off blending by using PoterDuffMode.SRC
bug: 7414307
Change-Id: Icc6fd765c2b1e904308c53aa66b55600e0016471
Diffstat (limited to 'src/com/android/gallery3d/ui')
-rw-r--r-- | src/com/android/gallery3d/ui/TiledTexture.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/ui/TiledTexture.java b/src/com/android/gallery3d/ui/TiledTexture.java index 8e26221bc..ce3fcc617 100644 --- a/src/com/android/gallery3d/ui/TiledTexture.java +++ b/src/com/android/gallery3d/ui/TiledTexture.java @@ -36,8 +36,8 @@ import java.util.ArrayList; // upload the whole bitmap but we reduce the time of uploading each tile // so it make the animation more smooth and prevents jank. public class TiledTexture implements Texture { - private static final int CONTENT_SIZE = 256; - private static final int BORDER_SIZE = 0; + private static final int CONTENT_SIZE = 254; + private static final int BORDER_SIZE = 1; private static final int TILE_SIZE = CONTENT_SIZE + 2 * BORDER_SIZE; private static final int INIT_CAPACITY = 8; @@ -50,6 +50,7 @@ public class TiledTexture implements Texture { private static Bitmap sUploadBitmap; private static Canvas sCanvas; + private static Paint sBitmapPaint; private static Paint sPaint; private int mUploadIndex = 0; @@ -128,9 +129,9 @@ public class TiledTexture implements Texture { protected Bitmap onGetBitmap() { int x = BORDER_SIZE - offsetX; int y = BORDER_SIZE - offsetY; - int r = bitmap.getWidth() - x; - int b = bitmap.getHeight() - y ; - sCanvas.drawBitmap(bitmap, x, y, null); + int r = bitmap.getWidth() + x; + int b = bitmap.getHeight() + y ; + sCanvas.drawBitmap(bitmap, x, y, sBitmapPaint); bitmap = null; // draw borders if need @@ -220,15 +221,18 @@ public class TiledTexture implements Texture { public static void freeResources() { sUploadBitmap = null; sCanvas = null; + sBitmapPaint = null; sPaint = null; } public static void prepareResources() { sUploadBitmap = Bitmap.createBitmap(TILE_SIZE, TILE_SIZE, Config.ARGB_8888); sCanvas = new Canvas(sUploadBitmap); - sPaint = new Paint(Paint.FILTER_BITMAP_FLAG); + sBitmapPaint = new Paint(Paint.FILTER_BITMAP_FLAG); + sBitmapPaint.setXfermode(new PorterDuffXfermode(Mode.SRC)); + sPaint = new Paint(); + sPaint.setXfermode(new PorterDuffXfermode(Mode.SRC)); sPaint.setColor(Color.TRANSPARENT); - sPaint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); } // We want to draw the "source" on the "target". |