diff options
author | John Reck <jreck@google.com> | 2011-01-05 10:18:03 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-01-05 10:25:01 -0800 |
commit | 5c6ac2f0bc02b9e91154f7c0b82a67c0a7bdd9b9 (patch) | |
tree | b8b45d3639b5961c96c034848d76bf54c1f72af4 /src/com/android/browser | |
parent | e969cc59ddcc763ab9d6349a854dd17a6456d1a4 (diff) | |
download | packages_apps_Browser-5c6ac2f0bc02b9e91154f7c0b82a67c0a7bdd9b9.zip packages_apps_Browser-5c6ac2f0bc02b9e91154f7c0b82a67c0a7bdd9b9.tar.gz packages_apps_Browser-5c6ac2f0bc02b9e91154f7c0b82a67c0a7bdd9b9.tar.bz2 |
Adds pseudo AA to thumbnails
Bug: 3321583
This changes the thumbnail rendering to draw to a bitmap 2x as large
and then down-scale with filtering to try and reduce aliasing on the
thumbnails.
Change-Id: Ifdc5254d6c49afbbd0b50d57a90f08faf25789e2
Diffstat (limited to 'src/com/android/browser')
-rw-r--r-- | src/com/android/browser/Controller.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index 6541ec0..6a01136 100644 --- a/src/com/android/browser/Controller.java +++ b/src/com/android/browser/Controller.java @@ -1848,10 +1848,16 @@ public class Controller } private static Bitmap createScreenshot(WebView view, int width, int height) { + // We render to a bitmap 2x the desired size so that we can then + // re-scale it with filtering since canvas.scale doesn't filter + // This helps reduce aliasing at the cost of being slightly blurry + final int filter_scale = 2; Picture thumbnail = view.capturePicture(); if (thumbnail == null) { return null; } + width *= filter_scale; + height *= filter_scale; Bitmap bm = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565); Canvas canvas = new Canvas(bm); // May need to tweak these values to determine what is the @@ -1877,7 +1883,10 @@ public class Controller canvas.scale(scaleFactor, scaleFactor); thumbnail.draw(canvas); - return bm; + Bitmap ret = Bitmap.createScaledBitmap(bm, width / filter_scale, + height / filter_scale, true); + bm.recycle(); + return ret; } private void updateScreenshot(WebView view) { |