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

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

Issue 11081007: Remove implicit flooring Scale() method from Point and Size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 20 matching lines...) Expand all
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h"
33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" 33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
34 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" 34 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
35 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 35 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
36 #include "third_party/skia/include/core/SkShader.h" 36 #include "third_party/skia/include/core/SkShader.h"
37 #include "ui/base/ui_base_switches.h" 37 #include "ui/base/ui_base_switches.h"
38 #include "ui/gfx/point.h" 38 #include "ui/gfx/point.h"
39 #include "ui/gfx/rect_conversions.h" 39 #include "ui/gfx/rect_conversions.h"
40 #include "ui/gfx/size.h" 40 #include "ui/gfx/size.h"
41 #include "ui/gfx/size_conversions.h"
41 #include "ui/gfx/skia_util.h" 42 #include "ui/gfx/skia_util.h"
42 #include "ui/gl/gl_switches.h" 43 #include "ui/gl/gl_switches.h"
43 #include "ui/surface/transport_dib.h" 44 #include "ui/surface/transport_dib.h"
44 #include "webkit/glue/webkit_glue.h" 45 #include "webkit/glue/webkit_glue.h"
45 #include "webkit/plugins/npapi/webplugin.h" 46 #include "webkit/plugins/npapi/webplugin.h"
46 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 47 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
47 48
48 #if defined(OS_POSIX) 49 #if defined(OS_POSIX)
49 #include "ipc/ipc_channel_posix.h" 50 #include "ipc/ipc_channel_posix.h"
50 #include "third_party/skia/include/core/SkMallocPixelRef.h" 51 #include "third_party/skia/include/core/SkMallocPixelRef.h"
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 // given, to avoid leaking it. 1488 // given, to avoid leaking it.
1488 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size)); 1489 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, desired_size));
1489 return; 1490 return;
1490 } 1491 }
1491 1492
1492 // Map the given DIB ID into this process, and unmap it at the end 1493 // Map the given DIB ID into this process, and unmap it at the end
1493 // of this function. 1494 // of this function.
1494 scoped_ptr<TransportDIB> paint_at_size_buffer( 1495 scoped_ptr<TransportDIB> paint_at_size_buffer(
1495 TransportDIB::CreateWithHandle(dib_handle)); 1496 TransportDIB::CreateWithHandle(dib_handle));
1496 1497
1497 gfx::Size page_size_in_pixel = page_size.Scale(device_scale_factor_); 1498 gfx::Size page_size_in_pixel = gfx::ToFlooredSize(
1498 gfx::Size desired_size_in_pixel = desired_size.Scale(device_scale_factor_); 1499 page_size.Scale(device_scale_factor_));
1500 gfx::Size desired_size_in_pixel = gfx::ToFlooredSize(
1501 desired_size.Scale(device_scale_factor_));
1499 gfx::Size canvas_size = page_size_in_pixel; 1502 gfx::Size canvas_size = page_size_in_pixel;
1500 float x_scale = static_cast<float>(desired_size_in_pixel.width()) / 1503 float x_scale = static_cast<float>(desired_size_in_pixel.width()) /
1501 static_cast<float>(canvas_size.width()); 1504 static_cast<float>(canvas_size.width());
1502 float y_scale = static_cast<float>(desired_size_in_pixel.height()) / 1505 float y_scale = static_cast<float>(desired_size_in_pixel.height()) /
1503 static_cast<float>(canvas_size.height()); 1506 static_cast<float>(canvas_size.height());
1504 1507
1505 gfx::Rect orig_bounds(canvas_size); 1508 gfx::Rect orig_bounds(canvas_size);
1506 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale)); 1509 canvas_size.set_width(static_cast<int>(canvas_size.width() * x_scale));
1507 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale)); 1510 canvas_size.set_height(static_cast<int>(canvas_size.height() * y_scale));
1508 gfx::Rect bounds(canvas_size); 1511 gfx::Rect bounds(canvas_size);
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 pending_smooth_scroll_gestures_.insert(std::make_pair(id, callback)); 1890 pending_smooth_scroll_gestures_.insert(std::make_pair(id, callback));
1888 } 1891 }
1889 1892
1890 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 1893 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
1891 return false; 1894 return false;
1892 } 1895 }
1893 1896
1894 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1897 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1895 return false; 1898 return false;
1896 } 1899 }
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin_backing_store.cc ('k') | content/renderer/render_widget_fullscreen_pepper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698