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

Side by Side Diff: ui/gfx/screen.cc

Issue 1964153002: Move Screen, its impls, DisplayObserver and DisplayChangeNotifier to ui/display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tabs Created 4 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/screen.h ('k') | ui/gfx/screen_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/gfx/screen.h"
6
7 #include "ui/gfx/geometry/rect.h"
8
9 namespace gfx {
10
11 namespace {
12
13 Screen* g_screen;
14
15 } // namespace
16
17 Screen::Screen() {
18 }
19
20 Screen::~Screen() {
21 }
22
23 // static
24 Screen* Screen::GetScreen() {
25 #if defined(OS_MACOSX) || defined(OS_ANDROID)
26 // TODO(scottmg): https://crbug.com/558054
27 if (!g_screen)
28 g_screen = CreateNativeScreen();
29 #endif
30 return g_screen;
31 }
32
33 // static
34 void Screen::SetScreenInstance(Screen* instance) {
35 g_screen = instance;
36 }
37
38 gfx::Rect Screen::ScreenToDIPRectInWindow(NativeView view,
39 const gfx::Rect& screen_rect) const {
40 float scale = GetDisplayNearestWindow(view).device_scale_factor();
41 return ScaleToEnclosingRect(screen_rect, 1.0f / scale);
42 }
43
44 gfx::Rect Screen::DIPToScreenRectInWindow(NativeView view,
45 const gfx::Rect& dip_rect) const {
46 float scale = GetDisplayNearestWindow(view).device_scale_factor();
47 return ScaleToEnclosingRect(dip_rect, scale);
48 }
49
50 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/screen.h ('k') | ui/gfx/screen_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698