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

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: rebase 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') | no next file with comments »
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 dab34e52167198d0c0386f76557b0543aa462d88..a338c5e089ea42cb00599286412440a390c7f43e 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/scrollbar_size.h"
@@ -270,8 +271,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_size_in_pixel = desired_size.Scale(scale_factor);
scoped_ptr<TransportDIB> thumbnail_dib(TransportDIB::Create(
- desired_size.width() * desired_size.height() * 4, sequence_num));
+ desired_size_in_pixel.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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698