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

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: 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 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size)); 1502 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size));
1503 return; 1503 return;
1504 } 1504 }
1505 1505
1506 // Map the given DIB ID into this process, and unmap it at the end 1506 // Map the given DIB ID into this process, and unmap it at the end
1507 // of this function. 1507 // of this function.
1508 scoped_ptr<TransportDIB> paint_at_size_buffer( 1508 scoped_ptr<TransportDIB> paint_at_size_buffer(
1509 TransportDIB::CreateWithHandle(dib_handle)); 1509 TransportDIB::CreateWithHandle(dib_handle));
1510 1510
1511 gfx::Size page_size_in_pixel = gfx::ToFlooredSize( 1511 gfx::Size page_size_in_pixel = gfx::ToFlooredSize(
1512 page_size.Scale(device_scale_factor_)); 1512 gfx::ScaleSize(page_size, device_scale_factor_));
1513 gfx::Size desired_size_in_pixel = gfx::ToFlooredSize( 1513 gfx::Size desired_size_in_pixel = gfx::ToFlooredSize(
1514 desired_size.Scale(device_scale_factor_)); 1514 gfx::ScaleSize(desired_size, device_scale_factor_));
1515 gfx::Size canvas_size = page_size_in_pixel; 1515 gfx::Size canvas_size = page_size_in_pixel;
1516 float x_scale = static_cast<float>(desired_size_in_pixel.width()) / 1516 float x_scale = static_cast<float>(desired_size_in_pixel.width()) /
1517 static_cast<float>(canvas_size.width()); 1517 static_cast<float>(canvas_size.width());
1518 float y_scale = static_cast<float>(desired_size_in_pixel.height()) / 1518 float y_scale = static_cast<float>(desired_size_in_pixel.height()) /
1519 static_cast<float>(canvas_size.height()); 1519 static_cast<float>(canvas_size.height());
1520 1520
1521 gfx::Rect orig_bounds(canvas_size); 1521 gfx::Rect orig_bounds(canvas_size);
1522 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale)); 1522 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale));
1523 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale)); 1523 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale));
1524 gfx::Rect bounds(canvas_size); 1524 gfx::Rect bounds(canvas_size);
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 bool RenderWidget::WillHandleGestureEvent( 1922 bool RenderWidget::WillHandleGestureEvent(
1923 const WebKit::WebGestureEvent& event) { 1923 const WebKit::WebGestureEvent& event) {
1924 return false; 1924 return false;
1925 } 1925 }
1926 1926
1927 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1927 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1928 return false; 1928 return false;
1929 } 1929 }
1930 1930
1931 } // namespace content 1931 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698