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

Side by Side Diff: ui/compositor/dip_util.h

Issue 10221028: Move DIP translation from ui/aura to ui/compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable tests that doesn't run on bots 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/compositor/compositor_switches.cc ('k') | ui/compositor/dip_util.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 (c) 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 #ifndef UI_COMPOSITOR_DIP_UTIL_H_
6 #define UI_COMPOSITOR_DIP_UTIL_H_
7 #pragma once
8
9 #include "ui/compositor/compositor_export.h"
10 #include "base/basictypes.h"
11
12 namespace gfx {
13 class Point;
14 class Size;
15 class Rect;
16 } // namespace gfx
17
18 namespace ui {
19 namespace test {
20
21 // A scoped object allows you to temporarily enable DIP
22 // in the unit tests.
23 class COMPOSITOR_EXPORT ScopedDIPEnablerForTest {
24 public:
25 ScopedDIPEnablerForTest();
26 ~ScopedDIPEnablerForTest();
27
28 private:
29 DISALLOW_COPY_AND_ASSIGN(ScopedDIPEnablerForTest);
30 };
31
32 } // namespace test
33
34 class Layer;
35
36 // True if DIP is enabled.
37 COMPOSITOR_EXPORT bool IsDIPEnabled();
38
39 COMPOSITOR_EXPORT float GetDeviceScaleFactor(const Layer* layer);
40
41 // Utility functions that convert point/size/rect between
42 // DIP and pixel coordinates system.
43 COMPOSITOR_EXPORT gfx::Point ConvertPointToDIP(
44 const Layer* layer,
45 const gfx::Point& point_in_pixel);
46 COMPOSITOR_EXPORT gfx::Size ConvertSizeToDIP(
47 const Layer* layer,
48 const gfx::Size& size_in_pixel);
49 COMPOSITOR_EXPORT gfx::Rect ConvertRectToDIP(
50 const Layer* layer,
51 const gfx::Rect& rect_in_pixel);
52 COMPOSITOR_EXPORT gfx::Point ConvertPointToPixel(
53 const Layer* layer,
54 const gfx::Point& point_in_dip);
55 COMPOSITOR_EXPORT gfx::Size ConvertSizeToPixel(
56 const Layer* layer,
57 const gfx::Size& size_in_dip);
58 COMPOSITOR_EXPORT gfx::Rect ConvertRectToPixel(
59 const Layer* layer,
60 const gfx::Rect& rect_in_dip);
61
62 } // namespace ui
63
64 #endif // UI_COMPOSITOR_DIP_UTIL_H_
OLDNEW
« no previous file with comments | « ui/compositor/compositor_switches.cc ('k') | ui/compositor/dip_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698