Fix mouse warp with 2x displays
[chromium-blink-merge.git] / remoting / host / screen_resolution.h
blob8adc25e3d69e155ff03fd955ea67ba71f1dc6ebe
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_SCREEN_RESOLUTION_H_
6 #define REMOTING_HOST_SCREEN_RESOLUTION_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
12 namespace remoting {
14 // Describes a screen's dimensions and DPI.
15 class ScreenResolution {
16 public:
17 ScreenResolution();
18 ScreenResolution(const webrtc::DesktopSize& dimensions,
19 const webrtc::DesktopVector& dpi);
21 // Returns the screen dimensions scaled according to the passed |new_dpi|.
22 webrtc::DesktopSize ScaleDimensionsToDpi(
23 const webrtc::DesktopVector& new_dpi) const;
25 // Dimensions of the screen in pixels.
26 const webrtc::DesktopSize& dimensions() const { return dimensions_; }
28 // The vertical and horizontal DPI of the screen.
29 const webrtc::DesktopVector& dpi() const { return dpi_; }
31 // Returns true if |dimensions_| specifies an empty rectangle or when
32 // IsValid() returns false.
33 bool IsEmpty() const;
35 // Returns true if the dimensions and DPI of the two resolutions match.
36 bool Equals(const ScreenResolution& other) const;
38 private:
39 webrtc::DesktopSize dimensions_;
40 webrtc::DesktopVector dpi_;
43 } // namespace remoting
45 #endif // REMOTING_HOST_SCREEN_RESOLUTION_H_