diff options
| author | John Hoford <hoford@google.com> | 2013-09-24 16:36:35 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2013-09-24 16:36:35 -0700 |
| commit | 8800ce002701f7822b70ffb6de17e976b5a4eb22 (patch) | |
| tree | 9b945791d6c86c267bcfa5d7e9adea73e2a4e902 | |
| parent | f1b3e8b5edd77c3f87834c4d490350d8418aae59 (diff) | |
| parent | 62ff5222af31de3757a9ad5428f68d0e338ae060 (diff) | |
| download | android_packages_apps_Gallery2-8800ce002701f7822b70ffb6de17e976b5a4eb22.tar.gz android_packages_apps_Gallery2-8800ce002701f7822b70ffb6de17e976b5a4eb22.tar.bz2 android_packages_apps_Gallery2-8800ce002701f7822b70ffb6de17e976b5a4eb22.zip | |
am 62ff5222: am 59e93986: Merge "fix print code to support landscape" into gb-ub-photos-carlsbad
* commit '62ff5222af31de3757a9ad5428f68d0e338ae060':
fix print code to support landscape
| -rw-r--r-- | src/com/android/gallery3d/util/PrintJob.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/util/PrintJob.java b/src/com/android/gallery3d/util/PrintJob.java index 1ee0907f1..c08f078b0 100644 --- a/src/com/android/gallery3d/util/PrintJob.java +++ b/src/com/android/gallery3d/util/PrintJob.java @@ -39,7 +39,7 @@ import java.io.IOException; public class PrintJob { private static final String LOG_TAG = "PrintJob"; - + private static final boolean CROP_TO_FILL_PAGE = true; // will be <= 300 dpi on A4 (8.3×11.7) paper // with a worst case of 150 dpi private final static int MAX_PRINT_SIZE = 3500; @@ -67,8 +67,8 @@ public class PrintJob { .setContentType(PrintDocumentInfo.CONTENT_TYPE_PHOTO) .setPageCount(1) .build(); - - layoutResultCallback.onLayoutFinished(info, false); + boolean changed = !newPrintAttributes.equals(oldPrintAttributes); + layoutResultCallback.onLayoutFinished(info, changed); } @Override @@ -84,8 +84,12 @@ public class PrintJob { Matrix matrix = new Matrix(); // Compute and apply scale to fill the page. - float scale = Math.max(content.width() / bitmap.getWidth(), - content.height() / bitmap.getHeight()); + float scale = content.width() / bitmap.getWidth(); + if (CROP_TO_FILL_PAGE) { + scale = Math.max(scale, content.height() / bitmap.getHeight()); + } else { + scale = Math.min(scale, content.height() / bitmap.getHeight()); + } matrix.postScale(scale, scale); // Center the content. |
