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

Unified Diff: chrome/browser/tab_contents/thumbnail_generator.cc

Issue 10831186: Make ThumbnailGenerator::AskForSnapshot support high DPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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 | content/renderer/render_widget.cc » ('j') | content/renderer/render_widget.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/thumbnail_generator.cc
diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc
index f5cfb5790b4a28ef32796fc61f404515a21408da..5a79729d19b7258d4616e268b4bd9bc556a46e30 100644
--- a/chrome/browser/tab_contents/thumbnail_generator.cc
+++ b/chrome/browser/tab_contents/thumbnail_generator.cc
@@ -28,6 +28,7 @@
#include "skia/ext/image_operations.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/layout.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/skbitmap_operations.h"
@@ -218,8 +219,11 @@ void ThumbnailGenerator::AskForSnapshot(RenderWidgetHost* renderer,
// this callback for later lookup when the rendering is done.
static int sequence_num = 0;
sequence_num++;
+ float scale_factor = ui::GetScaleFactorScale(ui::GetScaleFactorForNativeView(
+ renderer->GetView()->GetNativeView()));
+ gfx::Size desired_pixel_size = desired_size.Scale(scale_factor);
oshima 2012/08/07 03:22:21 I think desired_size_in_pixel is more clear and be
mazda 2012/08/07 03:55:50 Done.
scoped_ptr<TransportDIB> thumbnail_dib(TransportDIB::Create(
- desired_size.width() * desired_size.height() * 4, sequence_num));
+ desired_pixel_size.GetArea() * 4, sequence_num));
#if defined(USE_X11)
// TODO: IPC a handle to the renderer like Windows.
« no previous file with comments | « no previous file | content/renderer/render_widget.cc » ('j') | content/renderer/render_widget.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698