Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3838)

Unified Diff: chrome/renderer/render_view.cc

Issue 4860002: Merge 65982 - Downsample thumbnail by powers of two before doing lanczos... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/552/src/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
===================================================================
--- chrome/renderer/render_view.cc (revision 66011)
+++ chrome/renderer/render_view.cc (working copy)
@@ -92,6 +92,7 @@
#include "gfx/native_widget_types.h"
#include "gfx/point.h"
#include "gfx/rect.h"
+#include "gfx/skbitmap_operations.h"
#include "grit/generated_resources.h"
#include "grit/renderer_resources.h"
#include "media/base/media_switches.h"
@@ -1051,14 +1052,19 @@
SkBitmap subset;
device.accessBitmap(false).extractSubset(&subset, src_rect);
- // Resample the subset that we want to get it the right size.
+ // First do a fast downsample by powers of two to get close to the final size.
+ SkBitmap downsampled_subset =
+ SkBitmapOperations::DownsampleByTwoUntilSize(subset, w, h);
+
+ // Do a high-quality resize from the downscaled size to the final size.
*thumbnail = skia::ImageOperations::Resize(
- subset, skia::ImageOperations::RESIZE_LANCZOS3, w, h);
+ downsampled_subset, skia::ImageOperations::RESIZE_LANCZOS3, w, h);
score->boring_score = CalculateBoringScore(thumbnail);
HISTOGRAM_TIMES("Renderer4.Thumbnail",
base::TimeTicks::Now() - beginning_time);
+
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698