summaryrefslogtreecommitdiffstats
path: root/src/com/android/dreams/phototable/LocalSource.java
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2012-09-04 17:52:57 -0400
committerChris Wren <cwren@android.com>2012-09-05 14:39:55 -0400
commitc1501041b64faa6c205a93baf403c4c87a0c1acf (patch)
treedbd9535e83a74e934b7bf43f2b844dafd6ae2d1a /src/com/android/dreams/phototable/LocalSource.java
parentc91cbab0936ec64c8078aa8deeb1cfbe0e15cbfa (diff)
downloadandroid_packages_screensavers_PhotoTable-c1501041b64faa6c205a93baf403c4c87a0c1acf.tar.gz
android_packages_screensavers_PhotoTable-c1501041b64faa6c205a93baf403c4c87a0c1acf.tar.bz2
android_packages_screensavers_PhotoTable-c1501041b64faa6c205a93baf403c4c87a0c1acf.zip
Add Picasa as a source of photos.
Change-Id: I3ac978e1eb16839f767493dae4178597937b2352
Diffstat (limited to 'src/com/android/dreams/phototable/LocalSource.java')
-rw-r--r--src/com/android/dreams/phototable/LocalSource.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/com/android/dreams/phototable/LocalSource.java b/src/com/android/dreams/phototable/LocalSource.java
index 1414567..4b260db 100644
--- a/src/com/android/dreams/phototable/LocalSource.java
+++ b/src/com/android/dreams/phototable/LocalSource.java
@@ -118,10 +118,10 @@ public class LocalSource {
options.inSampleSize = 1;
BitmapFactory.decodeFileDescriptor(fis.getFD(), null, options);
int rawLongSide = Math.max(options.outWidth, options.outHeight);
- int rawShortSide = Math.max(options.outWidth, options.outHeight);
+ int rawShortSide = Math.min(options.outWidth, options.outHeight);
log("I see bounds of " + rawLongSide + ", " + rawShortSide);
- float ratio = Math.min((float) longSide / (float) rawLongSide,
+ float ratio = Math.max((float) longSide / (float) rawLongSide,
(float) shortSide / (float) rawShortSide);
while (ratio < 0.5) {
options.inSampleSize *= 2;
@@ -133,8 +133,8 @@ public class LocalSource {
image = BitmapFactory.decodeFileDescriptor(fis.getFD(), null, options);
rawLongSide = Math.max(options.outWidth, options.outHeight);
rawShortSide = Math.max(options.outWidth, options.outHeight);
- ratio = Math.min((float) longSide / (float) rawLongSide,
- (float) shortSide / (float) rawShortSide);
+ ratio = Math.max((float) longSide / (float) rawLongSide,
+ (float) shortSide / (float) rawShortSide);
if (ratio < 1.0f) {
log("still too big, scaling down by " + ratio);
@@ -153,11 +153,11 @@ public class LocalSource {
options.outHeight = tmp;
}
Matrix matrix = new Matrix();
- matrix.setRotate(- data.orientation,
+ matrix.setRotate(data.orientation,
(float) image.getWidth() / 2,
(float) image.getHeight() / 2);
image = Bitmap.createBitmap(image, 0, 0,
- options.outWidth, options.outHeight,
+ options.outHeight, options.outWidth,
matrix, true);
}