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

Side by Side Diff: content/renderer/render_widget.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 // given, to avoid leaking it. 1433 // given, to avoid leaking it.
1434 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size)); 1434 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size));
1435 return; 1435 return;
1436 } 1436 }
1437 1437
1438 // Map the given DIB ID into this process, and unmap it at the end 1438 // Map the given DIB ID into this process, and unmap it at the end
1439 // of this function. 1439 // of this function.
1440 scoped_ptr<TransportDIB> paint_at_size_buffer( 1440 scoped_ptr<TransportDIB> paint_at_size_buffer(
1441 TransportDIB::CreateWithHandle(dib_handle)); 1441 TransportDIB::CreateWithHandle(dib_handle));
1442 1442
1443 gfx::Size canvas_size = page_size; 1443 gfx::Size page_pixel_size = page_size.Scale(device_scale_factor_);
1444 float x_scale = static_cast<float>(desired_size.width()) / 1444 gfx::Size desired_pixel_size = desired_size.Scale(device_scale_factor_);
oshima 2012/08/07 03:22:21 same here.
mazda 2012/08/07 03:55:50 Done.
1445 gfx::Size canvas_size = page_pixel_size;
1446 float x_scale = static_cast<float>(desired_pixel_size.width()) /
1445 static_cast<float>(canvas_size.width()); 1447 static_cast<float>(canvas_size.width());
1446 float y_scale = static_cast<float>(desired_size.height()) / 1448 float y_scale = static_cast<float>(desired_pixel_size.height()) /
1447 static_cast<float>(canvas_size.height()); 1449 static_cast<float>(canvas_size.height());
1448 1450
1449 gfx::Rect orig_bounds(canvas_size); 1451 gfx::Rect orig_bounds(canvas_size);
1450 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale)); 1452 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale));
1451 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale)); 1453 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale));
1452 gfx::Rect bounds(canvas_size); 1454 gfx::Rect bounds(canvas_size);
1453 1455
1454 scoped_ptr<skia::PlatformCanvas> canvas( 1456 scoped_ptr<skia::PlatformCanvas> canvas(
1455 paint_at_size_buffer->GetPlatformCanvas(canvas_size.width(), 1457 paint_at_size_buffer->GetPlatformCanvas(canvas_size.width(),
1456 canvas_size.height())); 1458 canvas_size.height()));
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far)); 1775 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far));
1774 } 1776 }
1775 1777
1776 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 1778 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
1777 return false; 1779 return false;
1778 } 1780 }
1779 1781
1780 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1782 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1781 return false; 1783 return false;
1782 } 1784 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698