| Index: ui/compositor/dip_util.cc
|
| diff --git a/ui/compositor/dip_util.cc b/ui/compositor/dip_util.cc
|
| index 0fc3506532bae06618f5ab97a979eb2479c6847c..c02203a791e0237ca610dd3e90943a698fb6bc92 100644
|
| --- a/ui/compositor/dip_util.cc
|
| +++ b/ui/compositor/dip_util.cc
|
| @@ -15,91 +15,42 @@
|
| #include "ui/gfx/rect.h"
|
|
|
| namespace ui {
|
| -namespace {
|
| -bool dip_enabled_for_test = false;
|
| -} // namespace
|
| -
|
| -namespace test {
|
| -
|
| -ScopedDIPEnablerForTest::ScopedDIPEnablerForTest() {
|
| - CHECK(!dip_enabled_for_test);
|
| - dip_enabled_for_test = true;
|
| -}
|
| -
|
| -ScopedDIPEnablerForTest::~ScopedDIPEnablerForTest() {
|
| - dip_enabled_for_test = false;
|
| -}
|
| -
|
| -} // namespace test
|
| -
|
| -bool IsDIPEnabled() {
|
| - const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
| - static const bool dip_enabled =
|
| - command_line.HasSwitch(switches::kDefaultDeviceScaleFactor) ||
|
| - (command_line.HasSwitch(switches::kUIEnableDIP) &&
|
| - command_line.GetSwitchValueASCII(switches::kUIEnableDIP) != "false");
|
| - return dip_enabled || dip_enabled_for_test;
|
| -}
|
|
|
| float GetDeviceScaleFactor(const Layer* layer) {
|
| - if (!IsDIPEnabled())
|
| - return 1.0f;
|
| return layer->device_scale_factor();
|
| }
|
|
|
| gfx::Point ConvertPointToDIP(const Layer* layer,
|
| const gfx::Point& point_in_pixel) {
|
| - if (IsDIPEnabled())
|
| - return point_in_pixel.Scale(1.0f / GetDeviceScaleFactor(layer));
|
| - else
|
| - return point_in_pixel;
|
| + return point_in_pixel.Scale(1.0f / GetDeviceScaleFactor(layer));
|
| }
|
|
|
| gfx::Size ConvertSizeToDIP(const Layer* layer,
|
| const gfx::Size& size_in_pixel) {
|
| - if (IsDIPEnabled())
|
| - return size_in_pixel.Scale(1.0f / GetDeviceScaleFactor(layer));
|
| - else
|
| - return size_in_pixel;
|
| + return size_in_pixel.Scale(1.0f / GetDeviceScaleFactor(layer));
|
| }
|
|
|
| gfx::Rect ConvertRectToDIP(const Layer* layer,
|
| const gfx::Rect& rect_in_pixel) {
|
| - if (IsDIPEnabled()) {
|
| - float scale = 1.0f / GetDeviceScaleFactor(layer);
|
| - return gfx::Rect(rect_in_pixel.origin().Scale(scale),
|
| - rect_in_pixel.size().Scale(scale));
|
| - } else {
|
| - return rect_in_pixel;
|
| - }
|
| + float scale = 1.0f / GetDeviceScaleFactor(layer);
|
| + return gfx::Rect(rect_in_pixel.origin().Scale(scale),
|
| + rect_in_pixel.size().Scale(scale));
|
| }
|
|
|
| gfx::Point ConvertPointToPixel(const Layer* layer,
|
| const gfx::Point& point_in_dip) {
|
| - if (IsDIPEnabled()) {
|
| - return point_in_dip.Scale(GetDeviceScaleFactor(layer));
|
| - } else {
|
| - return point_in_dip;
|
| - }
|
| + return point_in_dip.Scale(GetDeviceScaleFactor(layer));
|
| }
|
|
|
| gfx::Size ConvertSizeToPixel(const Layer* layer,
|
| const gfx::Size& size_in_dip) {
|
| - if (IsDIPEnabled()) {
|
| - return size_in_dip.Scale(GetDeviceScaleFactor(layer));
|
| - } else {
|
| - return size_in_dip;
|
| - }
|
| + return size_in_dip.Scale(GetDeviceScaleFactor(layer));
|
| }
|
|
|
| gfx::Rect ConvertRectToPixel(const Layer* layer,
|
| const gfx::Rect& rect_in_dip) {
|
| - if (IsDIPEnabled()) {
|
| - float scale = GetDeviceScaleFactor(layer);
|
| - return gfx::Rect(rect_in_dip.origin().Scale(scale),
|
| - rect_in_dip.size().Scale(scale));
|
| - } else {
|
| - return rect_in_dip;
|
| - }
|
| + float scale = GetDeviceScaleFactor(layer);
|
| + return gfx::Rect(rect_in_dip.origin().Scale(scale),
|
| + rect_in_dip.size().Scale(scale));
|
| }
|
| } // namespace ui
|
|
|