| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_DISPLAY_H_ | 5 #ifndef UI_GFX_DISPLAY_H_ |
| 6 #define UI_GFX_DISPLAY_H_ | 6 #define UI_GFX_DISPLAY_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/base/ui_export.h" | 10 #include "ui/base/ui_export.h" |
| 11 #include "ui/gfx/insets.h" |
| 11 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 12 | 13 |
| 13 namespace gfx { | 14 namespace gfx { |
| 14 | 15 |
| 15 // Note: The screen and display currently uses pixel coordinate | 16 // Note: The screen and display currently uses pixel coordinate |
| 16 // system. For platforms that support DIP (density independent pixel), | 17 // system. For platforms that support DIP (density independent pixel), |
| 17 // |bounds()| and |work_area| will return values in DIP coordinate | 18 // |bounds()| and |work_area| will return values in DIP coordinate |
| 18 // system, not in backing pixels. | 19 // system, not in backing pixels. |
| 19 class UI_EXPORT Display { | 20 class UI_EXPORT Display { |
| 20 public: | 21 public: |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 const gfx::Rect& bounds_in_pixel); | 68 const gfx::Rect& bounds_in_pixel); |
| 68 | 69 |
| 69 // Sets the display's size. This updates the work area using the same insets | 70 // Sets the display's size. This updates the work area using the same insets |
| 70 // between old bounds and work area. | 71 // between old bounds and work area. |
| 71 void SetSize(const gfx::Size& size_in_pixel); | 72 void SetSize(const gfx::Size& size_in_pixel); |
| 72 | 73 |
| 73 // Computes and updates the display's work are using | 74 // Computes and updates the display's work are using |
| 74 // |work_area_insets| and the bounds. | 75 // |work_area_insets| and the bounds. |
| 75 void UpdateWorkAreaFromInsets(const gfx::Insets& work_area_insets); | 76 void UpdateWorkAreaFromInsets(const gfx::Insets& work_area_insets); |
| 76 | 77 |
| 78 void SetOverscanInsets(const gfx::Insets& insets); |
| 79 |
| 77 // Returns the display's size in pixel coordinates. | 80 // Returns the display's size in pixel coordinates. |
| 78 gfx::Size GetSizeInPixel() const; | 81 gfx::Size GetSizeInPixel() const; |
| 79 | 82 |
| 80 #if defined(USE_AURA) | 83 #if defined(USE_AURA) |
| 81 // TODO(oshima|skuhne): Eliminate the use of bounds_in_pixel in events_x.cc | 84 // TODO(oshima|skuhne): Eliminate the use of bounds_in_pixel in events_x.cc |
| 82 // and remove bounds_in_pixel from gfx::Display. | 85 // and remove bounds_in_pixel from gfx::Display. |
| 83 // Returns the display's bounds in pixel coordinates. | 86 // Returns the display's bounds in pixel coordinates. |
| 84 const Rect& bounds_in_pixel() const { return bounds_in_pixel_; } | 87 const Rect& bounds_in_pixel() const { return bounds_in_pixel_; } |
| 85 #endif | 88 #endif |
| 86 | 89 |
| 87 // Returns a string representation of the display; | 90 // Returns a string representation of the display; |
| 88 std::string ToString() const; | 91 std::string ToString() const; |
| 89 | 92 |
| 90 // True if the display contains valid display id. | 93 // True if the display contains valid display id. |
| 91 bool is_valid() const { return id_ != kInvalidDisplayID; } | 94 bool is_valid() const { return id_ != kInvalidDisplayID; } |
| 92 | 95 |
| 93 static const int64 kInvalidDisplayID; | 96 static const int64 kInvalidDisplayID; |
| 94 | 97 |
| 95 private: | 98 private: |
| 96 int64 id_; | 99 int64 id_; |
| 97 Rect bounds_; | 100 Rect bounds_; |
| 98 Rect work_area_; | 101 Rect work_area_; |
| 99 #if defined(USE_AURA) | 102 #if defined(USE_AURA) |
| 100 Rect bounds_in_pixel_; | 103 Rect bounds_in_pixel_; |
| 101 #endif | 104 #endif |
| 105 Insets overscan_insets_; |
| 102 float device_scale_factor_; | 106 float device_scale_factor_; |
| 103 }; | 107 }; |
| 104 | 108 |
| 105 } // namespace gfx | 109 } // namespace gfx |
| 106 | 110 |
| 107 #endif // UI_GFX_DISPLAY_H_ | 111 #endif // UI_GFX_DISPLAY_H_ |
| OLD | NEW |