summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-10-26 18:55:49 +0800
committerOwen Lin <owenlin@google.com>2012-10-26 19:36:57 +0800
commit04d324e313b8ee36ce878f5e8c92949b32de33c0 (patch)
tree7174068138e0c65efa3201536f6fc44a4251feef /src/com/android
parent8d8cdf7f67db69309fd740ca301fbeaadac8a9f0 (diff)
downloadandroid_packages_apps_Gallery2-04d324e313b8ee36ce878f5e8c92949b32de33c0.tar.gz
android_packages_apps_Gallery2-04d324e313b8ee36ce878f5e8c92949b32de33c0.tar.bz2
android_packages_apps_Gallery2-04d324e313b8ee36ce878f5e8c92949b32de33c0.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')
-rw-r--r--src/com/android/gallery3d/ui/TiledTexture.java18
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".