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
diff --git a/res/raw/thumb_amazon.png b/res/raw/thumb_amazon.png
index eec1d77..4dd2f35 100644
--- a/res/raw/thumb_amazon.png
+++ b/res/raw/thumb_amazon.png
Binary files differ
diff --git a/res/raw/thumb_bbc.png b/res/raw/thumb_bbc.png
index 9cdd902..dff0424 100644
--- a/res/raw/thumb_bbc.png
+++ b/res/raw/thumb_bbc.png
Binary files differ
diff --git a/res/raw/thumb_cnn.png b/res/raw/thumb_cnn.png
index 70b7ea2..3d6fdc9 100644
--- a/res/raw/thumb_cnn.png
+++ b/res/raw/thumb_cnn.png
Binary files differ
diff --git a/res/raw/thumb_ebay.png b/res/raw/thumb_ebay.png
index 070fa6c..023f678 100644
--- a/res/raw/thumb_ebay.png
+++ b/res/raw/thumb_ebay.png
Binary files differ
diff --git a/res/raw/thumb_espn.png b/res/raw/thumb_espn.png
index 94918e2..c0882eb 100644
--- a/res/raw/thumb_espn.png
+++ b/res/raw/thumb_espn.png
Binary files differ
diff --git a/res/raw/thumb_facebook.png b/res/raw/thumb_facebook.png
index 6e295b1..a8c047f 100644
--- a/res/raw/thumb_facebook.png
+++ b/res/raw/thumb_facebook.png
Binary files differ
diff --git a/res/raw/thumb_google.png b/res/raw/thumb_google.png
index 1753788..c54e6ea 100644
--- a/res/raw/thumb_google.png
+++ b/res/raw/thumb_google.png
Binary files differ
diff --git a/res/raw/thumb_msn.png b/res/raw/thumb_msn.png
index 2240e12..4ad710f 100644
--- a/res/raw/thumb_msn.png
+++ b/res/raw/thumb_msn.png
Binary files differ
diff --git a/res/raw/thumb_myspace.png b/res/raw/thumb_myspace.png
index 3f39ac5..d6f6e76 100644
--- a/res/raw/thumb_myspace.png
+++ b/res/raw/thumb_myspace.png
Binary files differ
diff --git a/res/raw/thumb_picasa.png b/res/raw/thumb_picasa.png
index dca6a7d..5ec2d7a 100644
--- a/res/raw/thumb_picasa.png
+++ b/res/raw/thumb_picasa.png
Binary files differ
diff --git a/res/raw/thumb_weatherchannel.png b/res/raw/thumb_weatherchannel.png
index c91e54c..a190a0c 100644
--- a/res/raw/thumb_weatherchannel.png
+++ b/res/raw/thumb_weatherchannel.png
Binary files differ
diff --git a/res/raw/thumb_yahoo.png b/res/raw/thumb_yahoo.png
index 115d8bb..08dd759 100644
--- a/res/raw/thumb_yahoo.png
+++ b/res/raw/thumb_yahoo.png
Binary files differ
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 6b0ab0e..7d183f6 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1776,25 +1776,23 @@
// 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;