OLD | NEW |
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 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 // given, to avoid leaking it. | 1446 // given, to avoid leaking it. |
1447 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size)); | 1447 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size)); |
1448 return; | 1448 return; |
1449 } | 1449 } |
1450 | 1450 |
1451 // Map the given DIB ID into this process, and unmap it at the end | 1451 // Map the given DIB ID into this process, and unmap it at the end |
1452 // of this function. | 1452 // of this function. |
1453 scoped_ptr<TransportDIB> paint_at_size_buffer( | 1453 scoped_ptr<TransportDIB> paint_at_size_buffer( |
1454 TransportDIB::CreateWithHandle(dib_handle)); | 1454 TransportDIB::CreateWithHandle(dib_handle)); |
1455 | 1455 |
1456 gfx::Size canvas_size = page_size; | 1456 gfx::Size page_size_in_pixel = page_size.Scale(device_scale_factor_); |
1457 float x_scale = static_cast<float>(desired_size.width()) / | 1457 gfx::Size desired_size_in_pixel = desired_size.Scale(device_scale_factor_); |
| 1458 gfx::Size canvas_size = page_size_in_pixel; |
| 1459 float x_scale = static_cast<float>(desired_size_in_pixel.width()) / |
1458 static_cast<float>(canvas_size.width()); | 1460 static_cast<float>(canvas_size.width()); |
1459 float y_scale = static_cast<float>(desired_size.height()) / | 1461 float y_scale = static_cast<float>(desired_size_in_pixel.height()) / |
1460 static_cast<float>(canvas_size.height()); | 1462 static_cast<float>(canvas_size.height()); |
1461 | 1463 |
1462 gfx::Rect orig_bounds(canvas_size); | 1464 gfx::Rect orig_bounds(canvas_size); |
1463 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale)); | 1465 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale)); |
1464 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale)); | 1466 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale)); |
1465 gfx::Rect bounds(canvas_size); | 1467 gfx::Rect bounds(canvas_size); |
1466 | 1468 |
1467 scoped_ptr<skia::PlatformCanvas> canvas( | 1469 scoped_ptr<skia::PlatformCanvas> canvas( |
1468 paint_at_size_buffer->GetPlatformCanvas(canvas_size.width(), | 1470 paint_at_size_buffer->GetPlatformCanvas(canvas_size.width(), |
1469 canvas_size.height())); | 1471 canvas_size.height())); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far)); | 1795 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far)); |
1794 } | 1796 } |
1795 | 1797 |
1796 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1798 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
1797 return false; | 1799 return false; |
1798 } | 1800 } |
1799 | 1801 |
1800 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1802 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
1801 return false; | 1803 return false; |
1802 } | 1804 } |
OLD | NEW |