From 5c6ac2f0bc02b9e91154f7c0b82a67c0a7bdd9b9 Mon Sep 17 00:00:00 2001 From: John Reck Date: Wed, 5 Jan 2011 10:18:03 -0800 Subject: 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 --- src/com/android/browser/Controller.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java index 6541ec035..6a0113646 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) { -- cgit v1.2.3