OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
sky
2014/02/04 15:14:40
2014
| |
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 #ifndef UI_GFX_SCREEN_TYPE_DELEGATE_H_ | 5 #ifndef UI_GFX_GEOMETRY_CUBIC_BEZIER_H_ |
sky
2014/02/04 15:14:40
nit: play with the --similarity so this isn't seen
| |
6 #define UI_GFX_SCREEN_TYPE_DELEGATE_H_ | 6 #define UI_GFX_GEOMETRY_CUBIC_BEZIER_H_ |
7 | 7 |
8 #include "ui/gfx/native_widget_types.h" | 8 #include "base/macros.h" |
9 #include "ui/gfx/gfx_export.h" | |
9 | 10 |
10 namespace gfx { | 11 namespace gfx { |
11 | 12 |
12 enum GFX_EXPORT ScreenType { | 13 class GFX_EXPORT CubicBezier { |
13 SCREEN_TYPE_NATIVE = 0, | 14 public: |
14 #if defined(OS_CHROMEOS) | 15 CubicBezier(double x1, double y1, double x2, double y2); |
15 SCREEN_TYPE_ALTERNATE = SCREEN_TYPE_NATIVE, | 16 virtual ~CubicBezier(); |
sky
2014/02/04 15:14:40
Why the virtual?
| |
16 #else | |
17 SCREEN_TYPE_ALTERNATE, | |
18 #endif | |
19 SCREEN_TYPE_LAST = SCREEN_TYPE_ALTERNATE, | |
20 }; | |
21 | 17 |
22 class GFX_EXPORT ScreenTypeDelegate { | 18 // Returns an approximation of y at the given x. |
23 public: | 19 double Solve(double x) const; |
24 virtual ~ScreenTypeDelegate() {} | |
25 | 20 |
26 // Determines which ScreenType a given |view| belongs to. | 21 // Sets |min| and |max| to the bezier's minimum and maximium y values in the |
27 virtual ScreenType GetScreenTypeForNativeView(NativeView view) = 0; | 22 // interval [0, 1]. |
23 virtual void Range(double* min, double* max) const; | |
24 | |
25 private: | |
26 double x1_; | |
27 double y1_; | |
28 double x2_; | |
29 double y2_; | |
30 | |
31 DISALLOW_ASSIGN(CubicBezier); | |
28 }; | 32 }; |
29 | 33 |
30 } // namespace gfx | 34 } // namespace gfx |
31 | 35 |
32 #endif // UI_GFX_SCREEN_TYPE_DELEGATE_H_ | 36 #endif // UI_GFX_GEOMETRY_CUBIC_BEZIER_H_ |
OLD | NEW |