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

Side by Side Diff: ui/compositor/dip_util.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
« no previous file with comments | « content/renderer/render_widget_fullscreen_pepper.cc ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/compositor/dip_util.h" 5 #include "ui/compositor/dip_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "ui/base/ui_base_switches.h" 8 #include "ui/base/ui_base_switches.h"
9 #include "ui/compositor/compositor.h" 9 #include "ui/compositor/compositor.h"
10 #include "ui/compositor/compositor_switches.h" 10 #include "ui/compositor/compositor_switches.h"
(...skipping 14 matching lines...) Expand all
25 25
26 gfx::Point ConvertPointToDIP(const Layer* layer, 26 gfx::Point ConvertPointToDIP(const Layer* layer,
27 const gfx::Point& point_in_pixel) { 27 const gfx::Point& point_in_pixel) {
28 return gfx::ToFlooredPoint( 28 return gfx::ToFlooredPoint(
29 gfx::ScalePoint(point_in_pixel, 1.0f / GetDeviceScaleFactor(layer))); 29 gfx::ScalePoint(point_in_pixel, 1.0f / GetDeviceScaleFactor(layer)));
30 } 30 }
31 31
32 gfx::Size ConvertSizeToDIP(const Layer* layer, 32 gfx::Size ConvertSizeToDIP(const Layer* layer,
33 const gfx::Size& size_in_pixel) { 33 const gfx::Size& size_in_pixel) {
34 return gfx::ToFlooredSize( 34 return gfx::ToFlooredSize(
35 size_in_pixel.Scale(1.0f / GetDeviceScaleFactor(layer))); 35 gfx::ScaleSize(size_in_pixel, 1.0f / GetDeviceScaleFactor(layer)));
36 } 36 }
37 37
38 gfx::Rect ConvertRectToDIP(const Layer* layer, 38 gfx::Rect ConvertRectToDIP(const Layer* layer,
39 const gfx::Rect& rect_in_pixel) { 39 const gfx::Rect& rect_in_pixel) {
40 float scale = 1.0f / GetDeviceScaleFactor(layer); 40 float scale = 1.0f / GetDeviceScaleFactor(layer);
41 return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_pixel, scale)); 41 return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_pixel, scale));
42 } 42 }
43 43
44 gfx::Point ConvertPointToPixel(const Layer* layer, 44 gfx::Point ConvertPointToPixel(const Layer* layer,
45 const gfx::Point& point_in_dip) { 45 const gfx::Point& point_in_dip) {
46 return gfx::ToFlooredPoint( 46 return gfx::ToFlooredPoint(
47 gfx::ScalePoint(point_in_dip, GetDeviceScaleFactor(layer))); 47 gfx::ScalePoint(point_in_dip, GetDeviceScaleFactor(layer)));
48 } 48 }
49 49
50 gfx::Size ConvertSizeToPixel(const Layer* layer, 50 gfx::Size ConvertSizeToPixel(const Layer* layer,
51 const gfx::Size& size_in_dip) { 51 const gfx::Size& size_in_dip) {
52 return gfx::ToFlooredSize(size_in_dip.Scale(GetDeviceScaleFactor(layer))); 52 return gfx::ToFlooredSize(
53 gfx::ScaleSize(size_in_dip, GetDeviceScaleFactor(layer)));
53 } 54 }
54 55
55 gfx::Rect ConvertRectToPixel(const Layer* layer, 56 gfx::Rect ConvertRectToPixel(const Layer* layer,
56 const gfx::Rect& rect_in_dip) { 57 const gfx::Rect& rect_in_dip) {
57 float scale = GetDeviceScaleFactor(layer); 58 float scale = GetDeviceScaleFactor(layer);
58 return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_dip, scale)); 59 return gfx::ToFlooredRectDeprecated(gfx::ScaleRect(rect_in_dip, scale));
59 } 60 }
60 } // namespace ui 61 } // namespace ui
OLDNEW
« no previous file with comments | « content/renderer/render_widget_fullscreen_pepper.cc ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698