Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 REMOTING_HOST_SCREEN_RESOLUTION_H_ | 5 #ifndef REMOTING_HOST_SCREEN_RESOLUTION_H_ |
| 6 #define REMOTING_HOST_SCREEN_RESOLUTION_H_ | 6 #define REMOTING_HOST_SCREEN_RESOLUTION_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 "third_party/skia/include/core/SkPoint.h" | 10 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 11 #include "third_party/skia/include/core/SkSize.h" | |
| 12 | 11 |
| 13 namespace remoting { | 12 namespace remoting { |
| 14 | 13 |
| 15 // Describes a screen's dimensions and DPI. | 14 // Describes a screen's dimensions and DPI. |
| 16 class ScreenResolution { | 15 class ScreenResolution { |
| 17 public: | 16 public: |
| 18 ScreenResolution(); | 17 ScreenResolution(); |
| 19 | 18 ScreenResolution(const webrtc::DesktopSize& dimensions, |
| 20 ScreenResolution(const SkISize& dimensions, const SkIPoint& dpi); | 19 const webrtc::DesktopVector& dpi); |
| 21 | 20 |
| 22 // Returns the screen dimensions scaled according to the passed |new_dpi|. | 21 // Returns the screen dimensions scaled according to the passed |new_dpi|. |
| 23 SkISize ScaleDimensionsToDpi(const SkIPoint& new_dpi) const; | 22 webrtc::DesktopSize ScaleDimensionsToDpi( |
| 23 const webrtc::DesktopVector& new_dpi) const; | |
| 24 | |
| 25 // Dimensions of the screen in pixels. | |
| 26 const webrtc::DesktopSize& dimensions() const { return dimensions_; } | |
| 27 | |
| 28 // The vertical and horizontal DPI of the screen. | |
| 29 const webrtc::DesktopVector& dpi() const { return dpi_; } | |
| 24 | 30 |
| 25 // Returns true if |dimensions_| specifies an empty rectangle or when | 31 // Returns true if |dimensions_| specifies an empty rectangle or when |
| 26 // IsValid() returns false. | 32 // IsValid() returns false. |
| 27 bool IsEmpty() const; | 33 bool IsEmpty() const; |
| 28 | 34 |
| 29 // Returns true if both |dimensions_| and |dpi_| are valid. |dimensions_| | 35 private: |
| 30 // specifying an empty rectangle is considered to be valid. | 36 webrtc::DesktopSize dimensions_; |
|
alexeypa (please no reviews)
2013/04/26 21:33:58
I believe the reason to have public fields was IPC
Sergey Ulanov
2013/05/07 22:25:50
You can do it without making these fields public.
| |
| 31 bool IsValid() const; | 37 webrtc::DesktopVector dpi_; |
| 32 | |
| 33 // Dimensions of the screen in pixels. | |
| 34 SkISize dimensions_; | |
| 35 | |
| 36 // The vertical and horizontal DPI of the screen. | |
| 37 SkIPoint dpi_; | |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 } // namespace remoting | 40 } // namespace remoting |
| 41 | 41 |
| 42 #endif // REMOTING_HOST_SCREEN_RESOLUTION_H_ | 42 #endif // REMOTING_HOST_SCREEN_RESOLUTION_H_ |
| OLD | NEW |