Loading src/com/android/gallery3d/ui/TileImageView.java +16 −6 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.BitmapPool; import com.android.gallery3d.data.DecodeUtils; import com.android.gallery3d.util.Future; import com.android.gallery3d.util.GalleryUtils; import com.android.gallery3d.util.ThreadPool; import com.android.gallery3d.util.ThreadPool.CancelListener; import com.android.gallery3d.util.ThreadPool.JobContext; Loading @@ -43,15 +44,12 @@ public class TileImageView extends GLView { // TILE_SIZE must be 2^N - 2. We put one pixel border in each side of the // texture to avoid seams between tiles. private static final int TILE_SIZE = 254; private static int TILE_SIZE; private static final int TILE_BORDER = 1; private static final int BITMAP_SIZE = TILE_SIZE + TILE_BORDER * 2; private static int BITMAP_SIZE; private static final int UPLOAD_LIMIT = 1; private static final BitmapPool sTilePool = ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_REGION_DECODER ? new BitmapPool(BITMAP_SIZE, BITMAP_SIZE, 128) : null; private static BitmapPool sTilePool; /* * This is the tile state in the CPU side. Loading Loading @@ -152,6 +150,18 @@ public class TileImageView extends GLView { public TileImageView(GalleryContext context) { mThreadPool = context.getThreadPool(); mTileDecoder = mThreadPool.submit(new TileDecoder()); if (TILE_SIZE == 0) { if (GalleryUtils.isHighResolution(context.getAndroidContext())) { TILE_SIZE = 510 ; } else { TILE_SIZE = 254; } BITMAP_SIZE = TILE_SIZE + TILE_BORDER * 2; sTilePool = ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_REGION_DECODER ? new BitmapPool(BITMAP_SIZE, BITMAP_SIZE, 128) : null; } } public void setModel(Model model) { Loading src/com/android/gallery3d/ui/TileImageViewAdapter.java +0 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,6 @@ public class TileImageViewAdapter implements TileImageView.Model { @Override public Bitmap getTile(int level, int x, int y, int tileSize, int borderSize, BitmapPool pool) { if (!ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_REGION_DECODER) { return getTileWithoutReusingBitmap(level, x, y, tileSize, borderSize); } Loading src/com/android/gallery3d/util/GalleryUtils.java +8 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,14 @@ public class GalleryUtils { R.color.bitmap_screennail_placeholder)); } public static boolean isHighResolution(Context context) { DisplayMetrics metrics = new DisplayMetrics(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(metrics); return metrics.heightPixels > 2048 || metrics.widthPixels > 2048; } public static float[] intColorToFloatARGBArray(int from) { return new float[] { Color.alpha(from) / 255f, Loading Loading
src/com/android/gallery3d/ui/TileImageView.java +16 −6 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.BitmapPool; import com.android.gallery3d.data.DecodeUtils; import com.android.gallery3d.util.Future; import com.android.gallery3d.util.GalleryUtils; import com.android.gallery3d.util.ThreadPool; import com.android.gallery3d.util.ThreadPool.CancelListener; import com.android.gallery3d.util.ThreadPool.JobContext; Loading @@ -43,15 +44,12 @@ public class TileImageView extends GLView { // TILE_SIZE must be 2^N - 2. We put one pixel border in each side of the // texture to avoid seams between tiles. private static final int TILE_SIZE = 254; private static int TILE_SIZE; private static final int TILE_BORDER = 1; private static final int BITMAP_SIZE = TILE_SIZE + TILE_BORDER * 2; private static int BITMAP_SIZE; private static final int UPLOAD_LIMIT = 1; private static final BitmapPool sTilePool = ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_REGION_DECODER ? new BitmapPool(BITMAP_SIZE, BITMAP_SIZE, 128) : null; private static BitmapPool sTilePool; /* * This is the tile state in the CPU side. Loading Loading @@ -152,6 +150,18 @@ public class TileImageView extends GLView { public TileImageView(GalleryContext context) { mThreadPool = context.getThreadPool(); mTileDecoder = mThreadPool.submit(new TileDecoder()); if (TILE_SIZE == 0) { if (GalleryUtils.isHighResolution(context.getAndroidContext())) { TILE_SIZE = 510 ; } else { TILE_SIZE = 254; } BITMAP_SIZE = TILE_SIZE + TILE_BORDER * 2; sTilePool = ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_REGION_DECODER ? new BitmapPool(BITMAP_SIZE, BITMAP_SIZE, 128) : null; } } public void setModel(Model model) { Loading
src/com/android/gallery3d/ui/TileImageViewAdapter.java +0 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,6 @@ public class TileImageViewAdapter implements TileImageView.Model { @Override public Bitmap getTile(int level, int x, int y, int tileSize, int borderSize, BitmapPool pool) { if (!ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_REGION_DECODER) { return getTileWithoutReusingBitmap(level, x, y, tileSize, borderSize); } Loading
src/com/android/gallery3d/util/GalleryUtils.java +8 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,14 @@ public class GalleryUtils { R.color.bitmap_screennail_placeholder)); } public static boolean isHighResolution(Context context) { DisplayMetrics metrics = new DisplayMetrics(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(metrics); return metrics.heightPixels > 2048 || metrics.widthPixels > 2048; } public static float[] intColorToFloatARGBArray(int from) { return new float[] { Color.alpha(from) / 255f, Loading