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

Side by Side Diff: content/renderer/render_widget.cc

Issue 11377068: ui: Make gfx::Size::Scale() mutate the class. Add gfx::ScaleSize() similar to Rect/Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseTOGO Created 8 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 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 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size)); 1537 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size));
1538 return; 1538 return;
1539 } 1539 }
1540 1540
1541 // Map the given DIB ID into this process, and unmap it at the end 1541 // Map the given DIB ID into this process, and unmap it at the end
1542 // of this function. 1542 // of this function.
1543 scoped_ptr<TransportDIB> paint_at_size_buffer( 1543 scoped_ptr<TransportDIB> paint_at_size_buffer(
1544 TransportDIB::CreateWithHandle(dib_handle)); 1544 TransportDIB::CreateWithHandle(dib_handle));
1545 1545
1546 gfx::Size page_size_in_pixel = gfx::ToFlooredSize( 1546 gfx::Size page_size_in_pixel = gfx::ToFlooredSize(
1547 page_size.Scale(device_scale_factor_)); 1547 gfx::ScaleSize(page_size, device_scale_factor_));
1548 gfx::Size desired_size_in_pixel = gfx::ToFlooredSize( 1548 gfx::Size desired_size_in_pixel = gfx::ToFlooredSize(
1549 desired_size.Scale(device_scale_factor_)); 1549 gfx::ScaleSize(desired_size, device_scale_factor_));
1550 gfx::Size canvas_size = page_size_in_pixel; 1550 gfx::Size canvas_size = page_size_in_pixel;
1551 float x_scale = static_cast<float>(desired_size_in_pixel.width()) / 1551 float x_scale = static_cast<float>(desired_size_in_pixel.width()) /
1552 static_cast<float>(canvas_size.width()); 1552 static_cast<float>(canvas_size.width());
1553 float y_scale = static_cast<float>(desired_size_in_pixel.height()) / 1553 float y_scale = static_cast<float>(desired_size_in_pixel.height()) /
1554 static_cast<float>(canvas_size.height()); 1554 static_cast<float>(canvas_size.height());
1555 1555
1556 gfx::Rect orig_bounds(canvas_size); 1556 gfx::Rect orig_bounds(canvas_size);
1557 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale)); 1557 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale));
1558 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale)); 1558 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale));
1559 gfx::Rect bounds(canvas_size); 1559 gfx::Rect bounds(canvas_size);
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 bool RenderWidget::WillHandleGestureEvent( 1965 bool RenderWidget::WillHandleGestureEvent(
1966 const WebKit::WebGestureEvent& event) { 1966 const WebKit::WebGestureEvent& event) {
1967 return false; 1967 return false;
1968 } 1968 }
1969 1969
1970 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1970 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1971 return false; 1971 return false;
1972 } 1972 }
1973 1973
1974 } // namespace content 1974 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/render_widget_fullscreen_pepper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698