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

Unified Diff: ui/compositor/dip_util.cc

Issue 10310067: Remove ui-enable-dip option (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/dip_util.h ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/compositor/dip_util.h ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698