Home | History | Annotate | Download | only in host
      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.
      4 
      5 #ifndef REMOTING_HOST_SCREEN_RESOLUTION_H_
      6 #define REMOTING_HOST_SCREEN_RESOLUTION_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/compiler_specific.h"
     10 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
     11 
     12 namespace remoting {
     13 
     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);
     20 
     21   // Returns the screen dimensions scaled according to the passed |new_dpi|.
     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_; }
     30 
     31   // Returns true if |dimensions_| specifies an empty rectangle or when
     32   // IsValid() returns false.
     33   bool IsEmpty() const;
     34 
     35   // Returns true if the dimensions and DPI of the two resolutions match.
     36   bool Equals(const ScreenResolution& other) const;
     37 
     38  private:
     39   webrtc::DesktopSize dimensions_;
     40   webrtc::DesktopVector dpi_;
     41 };
     42 
     43 }  // namespace remoting
     44 
     45 #endif  // REMOTING_HOST_SCREEN_RESOLUTION_H_
     46