diff options
author | Chris Wren <cwren@android.com> | 2012-09-10 10:21:27 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2012-09-10 17:57:19 -0400 |
commit | 5b4b44688dac0053be77b282b7501bd291efb0d3 (patch) | |
tree | 151a81cc3f022946396c053339b409b3bd7d9c73 /src/com/android/dreams/phototable/PhotoSource.java | |
parent | d85f53c69dead1f1f6c0290b8104422143bc5166 (diff) | |
download | android_packages_screensavers_PhotoTable-5b4b44688dac0053be77b282b7501bd291efb0d3.tar.gz android_packages_screensavers_PhotoTable-5b4b44688dac0053be77b282b7501bd291efb0d3.tar.bz2 android_packages_screensavers_PhotoTable-5b4b44688dac0053be77b282b7501bd291efb0d3.zip |
updated visuals for photo flipper
rename to "Slideshow"
no flipping
better photo scaling
bonus bug fix for PicasaSource
Bug: 7138425
Change-Id: I984b2d5b13716b676e55205f093df7bc929034c0
Diffstat (limited to 'src/com/android/dreams/phototable/PhotoSource.java')
-rw-r--r-- | src/com/android/dreams/phototable/PhotoSource.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/dreams/phototable/PhotoSource.java b/src/com/android/dreams/phototable/PhotoSource.java index 32c7739..8a09bba 100644 --- a/src/com/android/dreams/phototable/PhotoSource.java +++ b/src/com/android/dreams/phototable/PhotoSource.java @@ -71,6 +71,7 @@ public abstract class PhotoSource { private final LinkedList<ImageData> mImageQueue; private final int mMaxQueueSize; + private final float mMaxCropRatio; protected final Context mContext; protected final Resources mResources; @@ -88,6 +89,7 @@ public abstract class PhotoSource { mResources = context.getResources(); mImageQueue = new LinkedList<ImageData>(); mMaxQueueSize = mResources.getInteger(R.integer.image_queue_size); + mMaxCropRatio = mResources.getInteger(R.integer.max_crop_ratio) / 1000000f; mRNG = new Random(); } @@ -122,8 +124,13 @@ public abstract class PhotoSource { log(TAG, "I see bounds of " + rawLongSide + ", " + rawShortSide); if (rawLongSide != -1 && rawShortSide != -1) { - float ratio = Math.max((float) longSide / (float) rawLongSide, - (float) shortSide / (float) rawShortSide); + float insideRatio = Math.max((float) longSide / (float) rawLongSide, + (float) shortSide / (float) rawShortSide); + float outsideRatio = Math.max((float) longSide / (float) rawLongSide, + (float) shortSide / (float) rawShortSide); + float ratio = (outsideRatio / insideRatio < mMaxCropRatio ? + outsideRatio : insideRatio); + while (ratio < 0.5) { options.inSampleSize *= 2; ratio *= 2; @@ -142,6 +149,7 @@ public abstract class PhotoSource { log(TAG, "still too big, scaling down by " + ratio); options.outWidth = (int) (ratio * options.outWidth); options.outHeight = (int) (ratio * options.outHeight); + image = Bitmap.createScaledBitmap(image, options.outWidth, options.outHeight, true); |