diff options
| author | John Reck <jreck@google.com> | 2010-11-16 17:09:37 -0800 |
|---|---|---|
| committer | John Reck <jreck@google.com> | 2010-11-17 13:43:37 -0800 |
| commit | fe49ab43d138ee52c04de77729870daf2a890c46 (patch) | |
| tree | f45ca1dd8f429415bd80ce31a1e4e63f0a131254 | |
| parent | 8233facddcc51865d612a919d450db6954aa48e3 (diff) | |
| download | packages_apps_Browser-fe49ab43d138ee52c04de77729870daf2a890c46.tar.gz packages_apps_Browser-fe49ab43d138ee52c04de77729870daf2a890c46.tar.bz2 packages_apps_Browser-fe49ab43d138ee52c04de77729870daf2a890c46.zip | |
Thumbnail asset and algorithm tweak
Bug: 3203597
This update replaces the preloaded thumbnails with the desktop
versions of the sites rather than the mobile one. It also corrects
the thumbnail generation behavior to prevent stretching.
Change-Id: Ic122962496079d4ebf0111585bbcaadf47a06165
| -rw-r--r-- | res/raw/thumb_amazon.png | bin | 2471 -> 17750 bytes | |||
| -rw-r--r-- | res/raw/thumb_bbc.png | bin | 14406 -> 11663 bytes | |||
| -rw-r--r-- | res/raw/thumb_cnn.png | bin | 5440 -> 18956 bytes | |||
| -rw-r--r-- | res/raw/thumb_ebay.png | bin | 2989 -> 18526 bytes | |||
| -rw-r--r-- | res/raw/thumb_espn.png | bin | 5127 -> 23367 bytes | |||
| -rw-r--r-- | res/raw/thumb_facebook.png | bin | 936 -> 10293 bytes | |||
| -rw-r--r-- | res/raw/thumb_google.png | bin | 5905 -> 4754 bytes | |||
| -rw-r--r-- | res/raw/thumb_msn.png | bin | 5684 -> 16154 bytes | |||
| -rw-r--r-- | res/raw/thumb_myspace.png | bin | 1601 -> 22824 bytes | |||
| -rw-r--r-- | res/raw/thumb_picasa.png | bin | 3889 -> 15064 bytes | |||
| -rw-r--r-- | res/raw/thumb_weatherchannel.png | bin | 1599 -> 21618 bytes | |||
| -rw-r--r-- | res/raw/thumb_yahoo.png | bin | 5166 -> 15376 bytes | |||
| -rw-r--r-- | src/com/android/browser/Controller.java | 18 |
13 files changed, 8 insertions, 10 deletions
diff --git a/res/raw/thumb_amazon.png b/res/raw/thumb_amazon.png Binary files differindex eec1d772d..4dd2f35bc 100644 --- a/res/raw/thumb_amazon.png +++ b/res/raw/thumb_amazon.png diff --git a/res/raw/thumb_bbc.png b/res/raw/thumb_bbc.png Binary files differindex 9cdd90270..dff04248c 100644 --- a/res/raw/thumb_bbc.png +++ b/res/raw/thumb_bbc.png diff --git a/res/raw/thumb_cnn.png b/res/raw/thumb_cnn.png Binary files differindex 70b7ea2e6..3d6fdc9ac 100644 --- a/res/raw/thumb_cnn.png +++ b/res/raw/thumb_cnn.png diff --git a/res/raw/thumb_ebay.png b/res/raw/thumb_ebay.png Binary files differindex 070fa6caa..023f67858 100644 --- a/res/raw/thumb_ebay.png +++ b/res/raw/thumb_ebay.png diff --git a/res/raw/thumb_espn.png b/res/raw/thumb_espn.png Binary files differindex 94918e2ca..c0882ebb9 100644 --- a/res/raw/thumb_espn.png +++ b/res/raw/thumb_espn.png diff --git a/res/raw/thumb_facebook.png b/res/raw/thumb_facebook.png Binary files differindex 6e295b13c..a8c047f42 100644 --- a/res/raw/thumb_facebook.png +++ b/res/raw/thumb_facebook.png diff --git a/res/raw/thumb_google.png b/res/raw/thumb_google.png Binary files differindex 17537882a..c54e6ea05 100644 --- a/res/raw/thumb_google.png +++ b/res/raw/thumb_google.png diff --git a/res/raw/thumb_msn.png b/res/raw/thumb_msn.png Binary files differindex 2240e12ec..4ad710f5c 100644 --- a/res/raw/thumb_msn.png +++ b/res/raw/thumb_msn.png diff --git a/res/raw/thumb_myspace.png b/res/raw/thumb_myspace.png Binary files differindex 3f39ac5c3..d6f6e76cd 100644 --- a/res/raw/thumb_myspace.png +++ b/res/raw/thumb_myspace.png diff --git a/res/raw/thumb_picasa.png b/res/raw/thumb_picasa.png Binary files differindex dca6a7d98..5ec2d7ac2 100644 --- a/res/raw/thumb_picasa.png +++ b/res/raw/thumb_picasa.png diff --git a/res/raw/thumb_weatherchannel.png b/res/raw/thumb_weatherchannel.png Binary files differindex c91e54c7c..a190a0c51 100644 --- a/res/raw/thumb_weatherchannel.png +++ b/res/raw/thumb_weatherchannel.png diff --git a/res/raw/thumb_yahoo.png b/res/raw/thumb_yahoo.png Binary files differindex 115d8bb20..08dd759b6 100644 --- a/res/raw/thumb_yahoo.png +++ b/res/raw/thumb_yahoo.png diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index 6b0ab0e44..7d183f6ff 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -1776,25 +1776,23 @@ public class Controller // best scale factor int thumbnailWidth = thumbnail.getWidth(); int thumbnailHeight = thumbnail.getHeight(); - float scaleFactorX = 1.0f; - float scaleFactorY = 1.0f; + float scaleFactor = 1.0f; if (thumbnailWidth > 0) { - scaleFactorX = (float) width / (float)thumbnailWidth; + scaleFactor = (float) width / (float)thumbnailWidth; } else { return null; } + if (view.getWidth() > view.getHeight() && thumbnailHeight < view.getHeight() && thumbnailHeight > 0) { // If the device is in landscape and the page is shorter - // than the height of the view, stretch the thumbnail to fill the - // space. - scaleFactorY = (float) height / (float)thumbnailHeight; - } else { - // In the portrait case, this looks nice. - scaleFactorY = scaleFactorX; + // than the height of the view, center the thumnail and crop the sides + scaleFactor = (float) height / (float)thumbnailHeight; + float wx = (thumbnailWidth * scaleFactor) - width; + canvas.translate((int) -(wx / 2), 0); } - canvas.scale(scaleFactorX, scaleFactorY); + canvas.scale(scaleFactor, scaleFactor); thumbnail.draw(canvas); return bm; |
